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, whatwg/html#7219
Change-Id: I25afa41274278b0976ad1fa0fdd50015a3f6ce77
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3201012
Reviewed-by: Fergal Daly <[email protected]>
Reviewed-by: Yuzu Saijo <[email protected]>
Commit-Queue: Hiroshige Hayashizaki <[email protected]>
Cr-Commit-Position: refs/heads/main@{#956437}
  • Loading branch information
hiroshige-g authored and chromium-wpt-export-bot committed Jan 7, 2022
1 parent 819f257 commit 585c7a7
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,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>

0 comments on commit 585c7a7

Please sign in to comment.