<!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>
