Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | |
michael@0 | 2 | <!DOCTYPE HTML> |
michael@0 | 3 | <html> |
michael@0 | 4 | <!-- |
michael@0 | 5 | https://bugzilla.mozilla.org/show_bug.cgi?id=913761 |
michael@0 | 6 | --> |
michael@0 | 7 | <head> |
michael@0 | 8 | <meta charset="utf-8"> |
michael@0 | 9 | <title>Test for Bug 913761 - basic support</title> |
michael@0 | 10 | <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 11 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
michael@0 | 12 | </head> |
michael@0 | 13 | <body> |
michael@0 | 14 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=913761">Mozilla Bug 913761</a> |
michael@0 | 15 | <script type="application/javascript"> |
michael@0 | 16 | |
michael@0 | 17 | function runTest() { |
michael@0 | 18 | var transportChannel = new MessageChannel(); |
michael@0 | 19 | transportChannel.port1.onmessage = function (event) { |
michael@0 | 20 | ok(true, 'Port Returned.'); |
michael@0 | 21 | var portToService = event.data.port; |
michael@0 | 22 | portToService.onmessage = function (event) { |
michael@0 | 23 | ok(true, "message received"); |
michael@0 | 24 | SimpleTest.finish(); |
michael@0 | 25 | }; |
michael@0 | 26 | portToService.postMessage('READY?'); |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | var serviceChannel = new MessageChannel(); |
michael@0 | 30 | serviceChannel.port1.onmessage = function (event) { |
michael@0 | 31 | if (event.data == 'READY?') { |
michael@0 | 32 | this.postMessage('READY!'); |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | transportChannel.port2.postMessage({ port: serviceChannel.port2}, [serviceChannel.port2]); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 40 | SpecialPowers.pushPrefEnv({"set": [["dom.messageChannel.enabled", true]]}, runTest); |
michael@0 | 41 | </script> |
michael@0 | 42 | </body> |
michael@0 | 43 | </html> |