summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/fenced-frame/resources/before-unload-inner.html
blob: 6d23cf88a3ce4090f8131e11928b257fec00d527 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<!DOCTYPE html>
<script src="utils.js"></script>
<title>Fenced frame content to report the beforeunload event is not fired</title>

<body>
<script>
window.onload = () => {
  const [before_unload_key] = parseKeylist();
  const url = new URL(location.href);
  const next_url = url.searchParams.get('next_url');

  if (next_url != null) {
    writeValueToServer(
        before_unload_key, 'Loaded the next url in a fenced frame');
    return;
  }

  window.onbeforeunload = () => {
    writeValueToServer(
        before_unload_key, 'The beforeunload event is unexpectely fired.');
  };

  location.href =
      generateURL('before-unload-inner.html?next_url', [before_unload_key]);
};
</script>
</body>