summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/service-workers/service-worker/resources/claim-nested-worker-fetch-iframe.html
blob: 2fa15db61d9ce6742f077e72b98629f49e0b7380 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<!doctype html>
<script>
// An iframe that starts a nested worker. Our parent frame (the test page) calls
// fetch_in_worker() to ask the nested worker to perform a fetch to see whether
// it's controlled by a service worker.
var worker = new Worker('./claim-nested-worker-fetch-parent-worker.js');

function fetch_in_worker(url) {
  return new Promise((resolve) => {
    worker.onmessage = (event) => {
      resolve(event.data);
    };
    worker.postMessage(url);
  });
}
</script>