[Pointer Events WPT] Unskip imported/w3c/web-platform-tests/pointerevents/pointereven...
[WebKit-https.git] / LayoutTests / workers / worker-to-worker.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../resources/js-test.js"></script>
5 <script>
6 description("Worker to worker communication via MessagePorts");
7
8 if (window.testRunner)
9   window.testRunner.waitUntilDone();
10
11 const worker = (port) => new Promise(resolve => {
12   const w = new Worker("worker-to-worker.js");
13   w.postMessage({ port }, [port]);
14   w.onmessage = (e) => {
15     debug(e.data);
16     resolve();
17   };
18 });
19
20 const mc = new MessageChannel();
21 Promise.all([
22   worker(mc.port1),
23   worker(mc.port2),
24 ]).then(() => {
25   if (window.testRunner)
26     window.testRunner.notifyDone();
27 });
28
29 </script>
30 </body>
31 </html>
32