tor-browser

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

insecure-context.html (1100B)


      1 <!DOCTYPE html>
      2 <title>Insecure Context Test</title>
      3 <script src="/common/utils.js"></script>
      4 <script src="/resources/testharness.js"></script>
      5 <script src="/resources/testharnessreport.js"></script>
      6 <script src="resources/utils.js"></script>
      7 
      8 <body>
      9 
     10 <script>
     11 promise_test(async t => {
     12  const loaded_key = token();
     13  attachFencedFrame(generateURL(
     14    "resources/csp-fenced-frame-src-allowed-inner.html", [loaded_key]));
     15 
     16  // There is no API to observe whether the document in the FencedFrame loaded
     17  // or not. Instead, set up a timeout. If the document loads, "loaded" will be
     18  // sent to the server. Otherwise "blocked" will be sent after 3 seconds.
     19  step_timeout(() => {
     20    writeValueToServer(loaded_key, "blocked");
     21  }, 3000);
     22 
     23  const message = await nextValueFromServer(loaded_key);
     24 
     25  assert_equals(message, "blocked");
     26 }, 'FencedFrame is not available in an insecure context');
     27 
     28 promise_test(async t => {
     29  assert_throws_js(TypeError, () => navigator.canLoadAdAuctionFencedFrame());
     30 }, 'navigator.canLoadAdAuctionFencedFrame is unavailable in insecure contexts');
     31 </script>
     32 
     33 </body>