Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js

Issue 1390993002: ServiceWorker: Add layout test for WindowClient.navigate(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
new file mode 100644
index 0000000000000000000000000000000000000000..97c71821c9738a36b1bbf29c6626ef3f96e0ed75
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
@@ -0,0 +1,27 @@
+var port = null;
+
+self.onmessage = function(e) {
+ if (!port && e.data.port) {
+ port = e.data.port;
+ return;
+ }
nhiroki 2015/10/08 09:19:06 You could remove this hack if the document sends u
zino 2015/10/08 13:35:36 Done.
+
+ var url = e.data;
+ var client;
+
+ self.clients.matchAll({ includeUncontrolled : true }).then(function(cs) {
+ cs.forEach(function(c) {
+ if (c.frameType == 'nested')
+ client= c;
nhiroki 2015/10/08 09:19:06 nit: space before '='
zino 2015/10/08 13:35:36 Done.
+ });
+ client.navigate(url).then(function(c) {
nhiroki 2015/10/08 09:19:06 nit: To unindent, you might want to return a promi
zino 2015/10/08 13:35:36 Done.
+ if (!c)
+ port.postMessage(c);
+ else
+ port.postMessage(c.url);
+ })
+ .catch(function(e) {
+ port.postMessage(e.name);
+ });
+ });
+};

Powered by Google App Engine
This is Rietveld 408576698