Bug 302115 "Try again" on XUL error page loads wrong thing after going back

r=bryner sr=bz
This commit is contained in:
cbiesinger%web.de 2006-02-19 17:33:31 +00:00
parent 375f40dfa8
commit 74892f0996
3 changed files with 28 additions and 2 deletions

View File

@ -3002,6 +3002,17 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
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);
nsCOMPtr<nsIHistoryEntry> entry;
mSessionHistory->GetEntryAtIndex(idx, PR_FALSE,
getter_AddRefs(entry));
mLSHE = do_QueryInterface(entry);
}
nsCAutoString url;
nsCAutoString charset;

View File

@ -62,7 +62,7 @@ interface nsISimpleEnumerator;
#define NS_SHISTORY_CONTRACTID "@mozilla.org/browser/shistory;1"
%}
[scriptable, uuid(7294FE9B-14D8-11D5-9882-00C04FA02F40)]
[scriptable, uuid(9883609F-CDD8-4d83-9B55-868FF08AD433)]
interface nsISHistory: nsISupports
{
/**
@ -78,6 +78,12 @@ interface nsISHistory: nsISupports
*/
readonly attribute long index;
/**
* A readonly property of the interface that returns
* the index of the last document that started to load.
*/
readonly attribute long requestedIndex;
/**
* A read/write property of the interface, used to Get/Set
* the maximum number of toplevel documents, session history

View File

@ -343,11 +343,20 @@ nsSHistory::GetCount(PRInt32 * aResult)
NS_IMETHODIMP
nsSHistory::GetIndex(PRInt32 * aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
NS_PRECONDITION(aResult, "null out param?");
*aResult = mIndex;
return NS_OK;
}
/* Get the requestedIndex */
NS_IMETHODIMP
nsSHistory::GetRequestedIndex(PRInt32 * aResult)
{
NS_PRECONDITION(aResult, "null out param?");
*aResult = mRequestedIndex;
return NS_OK;
}
NS_IMETHODIMP
nsSHistory::GetEntryAtIndex(PRInt32 aIndex, PRBool aModifyIndex, nsISHEntry** aResult)
{