From 4cb0f37704537344dfa2e61c4a2be762917b2eee Mon Sep 17 00:00:00 2001 From: "honzab.moz%firemni.cz" Date: Wed, 18 Nov 2009 17:08:37 +0000 Subject: [PATCH] Backing out bugs 514232+529119 git-svn-id: svn://10.0.0.236/trunk@259023 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 85 ++++++------------ mozilla/docshell/base/nsDocShell.h | 7 -- mozilla/docshell/test/Makefile.in | 3 - mozilla/docshell/test/bug529119-window.html | 7 -- mozilla/docshell/test/test_bug529119-1.html | 99 --------------------- mozilla/docshell/test/test_bug529119-2.html | 90 ------------------- 6 files changed, 29 insertions(+), 262 deletions(-) delete mode 100644 mozilla/docshell/test/bug529119-window.html delete mode 100644 mozilla/docshell/test/test_bug529119-1.html delete mode 100644 mozilla/docshell/test/test_bug529119-2.html diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 1392abb68cb..f4981bba77b 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -3251,14 +3251,35 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, spec.get(), NS_ConvertUTF16toUTF8(aURL).get(), chanName.get())); } #endif - mFailedChannel = aFailedChannel; - mFailedURI = aURI; - mFailedLoadType = mLoadType; - + // Create an shistory entry for the old load, if we have a channel + if (aFailedChannel) { + mURIResultedInDocument = PR_TRUE; + OnLoadingSite(aFailedChannel, PR_TRUE, PR_FALSE); + } else if (aURI) { + mURIResultedInDocument = PR_TRUE; + OnNewURI(aURI, nsnull, mLoadType, PR_TRUE, PR_FALSE); + } + // Be sure to have a correct mLSHE, it may have been cleared by + // EndPageLoad. See bug 302115. + if (mSessionHistory && !mLSHE) { + PRInt32 idx; + mSessionHistory->GetRequestedIndex(&idx); + if (idx == -1) + mSessionHistory->GetIndex(&idx); + + nsCOMPtr entry; + mSessionHistory->GetEntryAtIndex(idx, PR_FALSE, + getter_AddRefs(entry)); + mLSHE = do_QueryInterface(entry); + } + nsCAutoString url; nsCAutoString charset; if (aURI) { + // Set our current URI + SetCurrentURI(aURI); + nsresult rv = aURI->GetSpec(url); rv |= aURI->GetOriginCharset(charset); NS_ENSURE_SUCCESS(rv, rv); @@ -3384,15 +3405,10 @@ nsDocShell::Stop(PRUint32 aStopFlags) // Revoke any pending event related to content viewer restoration mRestorePresentationEvent.Revoke(); - if (mLoadType == LOAD_ERROR_PAGE) { - if (mLSHE) { - // Since error page loads never unset mLSHE, do so now - SetHistoryEntry(&mOSHE, mLSHE); - SetHistoryEntry(&mLSHE, nsnull); - } - - mFailedChannel = nsnull; - mFailedURI = nsnull; + if (mLoadType == LOAD_ERROR_PAGE && mLSHE) { + // Since error page loads never unset mLSHE, do so now + SetHistoryEntry(&mOSHE, mLSHE); + SetHistoryEntry(&mLSHE, nsnull); } if (nsIWebNavigation::STOP_CONTENT & aStopFlags) { @@ -6122,49 +6138,6 @@ nsDocShell::CreateContentViewer(const char *aContentType, // notifications before we've called Embed(). See bug 284993. mURIResultedInDocument = PR_TRUE; - if (mLoadType == LOAD_ERROR_PAGE) { - // We need to set the SH entry and our current URI here and not - // at the moment we load the page. We want the same behavior - // of Stop() as for a normal page load. See bug 514232 for details. - - // Revert mLoadType to load type to state the page load failed, - // following function calls need it. - mLoadType = mFailedLoadType; - - nsCOMPtr failedChannel = mFailedChannel; - nsCOMPtr failedURI = mFailedURI; - mFailedChannel = nsnull; - mFailedURI = nsnull; - - // Create an shistory entry for the old load, if we have a channel - if (failedChannel) { - mURIResultedInDocument = PR_TRUE; - OnLoadingSite(failedChannel, PR_TRUE, PR_FALSE); - } else if (failedURI) { - mURIResultedInDocument = PR_TRUE; - OnNewURI(failedURI, nsnull, nsnull, mLoadType, PR_TRUE, PR_FALSE); - } - - // Be sure to have a correct mLSHE, it may have been cleared by - // EndPageLoad. See bug 302115. - if (mSessionHistory && !mLSHE) { - PRInt32 idx; - mSessionHistory->GetRequestedIndex(&idx); - if (idx == -1) - mSessionHistory->GetIndex(&idx); - - nsCOMPtr entry; - mSessionHistory->GetEntryAtIndex(idx, PR_FALSE, - getter_AddRefs(entry)); - mLSHE = do_QueryInterface(entry); - } - - // Set our current URI - SetCurrentURI(failedURI); - - mLoadType = LOAD_ERROR_PAGE; - } - PRBool onLocationChangeNeeded = OnLoadingSite(aOpenedChannel, PR_FALSE); // let's try resetting the load group if we need to... diff --git a/mozilla/docshell/base/nsDocShell.h b/mozilla/docshell/base/nsDocShell.h index 06222f64a94..3194e26cb4a 100644 --- a/mozilla/docshell/base/nsDocShell.h +++ b/mozilla/docshell/base/nsDocShell.h @@ -664,13 +664,6 @@ protected: // new URI. nsCOMPtr mLoadingURI; - // Set in LoadErrorPage from the method argument and used later - // in CreateContentViewer. We have to delay an shistory entry creation - // for which these objects are needed. - nsCOMPtr mFailedURI; - nsCOMPtr mFailedChannel; - PRUint32 mFailedLoadType; - // WEAK REFERENCES BELOW HERE. // Note these are intentionally not addrefd. Doing so will create a cycle. // For that reasons don't use nsCOMPtr. diff --git a/mozilla/docshell/test/Makefile.in b/mozilla/docshell/test/Makefile.in index 101fafb1119..5566f3f69cc 100644 --- a/mozilla/docshell/test/Makefile.in +++ b/mozilla/docshell/test/Makefile.in @@ -70,9 +70,6 @@ _TEST_FILES = \ test_bug402210.html \ test_bug475636.html \ file_bug475636.sjs \ - test_bug529119-1.html \ - test_bug529119-2.html \ - bug529119-window.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/mozilla/docshell/test/bug529119-window.html b/mozilla/docshell/test/bug529119-window.html deleted file mode 100644 index f1908835a73..00000000000 --- a/mozilla/docshell/test/bug529119-window.html +++ /dev/null @@ -1,7 +0,0 @@ - - - -Test bug 529119, sub-window - - - diff --git a/mozilla/docshell/test/test_bug529119-1.html b/mozilla/docshell/test/test_bug529119-1.html deleted file mode 100644 index 7a864ac9cac..00000000000 --- a/mozilla/docshell/test/test_bug529119-1.html +++ /dev/null @@ -1,99 +0,0 @@ - - - -Test bug 529119 - - - - - - - - - diff --git a/mozilla/docshell/test/test_bug529119-2.html b/mozilla/docshell/test/test_bug529119-2.html deleted file mode 100644 index db33c06598d..00000000000 --- a/mozilla/docshell/test/test_bug529119-2.html +++ /dev/null @@ -1,90 +0,0 @@ - - - -Test bug 529119 - - - - - - - - -