Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /navigation-api/navigation-activation/activation-after-bfcache-cross-origin-clears-from.html - WPT Dashboard Interop Dashboard
<!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="/html/browsers/browsing-the-web/back-forward-cache/resources/helper.sub.js"></script>
<script>
runBfcacheTest({
targetOrigin: originSameSite,
openFunc(url) {
window.open(
`resources/bfcache-seed.html?next=${encodeURIComponent(url)}`,
"_blank", "noopener");
},
funcBeforeNavigation: () => {
window.activationFromBeforeBFCache =
navigation.activation.from?.url ?? null;
},
async funcAfterAssertion(pageA, pageB) {
const activationData = await pageA.execute_script(() => {
return { entryURL : navigation.activation.entry.url,
fromIsNull : navigation.activation.from === null,
navigationType : navigation.activation.navigationType,
fromBeforeBFCache : window.activationFromBeforeBFCache }
});
assert_not_equals(activationData.fromBeforeBFCache, null);
assert_equals(activationData.entryURL, pageA.url);
assert_true(activationData.fromIsNull);
assert_equals(activationData.navigationType, "traverse");
}
}, "navigation.activation.from must be cleared on cross-origin bfcache restoration when it was previously non-null");
</script>