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
Родитель ecda88f40f
Коммит 1c9029e5ec
2 изменённых файлов: 24 добавлений и 19 удалений

Просмотреть файл

@ -7459,18 +7459,34 @@ nsDocShell::CreateContentViewer(const char *aContentType,
mLoadType = mFailedLoadType;
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;
mFailedURI = nsnull;
// Create an shistory entry for the old load, if we have a channel
if (failedChannel) {
mURIResultedInDocument = true;
OnLoadingSite(failedChannel, true, false);
} else if (failedURI) {
mURIResultedInDocument = true;
OnNewURI(failedURI, nsnull, nsnull, mLoadType, true, false,
// Create an shistory entry for the old load.
if (failedURI) {
#ifdef DEBUG
bool errorOnLocationChangeNeeded =
#endif
OnNewURI(failedURI, failedChannel, nsnull, mLoadType, true, false,
false);
MOZ_ASSERT(!errorOnLocationChangeNeeded,
"We have to fire onLocationChange again.");
}
// Be sure to have a correct mLSHE, it may have been cleared by
@ -7487,9 +7503,6 @@ nsDocShell::CreateContentViewer(const char *aContentType,
mLSHE = do_QueryInterface(entry);
}
// Set our current URI
SetCurrentURI(failedURI);
mLoadType = LOAD_ERROR_PAGE;
}

Просмотреть файл

@ -79,11 +79,6 @@ function step1A() {
}
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)");
ok(!(aFlags & Components.interfaces.nsIWebProgressListener
@ -161,9 +156,6 @@ function step4A() {
}
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)");
ok(!(aFlags & Components.interfaces.nsIWebProgressListener