Bug 1225882 - Force XSLT to load async if CORS is required. r=sicking, a=ritu
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Mon, 30 Nov 2015 20:13:20 -0800
changeset 305769 9942e657ff089a0bae8c94e0b23a2116ab8a67f3
parent 305768 3664dcef3c8b63fdd54c406500a90707ec30326f
child 305770 6f4e398c6303cd6e1526341c0c3b57db3951df01
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking, ritu
bugs1225882
milestone44.0a2
Bug 1225882 - Force XSLT to load async if CORS is required. r=sicking, a=ritu
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,