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..74bc3927ebe560eaa747341dc709ed58f404caef |
--- /dev/null |
+++ b/LayoutTests/http/tests/serviceworker/resources/client-id-worker.js |
@@ -0,0 +1,26 @@ |
+self.onmessage = function(e) { |
+ var port = e.data.port; |
+ var message = []; |
+ |
+ Promise.resolve() |
+ .then(function() { |
+ // 1st matchAll() |
+ return self.clients.matchAll().then(function(clients) { |
+ clients.forEach(function(client) { |
+ message.push(client.id); |
+ }); |
+ }); |
+ }) |
+ .then(function() { |
+ // 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); |
+ }); |
+}; |