diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 8826d28463d..82a0e4d4f9c 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -928,17 +928,14 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) { nsCOMPtr uri; if (aChannel) { - aChannel->GetOriginalURI(getter_AddRefs(uri)); - nsresult rv; - PRBool isAbout = PR_FALSE; - PRBool isChrome = PR_FALSE; - PRBool isRes = PR_FALSE; - rv = uri->SchemeIs("chrome", &isChrome); - rv |= uri->SchemeIs("resource", &isRes); - rv |= uri->SchemeIs("about", &isAbout); - - if (NS_SUCCEEDED(rv) && !isChrome && !isRes && !isAbout) { + // Note: this code is duplicated in nsXULDocument::StartDocumentLoad. + // Note: this should match nsDocShell::OnLoadingSite + nsLoadFlags loadFlags = 0; + nsresult rv = aChannel->GetLoadFlags(&loadFlags); + if (NS_SUCCEEDED(rv) && (loadFlags & nsIChannel::LOAD_REPLACE)) { aChannel->GetURI(getter_AddRefs(uri)); + } else { + aChannel->GetOriginalURI(getter_AddRefs(uri)); } } diff --git a/mozilla/content/xul/document/src/nsXULDocument.cpp b/mozilla/content/xul/document/src/nsXULDocument.cpp index 3b332c63228..1cdd7b5f2b2 100644 --- a/mozilla/content/xul/document/src/nsXULDocument.cpp +++ b/mozilla/content/xul/document/src/nsXULDocument.cpp @@ -456,23 +456,20 @@ nsXULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, mChannel = aChannel; - nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(mDocumentURI)); - NS_ENSURE_SUCCESS(rv, rv); - + // Get the URI. Note that this should match nsDocShell::OnLoadingSite // XXXbz this code is repeated from nsDocument::Reset; we // really need to refactor this part better. - PRBool isAbout = PR_FALSE; - PRBool isChrome = PR_FALSE; - PRBool isRes = PR_FALSE; - rv = mDocumentURI->SchemeIs("chrome", &isChrome); - rv |= mDocumentURI->SchemeIs("resource", &isRes); - rv |= mDocumentURI->SchemeIs("about", &isAbout); - - if (NS_SUCCEEDED(rv) && !isChrome && !isRes && !isAbout) { - rv = aChannel->GetURI(getter_AddRefs(mDocumentURI)); - NS_ENSURE_SUCCESS(rv, rv); + nsLoadFlags loadFlags = 0; + nsresult rv = aChannel->GetLoadFlags(&loadFlags); + if (NS_SUCCEEDED(rv)) { + if (loadFlags & nsIChannel::LOAD_REPLACE) { + rv = aChannel->GetURI(getter_AddRefs(mDocumentURI)); + } else { + rv = aChannel->GetOriginalURI(getter_AddRefs(mDocumentURI)); + } } - + NS_ENSURE_SUCCESS(rv, rv); + rv = ResetStylesheetsToURI(mDocumentURI); if (NS_FAILED(rv)) return rv; diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index 55c4f52e197..40989aa25bf 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -7373,9 +7373,7 @@ nsDocShell::OnLoadingSite(nsIChannel * aChannel, PRBool aFireOnLocationChange, // If this a redirect, use the final url (uri) // else use the original url // - // The better way would be to trust the OnRedirect() that necko gives us. - // But this notification happen after the necko notification and hence - // overrides it. Until OnRedirect() gets settles out, let us do this. + // Note that this should match what documents do (see nsDocument::Reset). nsLoadFlags loadFlags = 0; aChannel->GetLoadFlags(&loadFlags); if (loadFlags & nsIChannel::LOAD_REPLACE)