tor-browser

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

test_access_control.html (1336B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=451958
      5 -->
      6 <head>
      7  <title>Test for Bug 451958</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <script type="text/javascript" src="manifest.js"></script>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=451958">Mozilla Bug 451958</a>
     14 <p id="display"></p>
     15 <div id="content" style="display: none">
     16 </div>
     17 <pre id="test">
     18 <script type="application/javascript">
     19 
     20 /** Test for Bug 451958 */
     21 
     22 function openWindow() {
     23  window.open("http://example.org:80/tests/dom/media/test/file_access_controls.html", "", "width=500,height=500");
     24 }
     25 
     26 function run() {
     27  SpecialPowers.pushPrefEnv({
     28    "set": [
     29      ["dom.security.https_first", false],
     30    ],
     31  }, openWindow);
     32 }
     33 
     34 function done() {
     35  mediaTestCleanup();
     36  SimpleTest.finish();
     37 }
     38 
     39 addLoadEvent(run);
     40 SimpleTest.waitForExplicitFinish();
     41 
     42 
     43 window.addEventListener("message", receiveMessage);
     44 
     45 function receiveMessage(event)
     46 {
     47  if (event.origin !== "http://example.org") {
     48    ok(false, "Received message from wrong domain");
     49    return;
     50  }
     51 
     52  if (event.data.done == "true") {
     53    done();
     54    return;
     55  }
     56 
     57  ok(event.data.result, event.data.message);
     58 }
     59 </script>
     60 </pre>
     61 </body>
     62 </html>