tor-browser

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

test_bug1777572.html (1100B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <meta charset="utf-8">
      5  <title>bug 1777572</title>
      6  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      7  <link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
      8  <script>
      9  SimpleTest.waitForExplicitFinish();
     10 
     11  async function testCSPInheritance(closeOpenerWindow) {
     12    let url = "file_bug1777572.html";
     13    if (closeOpenerWindow) {
     14      url += "?close";
     15    }
     16    let win = window.open(url);
     17    return new Promise((resolve) => {
     18      window.addEventListener("message", (event) => {
     19        ok(event.data.includes("img-src"), "Got expected data " + event.data);
     20        resolve();
     21      }, { once: true});
     22    });
     23  }
     24 
     25  async function run() {
     26    // Test that CSP inheritance to the initial about:blank works the same way
     27    // whether or not the opener is already closed when window.open is called.
     28    await testCSPInheritance(false);
     29    await testCSPInheritance(true);
     30    SimpleTest.finish();
     31  }
     32 
     33  </script>
     34 </head>
     35 <body onload="run()">
     36 <p id="display"></p>
     37 <div id="content" style="display: none"></div>
     38 <pre id="test"></pre>
     39 </body>
     40 </html>