diff options
Diffstat (limited to 'dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js')
-rw-r--r-- | dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js b/dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js new file mode 100644 index 000000000..4dad5ae82 --- /dev/null +++ b/dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js @@ -0,0 +1,12 @@ +onconnect = function(evt) { + evt.ports[0].onmessage = function(evt) { + var bc = new BroadcastChannel('foobar'); + bc.addEventListener('message', function(event) { + bc.postMessage(event.data == "hello world from the window" ? + "hello world from the worker" : "KO"); + bc.close(); + }, false); + + evt.target.postMessage("READY"); + } +} |