Skip to content

Commit

Permalink
[WPT] BFCache eligibility: BroadcastChannel
Browse files Browse the repository at this point in the history
When there are open BroadcastChannels at the time of navigation,

Chrome: The page is not BFCached.
        The page is BFCached if BroadcastChannels are closed
        in the pagehide event.
Firefox: The page is BFCached.
Safari: BroadcastChannel is not supported.

Bug: 1107415
Change-Id: I25afa41274278b0976ad1fa0fdd50015a3f6ce77
  • Loading branch information
hiroshige-g authored and chromium-wpt-export-bot committed Oct 19, 2021
1 parent 679cfd4 commit d6af167
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!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.
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>

0 comments on commit d6af167

Please sign in to comment.