tor-browser

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

permissions-policy-javascript-url-frame-policy.https.html (1038B)


      1 <!DOCTYPE html>
      2 
      3 <head>
      4  <script src=/resources/testharness.js></script>
      5  <script src=/resources/testharnessreport.js></script>
      6 </head>
      7 
      8 <body>
      9  <script>
     10  'use strict';
     11 
     12  const script = 'script';
     13  const testPage = `
     14  <${script}>
     15    parent.postMessage(document.fullscreenEnabled, '*');
     16  </${script}>
     17  `;
     18 
     19  function runTest(allow, expectation) {
     20    return new Promise((resolve, reject) => {
     21      window.onmessage = event => resolve(event.data);
     22 
     23      const iframe = document.createElement("iframe");
     24      iframe.allow = allow;
     25      iframe.src = `javascript: \`${testPage}\``;
     26      document.body.appendChild(iframe);
     27 
     28    }).then(enabled => {
     29      assert_equals(enabled, expectation);
     30    });
     31  }
     32 
     33  promise_test(() => runTest('fullscreen *', true),
     34      'allow attribute(container policy) can enable feature on javascript generated document');
     35 
     36  promise_test(() => runTest("fullscreen 'none'", false),
     37      'allow attribute(container policy) can disable feature on javascript generated document');
     38 
     39  </script>
     40 </body>