| 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..2f0e4eaa34c8ab521d74ad489542f97dbf421def
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/broadcastchannel/resources/worker.js
|
| @@ -0,0 +1,26 @@
|
| +var c;
|
| +
|
| +function handler(e, reply) {
|
| + if (e.data.ping) {
|
| + c.postMessage(e.data.ping);
|
| + return;
|
| + }
|
| + if (e.data.blob) {
|
| + c.postMessage({blob: new Blob(e.data.blob)});
|
| + }
|
| + c = new BroadcastChannel(e.data.channel);
|
| + let messages = [];
|
| + c.onmessage = e => {
|
| + messages.push(e.data);
|
| + if (e.data == 'done')
|
| + 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));
|
| +};
|
|
|