summaryrefslogtreecommitdiffstats
path: root/dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js
blob: 4dad5ae82578f5a100455e425c02ef833dcb58c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
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");
  }
}