Bug 1578624 - P4: Add an option to set mIsNavigating on the docshell when loading using BrowsingContext. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D44760
This commit is contained in:
Matt Woodrow
2019-10-09 06:37:50 +00:00
parent b1f978110c
commit de29a4b06c
12 changed files with 38 additions and 22 deletions

View File

@@ -689,7 +689,7 @@ nsDocShell::SetCancelContentJSEpoch(int32_t aEpoch) {
}
NS_IMETHODIMP
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
nsDocShell::LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating) {
MOZ_ASSERT(aLoadState, "Must have a valid load state!");
MOZ_ASSERT(
(aLoadState->LoadFlags() & INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS) == 0,
@@ -704,6 +704,13 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState) {
}
}
bool oldIsNavigating = mIsNavigating;
auto cleanupIsNavigating =
MakeScopeExit([&]() { mIsNavigating = oldIsNavigating; });
if (aSetNavigating) {
mIsNavigating = true;
}
PopupBlocker::PopupControlState popupState;
if (aLoadState->LoadFlags() & LOAD_FLAGS_ALLOW_POPUPS) {
popupState = PopupBlocker::openAllowed;
@@ -3848,8 +3855,7 @@ nsresult nsDocShell::LoadURI(const nsAString& aURI,
return NS_ERROR_FAILURE;
}
rv = LoadURI(loadState);
return rv;
return LoadURI(loadState, true);
}
NS_IMETHODIMP
@@ -5740,7 +5746,7 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
* LoadURI(...) will cancel all refresh timers... This causes the
* Timer and its refreshData instance to be released...
*/
LoadURI(loadState);
LoadURI(loadState, false);
return NS_OK;
}