diff --git a/content/xml/document/src/nsXMLDocument.cpp b/content/xml/document/src/nsXMLDocument.cpp index bb67975a04f3..41e3e174feaf 100644 --- a/content/xml/document/src/nsXMLDocument.cpp +++ b/content/xml/document/src/nsXMLDocument.cpp @@ -296,13 +296,6 @@ nsXMLDocument::OnChannelRedirect(nsIChannel *aOldChannel, return rv; } - // XXXbz Shouldn't we look at the owner on the new channel at some point? - // It's not gonna be right here, but eventually it will.... - nsCOMPtr principal; - rv = secMan->GetCodebasePrincipal(newLocation, getter_AddRefs(principal)); - NS_ENSURE_SUCCESS(rv, rv); - - SetPrincipal(principal); return NS_OK; } @@ -368,8 +361,9 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) return rv; } + nsCOMPtr principal = NodePrincipal(); nsCOMPtr codebase; - NodePrincipal()->GetURI(getter_AddRefs(codebase)); + principal->GetURI(getter_AddRefs(codebase)); // Get security manager, check to see whether the current document // is allowed to load this URI. It's important to use the current @@ -413,7 +407,6 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) // be loaded. Note that we need to hold a strong ref to |principal| // here, because ResetToURI will null out our node principal before // setting the new one. - nsCOMPtr principal = NodePrincipal(); nsCOMPtr elm(mListenerManager); mListenerManager = nsnull; @@ -441,23 +434,6 @@ nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn) return rv; } - // Set a principal for this document - // XXXbz StartDocumentLoad should handle that.... And we shouldn't be calling - // StartDocumentLoad until we get an OnStartRequest from this channel! - nsCOMPtr channelOwner; - rv = channel->GetOwner(getter_AddRefs(channelOwner)); - - // We don't care if GetOwner() succeeded here, if it failed, - // channelOwner will be null, which is what we want in that case. - principal = do_QueryInterface(channelOwner); - - if (NS_FAILED(rv) || !principal) { - rv = secMan->GetCodebasePrincipal(uri, getter_AddRefs(principal)); - NS_ENSURE_TRUE(principal, rv); - } - - SetPrincipal(principal); - // Prepare for loading the XML document "into oneself" nsCOMPtr listener; if (NS_FAILED(rv = StartDocumentLoad(kLoadAsData, channel,