summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/signed-exchange/resources/register-sw.html
blob: 8a3873bfde88dd9bd0cc979f3db6a7d88b776d22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!DOCTYPE html>
<script src="sxg-util.js"></script>
<script>
window.addEventListener('message', async (event) => {
  try {
    const scope = './scope/' + location.href;
    await registerServiceWorkerAndWaitUntilActivated(
        './service-worker.js', scope)
    const iframe = await withIframe(scope, 'inner_iframe');
    event.data.port.postMessage({
        location: document.location.href,
        is_fallback: false,
        err: undefined,
        iframe_body: iframe.contentWindow.document.body.innerHTML});
  } catch (err) {
    event.data.port.postMessage({
        location: document.location.href,
        is_fallback: false,
        err: err.toString()
    });
  }
}, false);
</script>