summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/browsers/browsing-the-web/back-forward-cache/eligibility/broadcast-channel.html
blob: bc04a5ed7f1c1feea66a6db74d6537ea3f48b577 (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="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="/common/dispatcher/dispatcher.js"></script>
<script src="../resources/helper.sub.js"></script>
<script>
// Check whether the page is BFCached when there are open BroadcastChannels.
// See https://github.com/whatwg/html/issues/7219 for other related scenarios.
runEventTest(
  {funcBeforeNavigation: () => {
      window.bc = new BroadcastChannel('foo');
  }},
  'Eligibility (BroadcastChannel)');

// Same as above, but the BroadcastChannels are closed in the pagehide event.
runEventTest(
  {funcBeforeNavigation: () => {
      window.bc = new BroadcastChannel('foo');
      window.addEventListener('pagehide', () => window.bc.close());
  }},
  'Eligibility (BroadcastChannel closed in the pagehide event)');
</script>