summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/resources/serviceWorker-navigate.js
blob: a7a4db52ee61f707ce20cb185ec29265cb08007b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
self.importScripts('utils.js');

self.onmessage = function(e) {
  var key = e.data.key;
  var url = e.data.url;

  e.waitUntil(self.clients.claim().then(() => {
      return self.clients.matchAll({type: 'window'});
    }).then(clients => {
      return clients.map(client => {
        // Check to make sure WindowClient.navigate() is supported.
        if (client.url === url) {
          return client.navigate(generateURL('serviceWorker-navigate-inner-success.html',
                                        [key]));
        }
      });
    }));
};