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