Chromium Code Reviews

Unified Diff: LayoutTests/http/tests/serviceworker/resources/client-id-worker.js

Issue 1209493002: Service Worker: Surface Client.id attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
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() {
+ // 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);
+ });
+};

Powered by Google App Engine