tor-browser

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

test_messageChannel_bug1178076.html (1066B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1178076
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1178076</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1178076">Mozilla Bug 1178076</a>
     14 <div id="content"></div>
     15 <pre id="test">
     16 </pre>
     17  <script type="application/javascript">
     18 
     19  function runTest() {
     20    onmessage = function(e) {
     21      is(e.ports.length, 1, "A port has been received!");
     22      var port = e.ports[0];
     23      ok(port instanceof MessagePort, "This is a port.");
     24      SimpleTest.finish();
     25    }
     26 
     27    // In this test we want to see if we leak a neutered port closing port1
     28    // and sending port2 to the same window. This operation doesn't involve IPC.
     29    var mc = new MessageChannel();
     30    mc.port1.close();
     31    postMessage(42, '*', [mc.port2]);
     32  }
     33 
     34  SimpleTest.waitForExplicitFinish();
     35  runTest();
     36  </script>
     37 </body>
     38 </html>