Chromium Code Reviews| 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); |
| }) |