Bug 664299 - Pass the loading principal to imgILoader::loadImage so we can operate on it later. r=bz
authorJoe Drew <joe@drew.ca>
Thu, 14 Jul 2011 14:47:32 -0400
changeset 72830 5977286eda3a28def9892c8803a3627b02432997
parent 72829 d5ae5580508ff85a9fddfd8d47d9ccf72ddac4fe
child 72831 24b7b80bb3c3d2b97c6a119fecc75dc9966ad530
push id20776
push usereakhgari@mozilla.com
push dateFri, 15 Jul 2011 12:13:35 +0000
treeherdermozilla-central@9349ae9094f6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs664299
milestone8.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 664299 - Pass the loading principal to imgILoader::loadImage so we can operate on it later. r=bz
content/base/src/nsContentUtils.cpp
embedding/browser/webBrowser/nsContextMenuInfo.cpp
layout/generic/nsImageFrame.cpp
modules/libpr0n/public/imgILoader.idl
modules/libpr0n/src/imgLoader.cpp
modules/libpr0n/src/imgLoader.h
modules/libpr0n/src/imgRequest.cpp
modules/libpr0n/src/imgRequest.h
modules/libpr0n/test/unit/async_load_tests.js
toolkit/system/gnome/nsAlertsIconListener.cpp
widget/src/cocoa/nsMenuItemIconX.mm
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -2319,16 +2319,17 @@ nsContentUtils::LoadImage(nsIURI* aURI, 
   // Make the URI immutable so people won't change it under us
   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 */
+                              aLoadingPrincipal,    /* loading principal */
                               loadGroup,            /* loadgroup */
                               aObserver,            /* imgIDecoderObserver */
                               aLoadingDocument,     /* uniquification key */
                               aLoadFlags,           /* load flags */
                               nsnull,               /* cache key */
                               nsnull,               /* existing request*/
                               channelPolicy,        /* CSP info */
                               aRequest);
--- a/embedding/browser/webBrowser/nsContextMenuInfo.cpp
+++ b/embedding/browser/webBrowser/nsContextMenuInfo.cpp
@@ -336,19 +336,19 @@ nsContextMenuInfo::GetBackgroundImageReq
           nsCOMPtr<nsIURI> bgUri;
           NS_NewURI(getter_AddRefs(bgUri), bgStringValue);
           NS_ENSURE_TRUE(bgUri, NS_ERROR_FAILURE);
 
           nsCOMPtr<imgILoader> il(do_GetService(
                                     "@mozilla.org/image/loader;1"));
           NS_ENSURE_TRUE(il, NS_ERROR_FAILURE);
 
