From ea3bedd716a1344be7b99e7ed60bf15b71acb4b3 Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Wed, 24 Aug 2005 18:59:52 +0000 Subject: [PATCH] If we created a transient about:blank content viewer, make sure we're locating the root view sibling for that viewer and not the viewer it's replacing. Bug 300533, r=cbiesinger, a=brendan. git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@178811 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 21 ++++++++++++++++++++- mozilla/docshell/base/nsDocShell.h | 2 +- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index a5e944c1bf6..9f951240d9c 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4734,7 +4734,7 @@ nsDocShell::EnsureDeviceContext() return NS_OK; } -NS_IMETHODIMP +nsresult nsDocShell::CreateAboutBlankContentViewer() { nsCOMPtr blankDoc; @@ -4807,6 +4807,10 @@ nsDocShell::CreateAboutBlankContentViewer() } } mCreatingDocument = PR_FALSE; + + // The transient about:blank viewer doesn't have a session history entry. + SetHistoryEntry(&mOSHE, nsnull); + return rv; } @@ -5206,6 +5210,21 @@ nsDocShell::RestoreFromHistory() mSavedRefreshURIList = nsnull; + // In cases where we use a transient about:blank viewer between loads, + // we never show the transient viewer, so _its_ previous viewer is never + // unhooked from the view hierarchy. Destroy any such previous viewer now, + // before we grab the root view sibling, so that we don't grab a view + // that's about to go away. + + if (mContentViewer) { + nsCOMPtr previousViewer; + mContentViewer->GetPreviousViewer(getter_AddRefs(previousViewer)); + if (previousViewer) { + mContentViewer->SetPreviousViewer(nsnull); + previousViewer->Destroy(); + } + } + // Save off the root view's parent and sibling so that we can insert the // new content viewer's root view at the same position. Also save the // bounds of the root view's widget. diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index 72cdf9be7db..37a08ae9388 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -275,7 +275,7 @@ protected: // Content Viewer Management NS_IMETHOD EnsureContentViewer(); NS_IMETHOD EnsureDeviceContext(); - NS_IMETHOD CreateAboutBlankContentViewer(); + nsresult CreateAboutBlankContentViewer(); NS_IMETHOD CreateContentViewer(const char * aContentType, nsIRequest * request, nsIStreamListener ** aContentHandler); NS_IMETHOD NewContentViewerObj(const char * aContentType,