gecko-dev/dom/broadcastchannel/tests/broadcastchannel_worker.js
Florian Quèze 85611a7b6d Bug 1331081 - script generated patch to omit addEventListener/removeEventListener's third parameter when it's false, r=jaws.
--HG--
extra : rebase_source : a22344ee1569f58f1f0a01017bfe0d46a6a14602
2017-01-17 11:50:25 +01:00

19 lines
486 B
JavaScript

onmessage = function(evt) {
if (evt.data != 0) {
var worker = new Worker("broadcastchannel_worker.js");
worker.onmessage = function(evt) {
postMessage(evt.data);
}
worker.postMessage(evt.data - 1);
return;
}
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();
});
postMessage("READY");
}