mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1818239, latter reload should win, r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D173169
This commit is contained in:
parent
d3637730d2
commit
415571974a
@ -4061,6 +4061,7 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
|
||||
MOZ_LOG(gSHLog, LogLevel::Debug, ("nsDocShell %p Reload", this));
|
||||
bool forceReload = IsForceReloadType(loadType);
|
||||
if (!XRE_IsParentProcess()) {
|
||||
++mPendingReloadCount;
|
||||
RefPtr<nsDocShell> docShell(this);
|
||||
nsCOMPtr<nsIContentViewer> cv(mContentViewer);
|
||||
NS_ENSURE_STATE(cv);
|
||||
@ -4095,6 +4096,12 @@ nsDocShell::Reload(uint32_t aReloadFlags) {
|
||||
loadGroup->RemoveRequest(stopDetector, nullptr, NS_OK);
|
||||
}
|
||||
});
|
||||
|
||||
// Decrease mPendingReloadCount before any other early returns!
|
||||
if (--(docShell->mPendingReloadCount) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stopDetector->Canceled()) {
|
||||
return;
|
||||
}
|
||||
|
@ -1297,6 +1297,8 @@ class nsDocShell final : public nsDocLoader,
|
||||
|
||||
uint64_t mChannelToDisconnectOnPageHide;
|
||||
|
||||
uint32_t mPendingReloadCount = 0;
|
||||
|
||||
// The following two fields cannot be declared as bit fields
|
||||
// because of uses with AutoRestore.
|
||||
bool mCreatingDocument; // (should be) debugging only
|
||||
|
@ -25,6 +25,20 @@
|
||||
win.close();
|
||||
});
|
||||
|
||||
add_task(async function runTest2() {
|
||||
let win = window.open("file_load_during_reload.html");
|
||||
await promiseForLoad();
|
||||
|
||||
win.history.replaceState("", "", "?1");
|
||||
win.location.reload();
|
||||
win.history.pushState("", "", "?2");
|
||||
win.location.reload();
|
||||
await promiseForLoad();
|
||||
|
||||
ok(win.location.href.includes("2"), "Should have loaded the second page.");
|
||||
win.close();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user