summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/signed-exchange/resources/register-sw-after-fallback.html
blob: 2711fc241f3215ff7e6649daefde40e7b2e147da (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: true,
        err: undefined,
        iframe_body: iframe.contentWindow.document.body.innerHTML});
  } catch (err) {
    event.data.port.postMessage({
        location: document.location.href,
        is_fallback: true,
        err: err.toString()
    });
  }
}, false);
</script>