From a475440a84bd4f0cf9a23b6129cb7415cbfd7d5a Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Wed, 31 Aug 2005 22:01:46 +0000 Subject: [PATCH] Abort restoring the presentation if firing pagehide/unload stopped the load. Bug 305995, r+sr=bzbarsky. --- docshell/base/nsDocShell.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 12e1ff8f17c0..2c15646626c1 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -5187,8 +5187,18 @@ nsDocShell::RestoreFromHistory() if (oldMUDV && newMUDV) oldMUDV->GetTextZoom(&zoom); + // Protect against mLSHE going away via a load triggered from + // pagehide or unload. + nsCOMPtr origLSHE = mLSHE; + // Notify the old content viewer that it's being hidden. FirePageHideNotification(!mSavingOldViewer); + + // If mLSHE was changed as a result of the pagehide event, then + // something else was loaded. Don't finish restoring. + if (mLSHE != origLSHE) + return NS_OK; + // Set mFiredUnloadEvent = PR_FALSE so that the unload handler for the // *new* document will fire. mFiredUnloadEvent = PR_FALSE;