-          return il->LoadImage(bgUri, nsnull, nsnull, nsnull, nsnull, nsnull,
-                               nsIRequest::LOAD_NORMAL, nsnull, nsnull,
-                               channelPolicy, aRequest);
+          return il->LoadImage(bgUri, nsnull, nsnull, principal, nsnull,
+                               nsnull, nsnull, nsIRequest::LOAD_NORMAL, nsnull,
+                               nsnull, channelPolicy, aRequest);
         }
       }
 
       // bail if we encounter non-transparent background-color
       computedStyle->GetPropertyCSSValue(NS_LITERAL_STRING("background-color"),
                                          getter_AddRefs(cssValue));
       primitiveValue = do_QueryInterface(cssValue);
       if (primitiveValue) {
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -1785,16 +1785,17 @@ nsImageFrame::LoadIcon(const nsAString& 
   // For icon loads, we don't need to merge with the loadgroup flags
   nsLoadFlags loadFlags = nsIRequest::LOAD_NORMAL;
 
   return il->LoadImage(realURI,     /* icon URI */
                        nsnull,      /* initial document URI; this is only
                                        relevant for cookies, so does not
                                        apply to icons. */
                        nsnull,      /* referrer (not relevant for icons) */
+                       nsnull,      /* principal (not relevant for icons) */
                        loadGroup,
                        gIconLoad,
                        nsnull,      /* Not associated with any particular document */
                        loadFlags,
                        nsnull,
                        nsnull,
                        nsnull,      /* channel policy not needed */
                        aRequest);
--- a/modules/libpr0n/public/imgILoader.idl
+++ b/modules/libpr0n/public/imgILoader.idl
@@ -39,39 +39,41 @@
 
 #include "nsISupports.idl"
 
 interface imgIDecoderObserver;
 interface imgIRequest;
 
 interface nsIChannel;
 interface nsILoadGroup;
+interface nsIPrincipal;
 interface nsIStreamListener;
 interface nsIURI;
 
 interface nsISimpleEnumerator;
 interface nsIChannelPolicy;
 
 #include "nsIRequest.idl" // for nsLoadFlags
 
 /**
  * imgILoader interface
  *
  * @author Stuart Parmenter <pavlov@netscape.com>
  * @version 0.3
  * @see imagelib2
  */
-[scriptable, uuid(47fbc3e7-c654-4ffb-83fc-a861394145ee)]
+[scriptable, uuid(20a5e3e9-0d5b-482c-9f41-942b5f19e5a3)]
 interface imgILoader : nsISupports
 {
   /**
    * Start the load and decode of an image.
    * @param aURI the URI to load
    * @param aInitialDocumentURI the URI that 'initiated' the load -- used for 3rd party cookie blocking
    * @param aReferrerURI the 'referring' URI
+   * @param aLoadingPrincipal the principal of the loading document
    * @param aLoadGroup Loadgroup to put the image load into
    * @param aObserver the observer (may be null)
    * @param aCX some random data
    * @param aLoadFlags Load flags for the request
    * @param aCacheKey cache key to use for a load if the original
    *                  image came from a request that had post data
    * @param aRequest A newly created, unused imgIRequest object or NULL for one to
                      be created for you.
@@ -80,16 +82,17 @@ interface imgILoader : nsISupports
    * libpr0n does NOT keep a strong ref to the observer; this prevents
    * reference cycles.  This means that callers of loadImage should
    * make sure to Cancel() the resulting request before the observer
    * goes away.
    */
   imgIRequest loadImage(in nsIURI aURI,
                         in nsIURI aInitialDocumentURL,
                         in nsIURI aReferrerURI,
+                        in nsIPrincipal aLoadingPrincipal,
                         in nsILoadGroup aLoadGroup,
                         in imgIDecoderObserver aObserver,
                         in nsISupports aCX,
                         in nsLoadFlags aLoadFlags,
                         in nsISupports cacheKey,
                         in imgIRequest aRequest,
                         in nsIChannelPolicy channelPolicy);
 
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -1135,17 +1135,18 @@ PRBool imgLoader::ValidateRequestWithNew
                                                 nsIURI *aInitialDocumentURI,
                                                 nsIURI *aReferrerURI,
                                                 nsILoadGroup *aLoadGroup,
                                                 imgIDecoderObserver *aObserver,
                                                 nsISupports *aCX,
                                                 nsLoadFlags aLoadFlags,
                                                 imgIRequest *aExistingRequest,
                                                 imgIRequest **aProxyRequest,
-                                                nsIChannelPolicy *aPolicy)
+                                                nsIChannelPolicy *aPolicy,
+                                                nsIPrincipal* aLoadingPrincipal)
 {
   // now we need to insert a new channel request object inbetween the real
   // request and the proxy that basically delays loading the image until it
   // gets a 304 or figures out that this needs to be a new request
 
   nsresult rv;
 
   // If we're currently in the middle of validating this request, just hand
@@ -1238,17 +1239,18 @@ PRBool imgLoader::ValidateEntry(imgCache
                                 nsIURI *aReferrerURI,
                                 nsILoadGroup *aLoadGroup,
                                 imgIDecoderObserver *aObserver,
                                 nsISupports *aCX,
                                 nsLoadFlags aLoadFlags,
                                 PRBool aCanMakeNewChannel,
                                 imgIRequest *aExistingRequest,
                                 imgIRequest **aProxyRequest,
-                                nsIChannelPolicy *aPolicy = nsnull)
+                                nsIChannelPolicy *aPolicy,
+                                nsIPrincipal* aLoadingPrincipal)
 {
   LOG_SCOPE(gImgLog, "imgLoader::ValidateEntry");
 
   PRBool hasExpired;
   PRUint32 expirationTime = aEntry->GetExpiryTime();
   if (expirationTime <= SecondsFromPRTime(PR_Now())) {
     hasExpired = PR_TRUE;
   } else {
@@ -1352,17 +1354,18 @@ PRBool imgLoader::ValidateEntry(imgCache
   }
 
   if (validateRequest && aCanMakeNewChannel) {
     LOG_SCOPE(gImgLog, "imgLoader::ValidateRequest |cache hit| must validate");
 
     return ValidateRequestWithNewChannel(request, aURI, aInitialDocumentURI,
                                          aReferrerURI, aLoadGroup, aObserver,
                                          aCX, aLoadFlags, aExistingRequest,
-                                         aProxyRequest, aPolicy);
+                                         aProxyRequest, aPolicy,
+                                         aLoadingPrincipal);
   } 
 
   return !validateRequest;
 }
 
 
 PRBool imgLoader::RemoveFromCache(nsIURI *aKey)
 {
@@ -1482,21 +1485,22 @@ nsresult imgLoader::EvictEntries(imgCach
 #define LOAD_FLAGS_CACHE_MASK    (nsIRequest::LOAD_BYPASS_CACHE | \
                                   nsIRequest::LOAD_FROM_CACHE)
 
 #define LOAD_FLAGS_VALIDATE_MASK (nsIRequest::VALIDATE_ALWAYS |   \
                                   nsIRequest::VALIDATE_NEVER |    \
                                   nsIRequest::VALIDATE_ONCE_PER_SESSION)
 
 
-/* imgIRequest loadImage (in nsIURI aURI, in nsIURI initialDocumentURI, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */
+/* imgIRequest loadImage (in nsIURI aURI, in nsIURI initialDocumentURI, in nsIPrincipal loadingPrincipal, in nsILoadGroup aLoadGroup, in imgIDecoderObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */
 
 NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI, 
                                    nsIURI *aInitialDocumentURI,
                                    nsIURI *aReferrerURI,
+                                   nsIPrincipal* aLoadingPrincipal,
                                    nsILoadGroup *aLoadGroup,
                                    imgIDecoderObserver *aObserver,
                                    nsISupports *aCX,
                                    nsLoadFlags aLoadFlags,
                                    nsISupports *aCacheKey,
                                    imgIRequest *aRequest,
                                    nsIChannelPolicy *aPolicy,
                                    imgIRequest **_retval)
