Automatic update from web-platform-tests Protect CommitSameDocumentNavigation from re-entrancy This re-entrancy can be reproduced with multiple sync navigations during a precommitHandler execution. Bug: 511525672 Change-Id: If8f52230dc09efcdc40ef60acf63e6af921a2160 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7844695 Reviewed-by: Rakina Zata Amni <rakina@chromium.org> Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Noam Rosenthal <nrosenthal@google.com> Cr-Commit-Position: refs/heads/main@{#1636784} -- wpt-commits: 10b3e0b0b6fdf228b8456df3fe0d3644b17cb666 wpt-pr: 60202
36 lines
1.0 KiB
HTML
36 lines
1.0 KiB
HTML
<!doctype html>
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<title>
|
|
Test that going back and forward during a precommitHandler ends up in the
|
|
correct entry
|
|
</title>
|
|
<body>
|
|
<script>
|
|
promise_test(async (t) => {
|
|
await new Promise((resolve) => window.addEventListener("load", resolve));
|
|
const initial_entry = navigation.currentEntry;
|
|
await navigation.navigate("#a", { history: "push" }).finished;
|
|
|
|
navigation.addEventListener(
|
|
"navigate",
|
|
(event) => {
|
|
event.intercept({
|
|
precommitHandler: () =>
|
|
new Promise((resolve, reject) => {
|
|
event.signal.addEventListener("abort", () =>
|
|
reject(event.signal.reason),
|
|
);
|
|
}),
|
|
});
|
|
},
|
|
{ once: true },
|
|
);
|
|
|
|
history.pushState(null, null, "#b");
|
|
await navigation.back().finished;
|
|
assert_equals(navigation.currentEntry, initial_entry);
|
|
});
|
|
</script>
|
|
</body>
|