tor-browser

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

coep-mismatch.html (979B)


      1 <!DOCTYPE html>
      2 <meta charset=utf-8>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="early-hints-helpers.sub.js"></script>
      6 <body>
      7 <script>
      8 const SEARCH_PARAMS = new URLSearchParams(window.location.search);
      9 const EARLY_HINTS_POLICY = SEARCH_PARAMS.get("early-hints-policy");
     10 const FINAL_POLICY = SEARCH_PARAMS.get("final-policy");
     11 
     12 promise_test(async (t) => {
     13    const resource_url = SEARCH_PARAMS.get("resource-url");
     14    if (FINAL_POLICY === "require-corp") {
     15        assert_equals(EARLY_HINTS_POLICY, "unsafe-none");
     16        await promise_rejects_js(t, Error, fetchScript(resource_url));
     17    } else {
     18        assert_equals(EARLY_HINTS_POLICY, "require-corp");
     19        await fetchScript(resource_url);
     20        assert_false(isPreloadedByEarlyHints(resource_url));
     21    }
     22 }, `Early Hints COEP mismatch: Early Hints policy = ${EARLY_HINTS_POLICY}, final response policy = ${FINAL_POLICY}.`);
     23 </script>
     24 </body>