nsIXMLDocumetn::Load fails in Firefox 3 Beta 4
"Jens Sorensen" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.dom |
|---|---|
| Message-ID | <[email protected]> |
Hi All
I'm trying to load a XML document synchronously using a custom
protocol, this worked fine in beta 2 of Firefox 3.0 ( and Firefox
2.0.0.x) however it fails in Firefox 3 beta 4.
I have noticed that nsIXMLDocumetn::Load fails due to an additional
check introduced post Firefox 3.0 Beta 2. The load fails when
"SecurityCompareURIs" is being invoked
due to the fact that target and source Scheme is different.
I basically call nsIXMLDocumetn::Load with "myprotocol:somedoc.xml"
which now fails.
Question, is there an "easy" solution to this issue? I guess I could
use nsIDOMParser::parseFromBuffer instead in order to get a
nsIXXXXDocument but I would prefer nsIXMLDocumetn::Load
Thanks,
Jens
targetSpec = {mStorage=0x0012e600 "myprotocol:somedoc.xml" }
sourceSpec = {mStorage=0x0012e5a8
"moz-nullprincipal:{be732e2c-498b-4fd2-a46e-634d2591367f}" }
NS_IMETHODIMP nsXMLDocument::Load(const nsAString& aUrl, PRBool *aReturn)
{
:
// Enforce same-origin even for chrome loaders to avoid someone accidentally
// using a document that content has a reference to and turn that into a
// chrome document.
if (codebase) {
rv = secMan->CheckSameOriginURI(codebase, uri, PR_FALSE); //
returns rv = 0x805303f4, CheckSameOriginURI calls SecurityCompareURIs
if (NS_FAILED(rv)) {
return rv; /// Bails out here...
}
:
}
PRBool nsScriptSecurityManager::SecurityCompareURIs(nsIURI*
aSourceURI, nsIURI* aTargetURI)
{
:
if (NS_FAILED( targetBaseURI->GetScheme(targetScheme) ) ||
NS_FAILED( sourceBaseURI->SchemeIs(targetScheme.get(), &sameScheme) ) ||
!sameScheme)
{
// Not same-origin if schemes differ
return PR_FALSE; // bails out here
} :
}
targetSpec = {mStorage=0x0012e600 "myprotocol:somedoc.xml" }
sourceSpec = {mStorage=0x0012e5a8
"moz-nullprincipal:{be732e2c-498b-4fd2-a46e-634d2591367f}" }