Backing out bugs 514232+529119

git-svn-id: svn://10.0.0.236/trunk@259023 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
honzab.moz%firemni.cz
2009-11-18 17:08:37 +00:00
parent 443a8362bf
commit 4cb0f37704
6 changed files with 29 additions and 262 deletions

View File

@@ -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<nsIHistoryEntry> 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<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...

View File

@@ -664,13 +664,6 @@ protected:
// new URI.
nsCOMPtr<nsIURI> 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<nsIURI> mFailedURI;
nsCOMPtr<nsIChannel> 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.