diff options
Diffstat (limited to 'testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js')
-rw-r--r-- | testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js b/testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js new file mode 100644 index 000000000..f0ae90d81 --- /dev/null +++ b/testing/web-platform/tests/service-workers/service-worker/resources/clients-matchall-worker.js @@ -0,0 +1,24 @@ +self.onmessage = function(e) { + var port = e.data.port; + var options = e.data.options; + + self.clients.matchAll(options).then(function(clients) { + var message = []; + clients.forEach(function(client) { + var frame_type = client.frameType; + if (client.url.indexOf('clients-matchall-include-uncontrolled.https.html') > -1 && + client.frameType == 'auxiliary') { + // The test tab might be opened using window.open() by the test framework. + // In that case, just pretend it's top-level! + frame_type = 'top-level'; + } + message.push([client.visibilityState, + client.focused, + client.url, + frame_type]); + }); + // Sort by url + message.sort(function(a, b) { return a[2] > b[2] ? 1 : -1; }); + port.postMessage(message); + }); +}; |