Don't let other pages to load while doing scroll-to-anchor.

This commit is contained in:
Pale Moon
2015-03-23 13:58:42 +01:00
parent 322e123b16
commit 5a369ef604
2 changed files with 17 additions and 9 deletions
+16 -9
View File
@@ -1250,7 +1250,7 @@ nsDocShell::LoadURI(nsIURI * aURI,
// Note: we allow loads to get through here even if mFiredUnloadEvent is
// true; that case will get handled in LoadInternal or LoadHistoryEntry.
if (IsPrintingOrPP()) {
if (IsPrintingOrPP() || mBlockNavigation) {
return NS_OK; // JS may not handle returning of an error code
}
nsresult rv;
@@ -3974,7 +3974,9 @@ nsDocShell::IsPrintingOrPP(bool aDisplayErrorDialog)
bool
nsDocShell::IsNavigationAllowed(bool aDisplayPrintErrorDialog)
{
return !IsPrintingOrPP(aDisplayPrintErrorDialog) && !mFiredUnloadEvent;
return !IsPrintingOrPP(aDisplayPrintErrorDialog) &&
!mFiredUnloadEvent &&
!mBlockNavigation;
}
//*****************************************************************************
@@ -9008,13 +9010,18 @@ nsDocShell::InternalLoad(nsIURI * aURI,
GetCurScrollPos(ScrollOrientation_X, &cx);
GetCurScrollPos(ScrollOrientation_Y, &cy);
// ScrollToAnchor doesn't necessarily cause us to scroll the window;
// the function decides whether a scroll is appropriate based on the
// arguments it receives. But even if we don't end up scrolling,
// ScrollToAnchor performs other important tasks, such as informing
// the presShell that we have a new hash. See bug 680257.
rv = ScrollToAnchor(curHash, newHash, aLoadType);
NS_ENSURE_SUCCESS(rv, rv);
{
AutoRestore<bool> scrollingToAnchor(mBlockNavigation);
mBlockNavigation = true;
// ScrollToAnchor doesn't necessarily cause us to scroll the window;
// the function decides whether a scroll is appropriate based on the
// arguments it receives. But even if we don't end up scrolling,
// ScrollToAnchor performs other important tasks, such as informing
// the presShell that we have a new hash. See bug 680257.
rv = ScrollToAnchor(curHash, newHash, aLoadType);
NS_ENSURE_SUCCESS(rv, rv);
}
// Reset mLoadType to its original value once we exit this block,
// because this short-circuited load might have started after a
+1
View File
@@ -823,6 +823,7 @@ protected:
bool mIsAppTab;
bool mUseGlobalHistory;
bool mInPrivateBrowsing;
bool mBlockNavigation;
// This boolean is set to true right before we fire pagehide and generally
// unset when we embed a new content viewer. While it's true no navigation