tor-browser

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

sxg-reporting-navigation-ok.tentative.html (1878B)


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