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

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

Issue 1211253007: ServiceWorker: Add LayoutTest for WindowClient.navigate(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 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: LayoutTests/http/tests/serviceworker/resources/windowclient-navigate.js
diff --git a/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate.js b/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate.js
new file mode 100644
index 0000000000000000000000000000000000000000..8cbf1a1f382b5bcfaa641ddc30d9f9f9ef559f44
--- /dev/null
+++ b/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate.js
@@ -0,0 +1,22 @@
+self.onmessage = function(e) {
+ var url = e.data;
+ var host;
+ var client;
+
+ self.clients.matchAll({ includeUncontrolled : true }).then(function(cs) {
+ cs.forEach(function(c) {
+ if (c.url.search('#message') != -1)
+ host = c;
+ else if (c.url.search('#client') != -1)
+ client= c;
+ });
+ client.navigate(url).then(function(c) {
+ if (!c)
+ host.postMessage(c);
+ else
+ host.postMessage(c.url);
+ }).catch(function(e) {
+ host.postMessage(e.name);
+ });
nhiroki 2015/09/28 08:59:21 promise-chain indent (see my other comment) clien
zino 2015/10/07 02:30:41 Done.
+ });
+};

Powered by Google App Engine
This is Rietveld 408576698