tor-browser

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

permissions-policy-opaque-origin-history.https.html (1486B)


      1 <!DOCTYPE html>
      2 <body>
      3  <script src=/resources/testharness.js></script>
      4  <script src=/resources/testharnessreport.js></script>
      5  <script>
      6 
      7    function get_response() {
      8      return new Promise(resolve => {
      9        window.addEventListener('message', e => {
     10          resolve(e.data);
     11        }, { once: true });
     12      });
     13    }
     14 
     15    promise_test(async () => {
     16      // - opaque-origin-history1.html navigates itself to opaque-origin-history2.html.
     17      // - opaque-origin-history2.html call window.history.back() to navigate
     18      // back to opaque-origin-history1.html
     19      // - opaque-origin-history1.html should still be able to access fullscreen
     20      // feature after the history.back() navigation.
     21      const iframe = document.createElement('iframe');
     22      // sandbox iframe so that it has opaque origin.
     23      iframe.sandbox = 'allow-scripts';
     24      iframe.src = 'resources/opaque-origin-history1.sub.https.html';
     25      iframe.allow = "fullscreen 'src'";
     26      document.body.appendChild(iframe);
     27 
     28 
     29      assert_equals(
     30        await get_response(),
     31        'fullscreen enabled in opaque-origin-history1.html',
     32        'iframe should be able to access fullscreen.'
     33      );
     34 
     35      iframe.contentWindow.postMessage('redirect', '*');
     36 
     37      assert_equals(
     38        await get_response(),
     39        'fullscreen enabled in opaque-origin-history1.html',
     40        'iframe should still be able to access fullscreen after history.back() navigation.'
     41      );
     42    });
     43  </script>
     44 </body>