diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index f074fc9e6745..a357433c784b 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -3798,20 +3798,6 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, mFailedURI = aURI; mFailedLoadType = mLoadType; - // 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) @@ -7052,6 +7038,20 @@ nsDocShell::CreateContentViewer(const char *aContentType, 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); diff --git a/docshell/test/Makefile.in b/docshell/test/Makefile.in index e85d3f89583b..efd7bb4ded0c 100644 --- a/docshell/test/Makefile.in +++ b/docshell/test/Makefile.in @@ -78,6 +78,9 @@ _TEST_FILES = \ file_bug385434_3.html \ test_bug509055.html \ file_bug509055.html \ + test_bug529119-1.html \ + test_bug529119-2.html \ + bug529119-window.html \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) diff --git a/docshell/test/bug529119-window.html b/docshell/test/bug529119-window.html new file mode 100644 index 000000000000..f1908835a732 --- /dev/null +++ b/docshell/test/bug529119-window.html @@ -0,0 +1,7 @@ + + + +Test bug 529119, sub-window + + + diff --git a/docshell/test/test_bug529119-1.html b/docshell/test/test_bug529119-1.html new file mode 100644 index 000000000000..7a864ac9cac4 --- /dev/null +++ b/docshell/test/test_bug529119-1.html @@ -0,0 +1,99 @@ + + + +Test bug 529119 + + + + + + + + + diff --git a/docshell/test/test_bug529119-2.html b/docshell/test/test_bug529119-2.html new file mode 100644 index 000000000000..db33c06598db --- /dev/null +++ b/docshell/test/test_bug529119-2.html @@ -0,0 +1,90 @@ + + + +Test bug 529119 + + + + + + + + +