Bug 1206958 - Use channel->asyncOpen2() in dom/xul/XULDocument.cpp (r=sicking)

This commit is contained in:
Christoph Kerschbaumer 2015-09-28 20:15:51 -07:00
parent 430d12a198
commit b946316b70

View File

@ -2555,25 +2555,12 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic,
if (aIsDynamic)
mResolutionPhase = nsForwardReference::eStart;
// Chrome documents are allowed to load overlays from anywhere.
// In all other cases, the overlay is only allowed to load if
// the master document and prototype document have the same origin.
bool documentIsChrome = IsChromeURI(mDocumentURI);
if (!documentIsChrome) {
// Make sure we're allowed to load this overlay.
rv = NodePrincipal()->CheckMayLoad(aURI, true, false);
if (NS_FAILED(rv)) {
*aFailureFromContent = true;
return rv;
}
}
// Look in the prototype cache for the prototype document with
// the specified overlay URI. Only use the cache if the containing
// document is chrome otherwise it may not have a system principal and
// the cached document will, see bug 565610.
bool overlayIsChrome = IsChromeURI(aURI);
bool documentIsChrome = IsChromeURI(mDocumentURI);
mCurrentPrototype = overlayIsChrome && documentIsChrome ?
nsXULPrototypeCache::GetInstance()->GetPrototype(aURI) : nullptr;
@ -2657,12 +2644,13 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic,
rv = NS_NewChannel(getter_AddRefs(channel),
aURI,
NodePrincipal(),
nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_INHERITS |
nsILoadInfo::SEC_FORCE_INHERIT_PRINCIPAL,
nsIContentPolicy::TYPE_OTHER,
group);
if (NS_SUCCEEDED(rv)) {
rv = channel->AsyncOpen(listener, nullptr);
rv = channel->AsyncOpen2(listener);
}
if (NS_FAILED(rv)) {