Chromium Code Reviews| Index: LayoutTests/http/tests/serviceworker/resources/client-id-worker.js |
| diff --git a/LayoutTests/http/tests/serviceworker/resources/client-id-worker.js b/LayoutTests/http/tests/serviceworker/resources/client-id-worker.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b286da344c93c7835c1111de4e8c9e326330899d |
| --- /dev/null |
| +++ b/LayoutTests/http/tests/serviceworker/resources/client-id-worker.js |
| @@ -0,0 +1,24 @@ |
| +self.onmessage = function(e) { |
| + var port = e.data.port; |
| + var message = []; |
| + |
| + // 1st matchAll() |
| + self.clients.matchAll() |
| + .then(function(clients) { |
| + clients.forEach(function(client) { |
| + message.push(client.id); |
| + }); |
| + }) |
| + .then(function() { |
|
falken
2015/06/25 04:09:56
why is this a new function, it looks like the prev
jungkees
2015/06/25 07:48:37
The first forEach implicitly returns undefined, bu
|
| + // 2nd matchAll() |
| + return self.clients.matchAll().then(function(clients) { |
| + clients.forEach(function(client) { |
| + message.push(client.id); |
| + }); |
| + }); |
| + }) |
| + .then(function() { |
| + // Send an array containing ids of clients from 1st and 2nd matchAll() |
| + port.postMessage(message); |
| + }); |
| +}; |