Bug 1225882 - Force XSLT to load async if CORS is required. r=sicking
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Mon, 30 Nov 2015 20:13:20 -0800
changeset 274941 f1c08ce11d245c054bd265b2faca3e83e6587772
parent 274940 ca8916bb80cfab16fae905b624632d849ca4f094
child 274942 1dccec2869705188acec5f999d08018be462ed7b
push id29742
push userkwierso@gmail.com
push dateTue, 01 Dec 2015 23:43:40 +0000
treeherdermozilla-central@e7b2e8a061f9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1225882
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1225882 - Force XSLT to load async if CORS is required. r=sicking
dom/base/nsSyncLoadService.cpp
--- a/dom/base/nsSyncLoadService.cpp
+++ b/dom/base/nsSyncLoadService.cpp
@@ -318,19 +318,21 @@ nsSyncLoadService::LoadDocument(nsIURI *
                                 aLoadGroup);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!aForceToXML) {
         channel->SetContentType(NS_LITERAL_CSTRING("text/xml"));
     }
 
     bool isChrome = false, isResource = false;
+    // if the load needs to enforce CORS, then force the load to be async
     bool isSync =
-      (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome) ||
-      (NS_SUCCEEDED(aURI->SchemeIs("resource", &isResource)) && isResource);
+      !(aSecurityFlags & nsILoadInfo::SEC_REQUIRE_CORS_DATA_INHERITS) &&
+      ((NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome) ||
+       (NS_SUCCEEDED(aURI->SchemeIs("resource", &isResource)) && isResource));
     RefPtr<nsSyncLoader> loader = new nsSyncLoader();
     return loader->LoadDocument(channel, isSync, aForceToXML,
                                 aReferrerPolicy, aResult);
 }
 
 /* static */
 nsresult
 nsSyncLoadService::PushSyncStreamToListener(nsIInputStream* aIn,