Bug 1067517: Update triggeringPrincipal and loadingDoc for contentPolicy check and in the loadInfo (r=sicking)
authorChristoph Kerschbaumer <mozilla@christophkerschbaumer.com>
Sun, 16 Nov 2014 17:36:44 -0800
changeset 242376 495cec2bc029eac35665c4ca0811a52618b9b1c8
parent 242375 74628362296707a89dbcc7c02dd67022dd4609e9
child 242377 5492e9dc06f1f9d006a7ecdae12f6f9c28087b32
push id660
push userraliiev@mozilla.com
push dateWed, 18 Feb 2015 20:30:48 +0000
treeherdermozilla-release@49e493494178 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs1067517
milestone36.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 1067517: Update triggeringPrincipal and loadingDoc for contentPolicy check and in the loadInfo (r=sicking)
dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
--- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
+++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp
@@ -419,17 +419,17 @@ txCompileObserver::loadURI(const nsAStri
                                  getter_AddRefs(referrerPrincipal));
     NS_ENSURE_SUCCESS(rv, rv);
 
     // Content Policy
     int16_t shouldLoad = nsIContentPolicy::ACCEPT;
     rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_STYLESHEET,
                                    uri,
                                    referrerPrincipal,
-                                   nullptr,
+                                   mLoaderDocument,
                                    NS_LITERAL_CSTRING("application/xml"),
                                    nullptr,
                                    &shouldLoad);
     NS_ENSURE_SUCCESS(rv, rv);
     if (NS_CP_REJECTED(shouldLoad)) {
         return NS_ERROR_DOM_BAD_URI;
     }
 
@@ -455,22 +455,24 @@ txCompileObserver::startLoad(nsIURI* aUr
                              nsIPrincipal* aReferrerPrincipal)
 {
     nsCOMPtr<nsILoadGroup> loadGroup = mLoaderDocument->GetDocumentLoadGroup();
     if (!loadGroup) {
         return NS_ERROR_FAILURE;
     }
 
     nsCOMPtr<nsIChannel> channel;
-    nsresult rv = NS_NewChannel(getter_AddRefs(channel),
-                                aUri,
-                                aReferrerPrincipal,
-                                nsILoadInfo::SEC_NORMAL,
-                                nsIContentPolicy::TYPE_STYLESHEET,
-                                loadGroup);
+    nsresult rv = NS_NewChannelWithTriggeringPrincipal(
+                    getter_AddRefs(channel),
+                    aUri,
+                    mLoaderDocument,
+                    aReferrerPrincipal, // triggeringPrincipal
+                    nsILoadInfo::SEC_NORMAL,
+                    nsIContentPolicy::TYPE_XSLT,
+                    loadGroup);
 
     NS_ENSURE_SUCCESS(rv, rv);
 
     channel->SetContentType(NS_LITERAL_CSTRING("text/xml"));
 
     nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(channel));
     if (httpChannel) {
         httpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),
@@ -516,17 +518,17 @@ TX_LoadSheet(nsIURI* aUri, txMozillaXSLT
     PR_LOG(txLog::xslt, PR_LOG_ALWAYS, ("TX_LoadSheet: %s\n", spec.get()));
 
     // Content Policy
     int16_t shouldLoad = nsIContentPolicy::ACCEPT;
     nsresult rv =
         NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_STYLESHEET,
                                   aUri,
                                   principal,
-                                  aProcessor->GetSourceContentModel(),
+                                  aLoaderDocument,
                                   NS_LITERAL_CSTRING("application/xml"),
                                   nullptr,
                                   &shouldLoad);
     NS_ENSURE_SUCCESS(rv, rv);
     if (NS_CP_REJECTED(shouldLoad)) {
         return NS_ERROR_DOM_BAD_URI;
     }