| Index: third_party/WebKit/LayoutTests/broadcastchannel/resources/worker.js
|
| diff --git a/third_party/WebKit/LayoutTests/broadcastchannel/resources/worker.js b/third_party/WebKit/LayoutTests/broadcastchannel/resources/worker.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b8ca643dbdda782e012d01d12bde846140c5f9cd
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/broadcastchannel/resources/worker.js
|
| @@ -0,0 +1,22 @@
|
| +
|
| +function handler(e, reply) {
|
| + let c = new BroadcastChannel(e.data.channel);
|
| + let messages = [];
|
| + c.onmessage = e => {
|
| + messages.push(e.data);
|
| + if (e.data == 'done') {
|
| + if (e.source)
|
| + e.source.postMessage(messages);
|
| + else
|
| + reply(messages);
|
| + }
|
| + };
|
| + c.postMessage('from worker');
|
| +}
|
| +
|
| +onmessage = e => handler(e, postMessage);
|
| +
|
| +onconnect = e => {
|
| + let port = e.ports[0];
|
| + port.onmessage = e => handler(e, msg => port.postMessage(msg));
|
| +};
|
|
|