Source code
Revision control
Copy as Markdown
Other Tools
<!DOCTYPE html>
<meta name="timeout" content="long">
<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/remote-context-helper/resources/remote-context-helper.js"></script>
<script src="../resources/utils.js"></script>
<script src="resources/utils.js"></script>
<body>
<script>
setup(() => assertSpeculationRulesIsSupported());
promise_test(async t => {
const rcHelper = new PrerenderingRemoteContextHelper();
const referrerRC = await rcHelper.addWindow(undefined, { features: 'noopener' });
assert_equals(await referrerRC.executeScript(() => navigation.entries().length), 1);
let referrerRCCurrentId = await referrerRC.executeScript(() => navigation.currentEntry.id);
const prerenderedRC = await referrerRC.addPrerender();
let redirectResult = prerenderedRC.executeScript(async () => {
navigation.onnavigate = e => {
e.intercept({
precommitHandler(controller) {
controller.redirect("", { history: "push" });
}
});
}
return navigation.navigate("#").committed;
});
return promise_rejects_js(t, Error, redirectResult);
},`NavigationPrecommitHandler.redirect() converting a navigation to push during prerender`);
</script>