Bug 1144988 - Don't let other pages to load while doing scroll-to-anchor. r=bz, a=lmandel

This commit is contained in:
Olli Pettay
2015-03-19 17:58:00 -07:00
parent c4257ced59
commit f0fca6ce8b
2 changed files with 15 additions and 8 deletions

View File

@@ -4639,7 +4639,8 @@ nsDocShell::IsNavigationAllowed(bool aDisplayPrintErrorDialog,
bool aCheckIfUnloadFired) bool aCheckIfUnloadFired)
{ {
bool isAllowed = !IsPrintingOrPP(aDisplayPrintErrorDialog) && bool isAllowed = !IsPrintingOrPP(aDisplayPrintErrorDialog) &&
(!aCheckIfUnloadFired || !mFiredUnloadEvent); (!aCheckIfUnloadFired || !mFiredUnloadEvent) &&
!mBlockNavigation;
if (!isAllowed) { if (!isAllowed) {
return false; return false;
} }
@@ -10000,13 +10001,18 @@ nsDocShell::InternalLoad(nsIURI* aURI,
GetCurScrollPos(ScrollOrientation_X, &cx); GetCurScrollPos(ScrollOrientation_X, &cx);
GetCurScrollPos(ScrollOrientation_Y, &cy); 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 AutoRestore<bool> scrollingToAnchor(mBlockNavigation);
// arguments it receives. But even if we don't end up scrolling, mBlockNavigation = true;
// ScrollToAnchor performs other important tasks, such as informing
// the presShell that we have a new hash. See bug 680257. // ScrollToAnchor doesn't necessarily cause us to scroll the window;
rv = ScrollToAnchor(curHash, newHash, aLoadType); // the function decides whether a scroll is appropriate based on the
NS_ENSURE_SUCCESS(rv, rv); // 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, // Reset mLoadType to its original value once we exit this block,
// because this short-circuited load might have started after a // because this short-circuited load might have started after a

View File

@@ -897,6 +897,7 @@ protected:
bool mUseRemoteTabs; bool mUseRemoteTabs;
bool mDeviceSizeIsPageSize; bool mDeviceSizeIsPageSize;
bool mWindowDraggingAllowed; bool mWindowDraggingAllowed;
bool mBlockNavigation;
// Because scriptability depends on the mAllowJavascript values of our // Because scriptability depends on the mAllowJavascript values of our
// ancestors, we cache the effective scriptability and recompute it when // ancestors, we cache the effective scriptability and recompute it when