blob: 86d66c8c83b0e449e0797fe5c24e928a1b2232bb [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<script src="../resources/js-test.js"></script>
<script>
description("Worker to worker communication via MessagePorts");
if (window.testRunner)
window.testRunner.waitUntilDone();
const worker = (port) => new Promise(resolve => {
const w = new Worker("worker-to-worker.js");
w.postMessage({ port }, [port]);
w.onmessage = (e) => {
debug(e.data);
resolve();
};
});
const mc = new MessageChannel();
Promise.all([
worker(mc.port1),
worker(mc.port2),
]).then(() => {
if (window.testRunner)
window.testRunner.notifyDone();
});
</script>
</body>
</html>