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