Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 var port = null; | |
| 2 | |
| 3 self.onmessage = function(e) { | |
| 4 if (!port && e.data.port) { | |
| 5 port = e.data.port; | |
| 6 return; | |
| 7 } | |
|
nhiroki
2015/10/08 09:19:06
You could remove this hack if the document sends u
zino
2015/10/08 13:35:36
Done.
| |
| 8 | |
| 9 var url = e.data; | |
| 10 var client; | |
| 11 | |
| 12 self.clients.matchAll({ includeUncontrolled : true }).then(function(cs) { | |
| 13 cs.forEach(function(c) { | |
| 14 if (c.frameType == 'nested') | |
| 15 client= c; | |
|
nhiroki
2015/10/08 09:19:06
nit: space before '='
zino
2015/10/08 13:35:36
Done.
| |
| 16 }); | |
| 17 client.navigate(url).then(function(c) { | |
|
nhiroki
2015/10/08 09:19:06
nit: To unindent, you might want to return a promi
zino
2015/10/08 13:35:36
Done.
| |
| 18 if (!c) | |
| 19 port.postMessage(c); | |
| 20 else | |
| 21 port.postMessage(c.url); | |
| 22 }) | |
| 23 .catch(function(e) { | |
| 24 port.postMessage(e.name); | |
| 25 }); | |
| 26 }); | |
| 27 }; | |
| OLD | NEW |