Bug 1297156: Fix the naming of the triggering principal argument in nsContentUtils. draft
authorDave Townsend <dtownsend@oxymoronical.com>
Wed, 11 Apr 2018 12:56:52 -0700
changeset 780713 490748389a401067742e9d307432004dd8334edf
parent 780712 5b5240fde632696af7e009fbf2957e27a2f3735a
child 780714 1c5532d3395792985df7e057a4ca8ca45479cf22
push id106099
push userdtownsend@mozilla.com
push dateWed, 11 Apr 2018 20:47:47 +0000
bugs1297156
milestone61.0a1
Bug 1297156: Fix the naming of the triggering principal argument in nsContentUtils. nsContentUtils::LoadImage accepts an argument labelled as aLoadingPrincipal but we actually pass in triggering principals and it passes it along to a method that accepts a triggering principal so this renames the argument. MozReview-Commit-ID: LWrm7DVCJ3o
dom/base/nsContentUtils.cpp
dom/base/nsContentUtils.h
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -3666,30 +3666,30 @@ nsContentUtils::CORSModeToLoadImageFlags
     return 0;
   }
 }
 
 // static
 nsresult
 nsContentUtils::LoadImage(nsIURI* aURI, nsINode* aContext,
                           nsIDocument* aLoadingDocument,
-                          nsIPrincipal* aLoadingPrincipal,
+                          nsIPrincipal* aTriggeringPrincipal,
                           uint64_t aRequestContextID,
                           nsIURI* aReferrer,
                           net::ReferrerPolicy aReferrerPolicy,
                           imgINotificationObserver* aObserver, int32_t aLoadFlags,
                           const nsAString& initiatorType,
                           imgRequestProxy** aRequest,
                           uint32_t aContentPolicyType,
                           bool aUseUrgentStartForChannel)
 {
   NS_PRECONDITION(aURI, "Must have a URI");
   NS_PRECONDITION(aContext, "Must have a context");
   NS_PRECONDITION(aLoadingDocument, "Must have a document");
-  NS_PRECONDITION(aLoadingPrincipal, "Must have a principal");
+  NS_PRECONDITION(aTriggeringPrincipal, "Must have a principal");
   NS_PRECONDITION(aRequest, "Null out param");
 
   imgLoader* imgLoader = GetImgLoaderForDocument(aLoadingDocument);
   if (!imgLoader) {
     // nothing we can do here
     return NS_ERROR_FAILURE;
   }
 
@@ -3704,17 +3704,17 @@ nsContentUtils::LoadImage(nsIURI* aURI, 
   NS_TryToSetImmutable(aURI);
 
   // XXXbz using "documentURI" for the initialDocumentURI is not quite
   // right, but the best we can do here...
   return imgLoader->LoadImage(aURI,                 /* uri to load */
                               documentURI,          /* initialDocumentURI */
                               aReferrer,            /* referrer */
                               aReferrerPolicy,      /* referrer policy */
-                              aLoadingPrincipal,    /* loading principal */
+                              aTriggeringPrincipal, /* triggering principal */
                               aRequestContextID,    /* request context ID */
                               loadGroup,            /* loadgroup */
                               aObserver,            /* imgINotificationObserver */
                               aContext,             /* loading context */
                               aLoadingDocument,     /* uniquification key */
                               aLoadFlags,           /* load flags */
                               nullptr,              /* cache key */
                               aContentPolicyType,   /* content policy type */
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -845,32 +845,32 @@ public:
    * Method to start an image load.  This does not do any security checks.
    * This method will attempt to make aURI immutable; a caller that wants to
    * keep a mutable version around should pass in a clone.
    *
    * @param aURI uri of the image to be loaded
    * @param aContext element of document where the result of this request
    *                 will be used.
    * @param aLoadingDocument the document we belong to
-   * @param aLoadingPrincipal the principal doing the load
+   * @param aTriggeringPrincipal the principal triggering the load
    * @param aReferrer the referrer URI
    * @param aReferrerPolicy the referrer-sending policy to use on channel
    *         creation
    * @param aObserver the observer for the image load
    * @param aLoadFlags the load flags to use.  See nsIRequest
    * @param [aContentPolicyType=nsIContentPolicy::TYPE_INTERNAL_IMAGE] (Optional)
    *        The CP content type to use
    * @param aUseUrgentStartForChannel,(Optional) a flag to mark on channel if it
    *        is triggered by user input events.
    * @return the imgIRequest for the image load
    */
   static nsresult LoadImage(nsIURI* aURI,
                             nsINode* aContext,
                             nsIDocument* aLoadingDocument,
-                            nsIPrincipal* aLoadingPrincipal,
+                            nsIPrincipal* aTriggeringPrincipal,
                             uint64_t aRequestContextID,
                             nsIURI* aReferrer,
                             mozilla::net::ReferrerPolicy aReferrerPolicy,
                             imgINotificationObserver* aObserver,
                             int32_t aLoadFlags,
                             const nsAString& initiatorType,
                             imgRequestProxy** aRequest,
                             uint32_t aContentPolicyType = nsIContentPolicy::TYPE_INTERNAL_IMAGE,