@@ -1551,17 +1555,17 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIUR
   // XXX For now ignore aCacheKey. We will need it in the future
   // for correctly dealing with image load requests that are a result
   // of post data.
   imgCacheTable &cache = GetCache(aURI);
 
   if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
     if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerURI,
                       aLoadGroup, aObserver, aCX, requestFlags, PR_TRUE,
-                      aRequest, _retval, aPolicy)) {
+                      aRequest, _retval, aPolicy, aLoadingPrincipal)) {
       request = getter_AddRefs(entry->GetRequest());
 
       // If this entry has no proxies, its request has no reference to the entry.
       if (entry->HasNoProxies()) {
         LOG_FUNC_WITH_PARAM(gImgLog, "imgLoader::LoadImage() adding proxyless entry", "uri", spec.get());
         NS_ABORT_IF_FALSE(!request->HasCacheEntry(), "Proxyless entry's request has cache entry!");
         request->SetCacheEntry(entry);
 
@@ -1608,17 +1612,18 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIUR
 
     // Create a loadgroup for this new channel.  This way if the channel
     // is redirected, we'll have a way to cancel the resulting channel.
     nsCOMPtr<nsILoadGroup> loadGroup =
         do_CreateInstance(NS_LOADGROUP_CONTRACTID);
     newChannel->SetLoadGroup(loadGroup);
 
     void *cacheId = NS_GetCurrentThread();
-    request->Init(aURI, aURI, loadGroup, newChannel, entry, cacheId, aCX);
+    request->Init(aURI, aURI, loadGroup, newChannel, entry, cacheId, aCX,
+                  aLoadingPrincipal);
 
     // Pass the windowID of the loading document, if possible.
     nsCOMPtr<nsIDocument> doc = do_QueryInterface(aCX);
     if (doc) {
       request->SetWindowID(doc->OuterWindowID());
     }
 
     // create the proxy listener
@@ -1737,17 +1742,18 @@ NS_IMETHODIMP imgLoader::LoadImageWithCh
       // We don't want to kick off another network load. So we ask
       // ValidateEntry to only do validation without creating a new proxy. If
       // it says that the entry isn't valid any more, we'll only use the entry
       // we're getting if the channel is loading from the cache anyways.
       //
       // XXX -- should this be changed? it's pretty much verbatim from the old
       // code, but seems nonsensical.
       if (ValidateEntry(entry, uri, nsnull, nsnull, nsnull, aObserver, aCX,
-                        requestFlags, PR_FALSE, nsnull, nsnull)) {
+                        requestFlags, PR_FALSE, nsnull, nsnull, nsnull,
+                        nsnull)) {
         request = getter_AddRefs(entry->GetRequest());
       } else {
         nsCOMPtr<nsICachingChannel> cacheChan(do_QueryInterface(channel));
         PRBool bUseCacheCopy;
 
         if (cacheChan)
           cacheChan->IsFromCache(&bUseCacheCopy);
         else
@@ -1793,17 +1799,20 @@ NS_IMETHODIMP imgLoader::LoadImageWithCh
     static_cast<imgRequestProxy*>(*_retval)->NotifyListener();
   } else {
     if (!NewRequestAndEntry(getter_AddRefs(request), getter_AddRefs(entry)))
       return NS_ERROR_OUT_OF_MEMORY;
 
     // We use originalURI here to fulfil the imgIRequest contract on GetURI.
     nsCOMPtr<nsIURI> originalURI;
     channel->GetOriginalURI(getter_AddRefs(originalURI));
-    request->Init(originalURI, uri, channel, channel, entry, NS_GetCurrentThread(), aCX);
+
+    // No principal specified here, because we're not passed one.
+    request->Init(originalURI, uri, channel, channel, entry,
+                  NS_GetCurrentThread(), aCX, nsnull);
 
     ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(request.get()));
     NS_ADDREF(pl);
 
     *listener = static_cast<nsIStreamListener*>(pl);
     NS_ADDREF(*listener);
 
     NS_RELEASE(pl);
@@ -2087,26 +2096,29 @@ NS_IMETHODIMP imgCacheValidator::OnStart
   mRequest->GetURI(getter_AddRefs(uri));
 
 #if defined(PR_LOGGING)
   nsCAutoString spec;
   uri->GetSpec(spec);
   LOG_MSG_WITH_PARAM(gImgLog, "imgCacheValidator::OnStartRequest creating new request", "uri", spec.get());
 #endif
 
+  nsCOMPtr<nsIPrincipal> loadingPrincipal = mRequest->GetLoadingPrincipal();
+
   // Doom the old request's cache entry
   mRequest->RemoveFromCache();
 
   mRequest->mValidator = nsnull;
   mRequest = nsnull;
 
   // We use originalURI here to fulfil the imgIRequest contract on GetURI.
   nsCOMPtr<nsIURI> originalURI;
   channel->GetOriginalURI(getter_AddRefs(originalURI));
-  mNewRequest->Init(originalURI, uri, channel, channel, mNewEntry, NS_GetCurrentThread(), mContext);
+  mNewRequest->Init(originalURI, uri, channel, channel, mNewEntry,
+                    NS_GetCurrentThread(), mContext, loadingPrincipal);
 
   ProxyListener *pl = new ProxyListener(static_cast<nsIStreamListener *>(mNewRequest));
 
   mDestListener = static_cast<nsIStreamListener*>(pl);
 
   // Try to add the new request into the cache. Note that the entry must be in
   // the cache before the proxies' ownership changes, because adding a proxy
   // changes the caching behaviour for imgRequests.
--- a/modules/libpr0n/src/imgLoader.h
+++ b/modules/libpr0n/src/imgLoader.h
@@ -303,26 +303,28 @@ private: // methods
 
   PRBool ValidateEntry(imgCacheEntry *aEntry, nsIURI *aKey,
                        nsIURI *aInitialDocumentURI, nsIURI *aReferrerURI, 
                        nsILoadGroup *aLoadGroup,
                        imgIDecoderObserver *aObserver, nsISupports *aCX,
                        nsLoadFlags aLoadFlags, PRBool aCanMakeNewChannel,
                        imgIRequest *aExistingRequest,
                        imgIRequest **aProxyRequest,
-                       nsIChannelPolicy *aPolicy);
+                       nsIChannelPolicy *aPolicy,
+                       nsIPrincipal* aLoadingPrincipal);
   PRBool ValidateRequestWithNewChannel(imgRequest *request, nsIURI *aURI,
                                        nsIURI *aInitialDocumentURI,
                                        nsIURI *aReferrerURI,
                                        nsILoadGroup *aLoadGroup,
                                        imgIDecoderObserver *aObserver,
                                        nsISupports *aCX, nsLoadFlags aLoadFlags,
                                        imgIRequest *aExistingRequest,
                                        imgIRequest **aProxyRequest,
-                                       nsIChannelPolicy *aPolicy);
+                                       nsIChannelPolicy *aPolicy,
+                                       nsIPrincipal* aLoadingPrincipal);
 
   nsresult CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup,
                                     imgIDecoderObserver *aObserver,
                                     nsLoadFlags aLoadFlags, imgIRequest *aRequestProxy,
                                     imgIRequest **_retval);
 
   void ReadAcceptHeaderPref();
 
