summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/workers/Worker-call.worker.js
blob: ba07498880cbc94edddfee6e9f3c007a82025e54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
importScripts("/resources/testharness.js");
test(() => {
  try {
    postMessage("SUCCESS: postMessage() called directly");
    postMessage.call(null, "SUCCESS: postMessage() invoked via postMessage.call()");
    var saved = postMessage;
    saved("SUCCESS: postMessage() called via intermediate variable");
  } catch (ex) {
    assert_unreached("FAIL: unexpected exception (" + ex + ") received while calling functions from the worker context.");
  }
}, 'Test calling functions from WorkerContext.');
done();