tor-browser

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

policy-extends-to-sandbox.html (965B)


      1 <!DOCTYPE html>
      2 <title>Feature policy treats opaque origins correctly</title>
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <body>
      6 <script>
      7  "use strict";
      8  async_test(t => {
      9    let frame = document.createElement('iframe');
     10    frame.src = "/feature-policy/resources/sandbox-self.html";
     11    frame.allow = "fullscreen";
     12    frame.sandbox = "allow-scripts";
     13 
     14    var handle_message = t.step_func(evt => {
     15      if (evt.source === frame.contentWindow) {
     16        assert_equals(evt.data.child, true, "'self' in header should match origin of sandboxed frame.");
     17        assert_equals(evt.data.grandchild, false, "Opaque origins should not match each other.");
     18        document.body.removeChild(frame);
     19        window.removeEventListener('message', handle_message);
     20        t.done();
     21      }
     22    });
     23    window.addEventListener('message', handle_message);
     24    document.body.appendChild(frame);
     25  });
     26 </script>