--- a/modules/libpr0n/src/imgRequest.cpp
+++ b/modules/libpr0n/src/imgRequest.cpp
@@ -200,17 +200,18 @@ imgRequest::~imgRequest()
 }
 
 nsresult imgRequest::Init(nsIURI *aURI,
                           nsIURI *aCurrentURI,
                           nsIRequest *aRequest,
                           nsIChannel *aChannel,
                           imgCacheEntry *aCacheEntry,
                           void *aCacheId,
-                          void *aLoadId)
+                          void *aLoadId,
+                          nsIPrincipal* aLoadingPrincipal)
 {
   LOG_FUNC(gImgLog, "imgRequest::Init");
 
   NS_ABORT_IF_FALSE(!mImage, "Multiple calls to init");
   NS_ABORT_IF_FALSE(aURI, "No uri");
   NS_ABORT_IF_FALSE(aCurrentURI, "No current uri");
   NS_ABORT_IF_FALSE(aRequest, "No request");
   NS_ABORT_IF_FALSE(aChannel, "No channel");
@@ -220,16 +221,18 @@ nsresult imgRequest::Init(nsIURI *aURI,
   mStatusTracker = new imgStatusTracker(nsnull);
 
   mURI = aURI;
   mCurrentURI = aCurrentURI;
   mRequest = aRequest;
   mChannel = aChannel;
   mTimedChannel = do_QueryInterface(mChannel);
 
+  mLoadingPrincipal = aLoadingPrincipal;
+
   mChannel->GetNotificationCallbacks(getter_AddRefs(mPrevChannelSink));
 
   NS_ASSERTION(mPrevChannelSink != this,
                "Initializing with a channel that already calls back to us!");
 
   mChannel->SetNotificationCallbacks(this);
 
   mCacheEntry = aCacheEntry;
--- a/modules/libpr0n/src/imgRequest.h
+++ b/modules/libpr0n/src/imgRequest.h
@@ -90,17 +90,18 @@ public:
   NS_DECL_ISUPPORTS
 
   nsresult Init(nsIURI *aURI,
                 nsIURI *aCurrentURI,
                 nsIRequest *aRequest,
                 nsIChannel *aChannel,
                 imgCacheEntry *aCacheEntry,
                 void *aCacheId,
-                void *aLoadId);
+                void *aLoadId,
+                nsIPrincipal* aLoadingPrincipal);
 
   // Callers must call imgRequestProxy::Notify later.
   nsresult AddProxy(imgRequestProxy *proxy);
 
   // aNotify==PR_FALSE still sends OnStopRequest.
   nsresult RemoveProxy(imgRequestProxy *proxy, nsresult aStatus, PRBool aNotify);
 
   void SniffMimeType(const char *buf, PRUint32 len);
@@ -130,16 +131,24 @@ public:
   }
 
   // Set the cache validation information (expiry time, whether we must
   // validate, etc) on the cache entry based on the request information.
   // If this function is called multiple times, the information set earliest
   // wins.
   static void SetCacheValidation(imgCacheEntry* aEntry, nsIRequest* aRequest);
 
