From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- dom/base/test/worker_postMessages.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 dom/base/test/worker_postMessages.js (limited to 'dom/base/test/worker_postMessages.js') diff --git a/dom/base/test/worker_postMessages.js b/dom/base/test/worker_postMessages.js new file mode 100644 index 000000000..968ec209a --- /dev/null +++ b/dom/base/test/worker_postMessages.js @@ -0,0 +1,33 @@ +function test_workers() { + onmessage = function(e) { + postMessage(e.data, e.ports); + } +} + +function test_broadcastChannel() { + var bc = new BroadcastChannel('postMessagesTest_inWorkers'); + bc.onmessage = function(e) { + postMessage(e.data); + } +} + +function test_messagePort(port) { + port.onmessage = function(e) { + postMessage(e.data, e.ports); + } +} + +onmessage = function(e) { + if (e.data == 'workers') { + test_workers(); + postMessage('ok'); + } else if (e.data == 'broadcastChannel') { + test_broadcastChannel(); + postMessage('ok'); + } else if (e.data == 'messagePort') { + test_messagePort(e.ports[0]); + postMessage('ok'); + } else { + postMessage('ko'); + } +} -- cgit v1.2.3