sxg-reporting-navigation-mi_error.tentative.html (2052B)
1 <!DOCTYPE html> 2 <title>SXG reporting test of sxg.mi_error for navigation</title> 3 <meta name="timeout" content="long"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/common/get-host-info.sub.js"></script> 7 <script src="/network-error-logging/support/nel.sub.js"></script> 8 <script src="../resources/sxg-util.js"></script> 9 <body> 10 <script> 11 const alt_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN; 12 const test_origin = get_host_info().HTTPS_ORIGIN; 13 14 nel_iframe_test(async t => { 15 await loadResourceWithBasicPolicyInIframe(); 16 const sxg_url = 17 alt_origin + 18 '/signed-exchange/resources/sxg/sxg-merkle-integrity-error.sxg?navigation'; 19 const cert_url = test_origin + '/signed-exchange/resources/127.0.0.1.sxg.pem.cbor'; 20 try { 21 const message = await openSXGInIframeAndWaitForMessage(t, sxg_url); 22 if (message.is_fallback) { 23 assert_unreached('Fallback redirect should not have happened'); 24 } else { 25 assert_unreached('SXG should not have loaded'); 26 } 27 } catch (e) { 28 assert_equals(e, 'timeout'); 29 } 30 assert_true(await reportsExist([ 31 { 32 url: sxg_url, 33 user_agent: navigator.userAgent, 34 type: "network-error", 35 body: { 36 phase: "sxg", 37 type: "sxg.mi_error", 38 status_code: 200, 39 referrer: location.origin + '/', 40 sxg: { 41 outer_url: sxg_url, 42 inner_url: 43 innerURLOrigin() + '/signed-exchange/resources/inner-url.html', 44 cert_url: [cert_url] 45 } 46 }, 47 metadata: { 48 content_type: "application/reports+json", 49 }, 50 }, 51 { 52 url: sxg_url, 53 user_agent: navigator.userAgent, 54 type: "network-error", 55 body: { 56 phase: "application", 57 type: "ok", 58 status_code: 200, 59 referrer: location.origin + '/', 60 }, 61 metadata: { 62 content_type: "application/reports+json", 63 }, 64 } 65 ])); 66 }, 'SXG reporting test of sxg.mi_error for navigation.'); 67 </script> 68 </body>