+  // The principal for the document that loaded this image. Used when trying to
+  // validate a CORS image load.
+  already_AddRefed<nsIPrincipal> GetLoadingPrincipal() const
+  {
+    nsCOMPtr<nsIPrincipal> principal = mLoadingPrincipal;
+    return principal.forget();
+  }
+
 private:
   friend class imgCacheEntry;
   friend class imgRequestProxy;
   friend class imgLoader;
   friend class imgCacheValidator;
   friend class imgStatusTracker;
   friend class imgCacheExpirationTracker;
   friend class imgRequestNotifyRunnable;
@@ -211,16 +220,19 @@ private:
   friend class imgMemoryReporter;
 
   nsCOMPtr<nsIRequest> mRequest;
   // The original URI we were loaded with. This is the same as the URI we are
   // keyed on in the cache.
   nsCOMPtr<nsIURI> mURI;
   // The URI of the resource we ended up loading after all redirects, etc.
   nsCOMPtr<nsIURI> mCurrentURI;
+  // The principal of the document which loaded this image. Used when validating for CORS.
+  nsCOMPtr<nsIPrincipal> mLoadingPrincipal;
+  // The principal of this image.
   nsCOMPtr<nsIPrincipal> mPrincipal;
   // Status-tracker -- transferred to mImage, when it gets instantiated
   nsAutoPtr<imgStatusTracker> mStatusTracker;
   nsRefPtr<mozilla::imagelib::Image> mImage;
   nsCOMPtr<nsIProperties> mProperties;
   nsCOMPtr<nsISupports> mSecurityInfo;
   nsCOMPtr<nsIChannel> mChannel;
   nsCOMPtr<nsIInterfaceRequestor> mPrevChannelSink;
