summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/webmessaging/message-channels/worker.any.js
blob: 633d89a3712f04feacc8df0c705022acc40d9bd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
async_test(t => {
  function workerCode() {
    close();
    var mc = new MessageChannel();
    mc.port1.postMessage(42);
    mc.port2.postMessage(42);
    postMessage(true);
  }

  var workerBlob = new Blob([workerCode.toString() + ";workerCode();"], {type:"application/javascript"});

  var w = new Worker(URL.createObjectURL(workerBlob));
  w.onmessage = function(e) {
    assert_true(e.data, "MessageChannel created on worker shutdown.");
    t.done();
  }
}, 'MessageChannel/MessagePort created and used after a worker self.close()');