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.
|
+ }); |
+}; |