From c76868cd0b883004b1428f5c94959ecfc8aabdd2 Mon Sep 17 00:00:00 2001 From: Christoph Kerschbaumer Date: Mon, 28 Sep 2015 20:15:51 -0700 Subject: [PATCH] Bug 1206958 - Use channel->asyncOpen2() in dom/xul/XULDocument.cpp (r=sicking) --- dom/xul/XULDocument.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index fb674a756cd4..f307d294fd2e 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -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)) {