sxg-reporting-prefetch-ok.tentative.html (1663B)
1 <!DOCTYPE html> 2 <title>SXG reporting test of ok for prefetch</title> 3 <script src="/resources/testharness.js"></script> 4 <script src="/resources/testharnessreport.js"></script> 5 <script src="/common/get-host-info.sub.js"></script> 6 <script src="/network-error-logging/support/nel.sub.js"></script> 7 <script src="../resources/sxg-util.js"></script> 8 <body> 9 <script> 10 const alt_origin = get_host_info().HTTPS_NOTSAMESITE_ORIGIN; 11 const test_origin = get_host_info().HTTPS_ORIGIN; 12 13 nel_test(async t => { 14 await fetchResourceWithBasicPolicy(); 15 const sxg_url = alt_origin + '/signed-exchange/resources/sxg/sxg-location.sxg?prefetch'; 16 const cert_url = test_origin + '/signed-exchange/resources/127.0.0.1.sxg.pem.cbor'; 17 addPrefetch(sxg_url); 18 assert_true(await reportsExist([ 19 { 20 url: sxg_url, 21 user_agent: navigator.userAgent, 22 type: "network-error", 23 body: { 24 phase: "sxg", 25 type: "ok", 26 status_code: 200, 27 referrer: location.origin + '/', 28 sxg: { 29 outer_url: sxg_url, 30 inner_url: 31 innerURLOrigin() + '/signed-exchange/resources/inner-url.html', 32 cert_url: [cert_url] 33 } 34 }, 35 metadata: { 36 content_type: "application/reports+json", 37 }, 38 }, 39 { 40 url: sxg_url, 41 user_agent: navigator.userAgent, 42 type: "network-error", 43 body: { 44 phase: "application", 45 type: "ok", 46 status_code: 200, 47 referrer: location.origin + '/', 48 }, 49 metadata: { 50 content_type: "application/reports+json", 51 }, 52 }, 53 ])); 54 }, 'SXG success report must be sent for prefetching.'); 55 </script> 56 </body>