Merge mozilla-central into electrolysis.

This commit is contained in:
Benjamin Smedberg
2009-11-19 12:41:46 -05:00
1070 changed files with 86503 additions and 6766 deletions

View File

@@ -3794,35 +3794,14 @@ nsDocShell::LoadErrorPage(nsIURI *aURI, const PRUnichar *aURL,
spec.get(), NS_ConvertUTF16toUTF8(aURL).get(), chanName.get()));
}
#endif
// 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, 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<nsIHistoryEntry> entry;
mSessionHistory->GetEntryAtIndex(idx, PR_FALSE,
getter_AddRefs(entry));
mLSHE = do_QueryInterface(entry);
}
mFailedChannel = aFailedChannel;
mFailedURI = aURI;
mFailedLoadType = mLoadType;
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);
@@ -3951,10 +3930,15 @@ nsDocShell::Stop(PRUint32 aStopFlags)
// Revoke any pending event related to content viewer restoration
mRestorePresentationEvent.Revoke();
if (mLoadType == LOAD_ERROR_PAGE && mLSHE) {
// Since error page loads never unset mLSHE, do so now
SetHistoryEntry(&mOSHE, mLSHE);
SetHistoryEntry(&mLSHE, nsnull);
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 (nsIWebNavigation::STOP_CONTENT & aStopFlags) {
@@ -7031,6 +7015,49 @@ 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<nsIChannel> failedChannel = mFailedChannel;
nsCOMPtr<nsIURI> 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<nsIHistoryEntry> 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...