mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-12 15:02:11 +00:00
Make documents be consistent with docshell wrt what the actual document URI
is. Bug 335457, r=dveditz, sr=jst
This commit is contained in:
parent
ab6ce33675
commit
3ae541c6c6
@ -928,17 +928,14 @@ nsDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
nsCOMPtr<nsIURI> 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user