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

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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b155d62f92a725a13da45f4fc94aeb58615e8641
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/windowclient-navigate-worker.js
@@ -0,0 +1,26 @@
+var port = null;
+
+self.onmessage = function(e) {
+ port = e.data.port;
+ port.onmessage = on_message;
+ port.postMessage('ready');
+};
+
+function on_message(e) {
+ var url = e.data;
+ var client;
+
+ self.clients.matchAll({ includeUncontrolled : true }).then(function(cs) {
+ cs.forEach(function(c) { c.frameType == 'nested' && (client = c); });
+ return client.navigate(url);
+ })
+ .then(function(c) {
+ if (!c)
+ port.postMessage(c);
+ else
+ port.postMessage(c.url);
+ })
+ .catch(function(e) {
+ port.postMessage(e.name);
+ });
+}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/windowclient-navigate.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698