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

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

Issue 1604893002: ServiceWorker: Rewrite windowclient-navigate.html test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
index b155d62f92a725a13da45f4fc94aeb58615e8641..92b60d01e74449ed91138378b8914de8ddde3a8e 100644
--- 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
@@ -1,16 +1,26 @@
var port = null;
+var in_scope_but_not_controlled = null;
+
+self.oninstall = function(e) {
+ clients.matchAll({ includeUncontrolled : true }).then(function(cs) {
+ return cs[0].navigate('blank.html');
+ })
+ .catch(function(e) {
+ in_scope_but_not_controlled = e.name.toString();
nhiroki 2016/01/20 03:56:34 This might not work because there should be only a
zino 2016/01/20 17:24:05 Good catch!
+ });
+};
self.onmessage = function(e) {
port = e.data.port;
port.onmessage = on_message;
- port.postMessage('ready');
+ port.postMessage(in_scope_but_not_controlled);
};
function on_message(e) {
var url = e.data;
var client;
- self.clients.matchAll({ includeUncontrolled : true }).then(function(cs) {
+ clients.matchAll({ includeUncontrolled : true }).then(function(cs) {
cs.forEach(function(c) { c.frameType == 'nested' && (client = c); });
return client.navigate(url);
})
« 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