Thu, 15 Jan 2015 15:55:04 +0100
Back out 97036ab72558 which inappropriately compared turds to third parties.
1 <!DOCTYPE html>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=822094
5 -->
6 <head><meta charset=utf-8>
7 <title>postMessage transferable tests</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script type="text/javascript" src="browserFu.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=822094">Mozilla Bug 822094</a>
14 <p id="display"></p>
15 <div id="content" style="display: none">
17 <iframe src="postMessage_transfer_helper.html"
18 name="sameDomain"></iframe>
19 <iframe src="http://example.org:8000/tests/dom/tests/mochitest/whatwg/postMessage_transfer_helper.html"
20 name="crossDomain"></iframe>
22 </div>
23 <pre id="test">
24 <script class="testbody" type="application/javascript">
26 SimpleTest.waitForExplicitFinish();
28 var tests = [
29 function() { testFunc(window, "http://mochi.test:8888"); },
30 function() { testFunc(frames.sameDomain, "http://mochi.test:8888"); },
31 function() { testFunc(frames.crossDomain, "http://example.org:8000"); },
32 function() { SimpleTest.finish(); },
33 ];
35 function testFunc(target, origin) {
36 var ab = new ArrayBuffer(1);
37 var cd = new ArrayBuffer(1);
39 target.postMessage([ab, cd], origin, [ab]);
40 is(ab.byteLength, 0, "ab should be neutered");
41 is(cd.byteLength, 1, "cd should not be neutered");
43 onmessage = function(e) {
44 is(e.data[0].byteLength, 1, "ab should be transfered");
45 is(e.data[1].byteLength, 1, "cd should be cloned");
46 nextTest();
47 };
48 }
50 function nextTest() {
51 var t = tests.shift();
52 t();
53 };
55 onload = function() {
56 nextTest();
57 };
59 </script>
60 </pre>
61 </body>
62 </html>