--- a/modules/libpr0n/test/unit/async_load_tests.js
+++ b/modules/libpr0n/test/unit/async_load_tests.js
@@ -77,17 +77,17 @@ function secondLoadDone(oldlistener, aRe
 // Load the request a second time. This should come from the image cache, and
 // therefore would be at most risk of being served synchronously.
 function checkSecondLoad()
 {
   do_test_pending();
 
   var loader = Cc["@mozilla.org/image/loader;1"].getService(Ci.imgILoader);
   var listener = new ImageListener(checkClone, secondLoadDone);
-  requests.push(loader.loadImage(uri, null, null, null, listener, null, 0, null, null, null));
+  requests.push(loader.loadImage(uri, null, null, null, null, listener, null, 0, null, null, null));
   listener.synchronous = false;
 }
 
 function firstLoadDone(oldlistener, aRequest)
 {
   checkSecondLoad(uri);
 
   do_test_finished();
@@ -180,30 +180,30 @@ function startImageCallback(otherCb)
 {
   return function(listener, request)
   {
     var loader = Cc["@mozilla.org/image/loader;1"].getService(Ci.imgILoader);
 
     // Make sure we can load the same image immediately out of the cache.
     do_test_pending();
     var listener2 = new ImageListener(null, function(foo, bar) { do_test_finished(); });
-    requests.push(loader.loadImage(uri, null, null, null, listener2, null, 0, null, null, null));
+    requests.push(loader.loadImage(uri, null, null, null, null, listener2, null, 0, null, null, null));
     listener2.synchronous = false;
 
     // Now that we've started another load, chain to the callback.
     otherCb(listener, request);
   }
 }
 
 function run_test()
 {
   var loader = Cc["@mozilla.org/image/loader;1"].getService(Ci.imgILoader);
 
   do_test_pending();
   var listener = new ImageListener(startImageCallback(checkClone), firstLoadDone);
-  var req = loader.loadImage(uri, null, null, null, listener, null, 0, null, null, null);
+  var req = loader.loadImage(uri, null, null, null, null, listener, null, 0, null, null, null);
   requests.push(req);
 
   // Ensure that we don't cause any mayhem when we lock an image.
   req.lockImage();
 
   listener.synchronous = false;
 }
--- a/toolkit/system/gnome/nsAlertsIconListener.cpp
+++ b/toolkit/system/gnome/nsAlertsIconListener.cpp
@@ -257,17 +257,17 @@ nsAlertsIconListener::StartRequest(const
   NS_NewURI(getter_AddRefs(imageUri), aImageUrl);
   if (!imageUri)
     return ShowAlert(NULL);
 
   nsCOMPtr<imgILoader> il(do_GetService("@mozilla.org/image/loader;1"));
   if (!il)
     return ShowAlert(NULL);
 
-  return il->LoadImage(imageUri, nsnull, nsnull, nsnull, this,
+  return il->LoadImage(imageUri, nsnull, nsnull, nsnull, nsnull, this,
                        nsnull, nsIRequest::LOAD_NORMAL, nsnull, nsnull,
                        nsnull, getter_AddRefs(mIconRequest));
 }
 
 void
 nsAlertsIconListener::SendCallback()
 {
   if (mAlertListener)
--- a/widget/src/cocoa/nsMenuItemIconX.mm
+++ b/widget/src/cocoa/nsMenuItemIconX.mm
@@ -336,17 +336,17 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconU
     if (!sPlaceholderIconImage) return NS_ERROR_FAILURE;
 
     if (mNativeMenuItem)
       [mNativeMenuItem setImage:sPlaceholderIconImage];
   }
 
   // Passing in null for channelPolicy here since nsMenuItemIconX::LoadIcon is
   // not exposed to web content
-  rv = loader->LoadImage(aIconURI, nsnull, nsnull, loadGroup, this,
+  rv = loader->LoadImage(aIconURI, nsnull, nsnull, nsnull, loadGroup, this,
                          nsnull, nsIRequest::LOAD_NORMAL, nsnull, nsnull,
                          nsnull, getter_AddRefs(mIconRequest));
   if (NS_FAILED(rv)) return rv;
 
   return NS_OK;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
 }