tor-browser

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

sxg-reporting-navigation-parse_error.tentative.html (1812B)


      1 <!DOCTYPE html>
      2 <title>SXG reporting test of sxg.parse_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 
     13 nel_iframe_test(async t => {
     14  await loadResourceWithBasicPolicyInIframe();
     15  const sxg_url =
     16      alt_origin +
     17      '/signed-exchange/resources/sxg/sxg-invalid-format.sxg?navigation';
     18  try {
     19    const message = await openSXGInIframeAndWaitForMessage(t, sxg_url);
     20    if (message.is_fallback) {
     21        assert_unreached('Fallback redirect should not have happened');
     22    } else {
     23        assert_unreached('SXG should not have loaded');
     24    }
     25  } catch (e) {
     26    assert_equals(e, 'timeout');
     27  }
     28 
     29  assert_true(await reportsExist([
     30    {
     31      url: sxg_url,
     32      user_agent: navigator.userAgent,
     33      type: "network-error",
     34      body: {
     35        phase: "sxg",
     36        type: "sxg.parse_error",
     37        status_code: 200,
     38        referrer: location.origin + '/',
     39        sxg: {
     40          outer_url: sxg_url,
     41          cert_url: []
     42        }
     43      },
     44      metadata: {
     45        content_type: "application/reports+json",
     46      },
     47    },
     48    {
     49      url: sxg_url,
     50      user_agent: navigator.userAgent,
     51      type: "network-error",
     52      body: {
     53        phase: "application",
     54        type: "ok",
     55        status_code: 200,
     56        referrer: location.origin + '/',
     57      },
     58      metadata: {
     59        content_type: "application/reports+json",
     60      },
     61    },
     62  ]));
     63 }, 'SXG reporting test of sxg.parse_error for navigation.');
     64 </script>
     65 </body>