dom/base/test/test_messageChannel.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/base/test/test_messageChannel.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,49 @@
     1.4 +
     1.5 +<!DOCTYPE HTML>
     1.6 +<html>
     1.7 +<!--
     1.8 +https://bugzilla.mozilla.org/show_bug.cgi?id=677638
     1.9 +-->
    1.10 +<head>
    1.11 +  <meta charset="utf-8">
    1.12 +  <title>Test for Bug 677638 - basic support</title>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=677638">Mozilla Bug 677638</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +  <iframe name="x" id="x"></iframe>
    1.21 +  <iframe name="y" id="y"></iframe>
    1.22 +</div>
    1.23 +<pre id="test">
    1.24 +</pre>
    1.25 +  <script type="application/javascript">
    1.26 +
    1.27 +  function runTest() {
    1.28 +    /** Test for Bug 677638 **/
    1.29 +    var a = new MessageChannel();
    1.30 +    ok(a, "MessageChannel created");
    1.31 +
    1.32 +    var port1 = a.port1;
    1.33 +    ok(port1, "MessageChannel.port1 exists");
    1.34 +    is(port1, a.port1, "MessageChannel.port1 is port1");
    1.35 +
    1.36 +    var port2 = a.port2;
    1.37 +    ok(port2, "MessageChannel.port1 exists");
    1.38 +    is(port2, a.port2, "MessageChannel.port2 is port2");
    1.39 +
    1.40 +    [ 'postMessage', 'start', 'close' ].forEach(function(e) {
    1.41 +      ok(e in port1, "MessagePort1." + e + " exists");
    1.42 +      ok(e in port2, "MessagePort2." + e + " exists");
    1.43 +    });
    1.44 +
    1.45 +    SimpleTest.finish();
    1.46 +  }
    1.47 +
    1.48 +  SimpleTest.waitForExplicitFinish();
    1.49 +  SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest);
    1.50 +  </script>
    1.51 +</body>
    1.52 +</html>

mercurial