Bumping manifests a=b2g-bump
[gecko.git] / dom / base / test / test_messageChannel_transferable.html
blobc1e661ead89ed83f9ea5745f1cf221623815691c
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=677638
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 677638 - port cloning</title>
9 <script type="application/javascript" 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=677638">Mozilla Bug 677638</a>
14 <div id="content"></div>
15 <pre id="test">
16 </pre>
17 <script type="application/javascript">
19 function start() {
20 var a = new MessageChannel();
21 ok(a, "MessageChannel created");
23 window.addEventListener('message', receiveMessage, false);
24 function receiveMessage(evt) {
25 if (evt.data.status == 'READY') {
26 runTest();
27 } else {
28 ok(false, "Unknown message");
32 var div = document.getElementById("content");
33 ok(div, "Parent exists");
35 var ifr = document.createElement("iframe");
36 ifr.addEventListener("load", iframeLoaded, false);
37 ifr.setAttribute('src', "iframe_messageChannel_post.html");
38 div.appendChild(ifr);
40 function iframeLoaded() {
41 ifr.contentWindow.postMessage({ port: a.port2 }, '*', [a.port2]);
44 a.port1.addEventListener('message', receivePortMessage, false);
45 function receivePortMessage(evt) {
46 is(evt.data.ab.byteLength, size, "The size is: " + size + " == " + ab.byteLength);
47 SimpleTest.finish();
50 // Start() is not implicity invoked when addEventListener is used.
51 a.port1.start();
53 var size = 1024 * 1024 * 32;
54 var ab = new ArrayBuffer(size);
55 is(ab.byteLength, size, "The size is: " + size + " == " + ab.byteLength);
57 function runTest() {
58 a.port1.postMessage({ab: ab, cb: ab}, [ab]);
59 ok(ab.byteLength == 0, "PostMessage - The size is: 0 == " + ab.byteLength)
63 SimpleTest.waitForExplicitFinish();
64 SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, start);
65 </script>
66 </body>
67 </html>