From a32c6fcf4a33f22dfbc125014b7eaa67263d6a01 Mon Sep 17 00:00:00 2001 From: "gavin%gavinsharp.com" Date: Mon, 14 Apr 2008 01:36:04 +0000 Subject: [PATCH] Bug 421067: 'Try Again' after a DNS error sometimes loads previous page, not the one that failed to load, patch by Michal Novotny , r+sr=bzbarsky, a=schrep git-svn-id: svn://10.0.0.236/trunk@250183 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 4 +++- mozilla/docshell/shistory/public/nsISHistory.idl | 4 +++- mozilla/docshell/shistory/src/nsSHistory.cpp | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 1dfc3130b07..b1b81d35003 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -3221,11 +3221,13 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL, 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; diff --git a/mozilla/docshell/shistory/public/nsISHistory.idl b/mozilla/docshell/shistory/public/nsISHistory.idl index 7ce3dd5704f..3f47c972685 100644 --- a/mozilla/docshell/shistory/public/nsISHistory.idl +++ b/mozilla/docshell/shistory/public/nsISHistory.idl @@ -80,7 +80,9 @@ interface nsISHistory: nsISupports /** * A readonly property of the interface that returns - * the index of the last document that started to load. + * the index of the last document that started to load and + * didn't finished yet. When document finishes the loading + * value -1 is returned. */ readonly attribute long requestedIndex; diff --git a/mozilla/docshell/shistory/src/nsSHistory.cpp b/mozilla/docshell/shistory/src/nsSHistory.cpp index bd81790b6d8..0d642ea928f 100644 --- a/mozilla/docshell/shistory/src/nsSHistory.cpp +++ b/mozilla/docshell/shistory/src/nsSHistory.cpp @@ -1054,6 +1054,7 @@ nsSHistory::UpdateIndex() mIndex = mRequestedIndex; } + mRequestedIndex = -1; return NS_OK; }