Run a pushState during an intercepted navigation and browser
progress button stays on 'X' forever
Press Play below to execute the script shown and recreate the bug
// 1. Intercept the 1st navigation for 1 second
navigation.addEventListener("navigate", (event) => {
event.intercept({
precommitHandler() {
return new Promise((resolve, reject) => {
const timer = setTimeout(resolve, 1000);
event.signal.addEventListener("abort", () => {
// 4. Reject the aborted 1st navigation
clearTimeout(timer);
reject(event.signal.reason);
});
});
},
});
}, { once: true });
// 2. Run the 1st navigation
history.pushState(null, null, "?p=1");
// 3. Run the 2nd navigation causing the 1st to abort
setTimeout(() => {
history.pushState(null, null, "?p=2");
}, 500);
// 5. The browser progress button shows 'X' forever