Bug 673752 - Every error page fires onLocationChange twice. r=smaug

This commit is contained in:
Oonishi Atsushi 2012-04-24 19:49:58 -04:00
parent 0452126e19
commit 2db63a757f
2 changed files with 24 additions and 19 deletions

View File

@ -7505,18 +7505,34 @@ nsDocShell::CreateContentViewer(const char *aContentType,
mLoadType = mFailedLoadType; mLoadType = mFailedLoadType;
nsCOMPtr<nsIChannel> failedChannel = mFailedChannel; nsCOMPtr<nsIChannel> failedChannel = mFailedChannel;
nsCOMPtr<nsIURI> failedURI = mFailedURI;
// Make sure we have a URI to set currentURI.
nsCOMPtr<nsIURI> failedURI;
if (failedChannel) {
NS_GetFinalChannelURI(failedChannel, getter_AddRefs(failedURI));
}
if (!failedURI) {
failedURI = mFailedURI;
}
// When we don't have failedURI, something wrong will happen. See
// bug 291876.
MOZ_ASSERT(failedURI, "We don't have a URI for history APIs.");
mFailedChannel = nsnull; mFailedChannel = nsnull;
mFailedURI = nsnull; mFailedURI = nsnull;
// Create an shistory entry for the old load, if we have a channel // Create an shistory entry for the old load.
if (failedChannel) { if (failedURI) {
mURIResultedInDocument = true; #ifdef DEBUG
OnLoadingSite(failedChannel, true, false); bool errorOnLocationChangeNeeded =
} else if (failedURI) { #endif
mURIResultedInDocument = true; OnNewURI(failedURI, failedChannel, nsnull, mLoadType, true, false,
OnNewURI(failedURI, nsnull, nsnull, mLoadType, true, false,
false); false);
MOZ_ASSERT(!errorOnLocationChangeNeeded,
"We have to fire onLocationChange again.");
} }
// Be sure to have a correct mLSHE, it may have been cleared by // Be sure to have a correct mLSHE, it may have been cleared by
@ -7533,9 +7549,6 @@ nsDocShell::CreateContentViewer(const char *aContentType,
mLSHE = do_QueryInterface(entry); mLSHE = do_QueryInterface(entry);
} }
// Set our current URI
SetCurrentURI(failedURI);
mLoadType = LOAD_ERROR_PAGE; mLoadType = LOAD_ERROR_PAGE;
} }

View File

@ -79,11 +79,6 @@ function step1A() {
} }
function step1B(aWebProgress, aRequest, aLocation, aFlags) { function step1B(aWebProgress, aRequest, aLocation, aFlags) {
/* XXX Here we receive 2 notifications, due to bug 673752. */
if (!aRequest) {
return;
}
is(aLocation.spec, kDNSErrorURI, "Error page's URI (1)"); is(aLocation.spec, kDNSErrorURI, "Error page's URI (1)");
ok(!(aFlags & Components.interfaces.nsIWebProgressListener ok(!(aFlags & Components.interfaces.nsIWebProgressListener
@ -161,9 +156,6 @@ function step4A() {
} }
function step4B(aWebProgress, aRequest, aLocation, aFlags) { function step4B(aWebProgress, aRequest, aLocation, aFlags) {
if (!aRequest) // See step1B(...) and bug 673752.
return;
is(aLocation.spec, kDNSErrorURI, "Go back to the error URI (4)"); is(aLocation.spec, kDNSErrorURI, "Go back to the error URI (4)");
ok(!(aFlags & Components.interfaces.nsIWebProgressListener ok(!(aFlags & Components.interfaces.nsIWebProgressListener