tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

sxg-reporting-prefetch-invalid_integrity_header.tentative.html (1759B)


      1 <!DOCTYPE html>
      2 <title>SXG reporting test of sxg.invalid_integrity_header 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 =
     16      alt_origin +
     17      '/signed-exchange/resources/sxg/sxg-invalid-integrity-header.sxg?prefetch';
     18  const cert_url = test_origin + '/signed-exchange/resources/127.0.0.1.sxg.pem.cbor';
     19  addPrefetch(sxg_url);
     20  assert_true(await reportsExist([
     21    {
     22      url: sxg_url,
     23      user_agent: navigator.userAgent,
     24      type: "network-error",
     25      body: {
     26        phase: "sxg",
     27        type: "sxg.invalid_integrity_header",
     28        status_code: 200,
     29        referrer: location.origin + '/',
     30        sxg: {
     31          outer_url: sxg_url,
     32          inner_url:
     33              innerURLOrigin() + '/signed-exchange/resources/inner-url.html',
     34          cert_url: [cert_url]
     35        }
     36      },
     37      metadata: {
     38        content_type: "application/reports+json",
     39      },
     40    },
     41    {
     42      url: sxg_url,
     43      user_agent: navigator.userAgent,
     44      type: "network-error",
     45      body: {
     46        phase: "application",
     47        type: "ok",
     48        status_code: 200,
     49        referrer: location.origin + '/',
     50      },
     51      metadata: {
     52        content_type: "application/reports+json",
     53      },
     54    },
     55  ]));
     56 }, 'SXG reporting test of sxg.invalid_integrity_header for prefetch.');
     57 </script>
     58 </body>