Bug 920630 - Part 4. Change rest of imagelib to use nsIURI directly instead of ImageURL. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Tue, 05 Jun 2018 20:42:57 -0400
changeset 421473 dcf212d04876742f581acab5f428e703b54de82f
parent 421472 7597bbcc9d66111326aa69048ad5847bdc7497f2
child 421474 e2002e5279d13b2088f3d3c5e554ae4f64853d6c
push id104044
push useraosmond@gmail.com
push dateWed, 06 Jun 2018 00:43:12 +0000
treeherdermozilla-inbound@e2002e5279d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs920630
milestone62.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 920630 - Part 4. Change rest of imagelib to use nsIURI directly instead of ImageURL. r=tnikkel
image/ProgressTracker.cpp
image/imgLoader.cpp
image/imgLoader.h
image/imgRequest.cpp
image/imgRequest.h
image/imgRequestProxy.cpp
image/imgRequestProxy.h
--- a/image/ProgressTracker.cpp
+++ b/image/ProgressTracker.cpp
@@ -173,26 +173,18 @@ ProgressTracker::Notify(IProgressObserve
 
   if (aObserver->NotificationsDeferred()) {
     // There is a pending notification, or the observer isn't ready yet.
     return;
   }
 
   if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
     RefPtr<Image> image = GetImage();
-    if (image && image->GetURI()) {
-      RefPtr<ImageURL> uri(image->GetURI());
-      nsAutoCString spec;
-      uri->GetSpec(spec);
-      LOG_FUNC_WITH_PARAM(gImgLog,
-                          "ProgressTracker::Notify async", "uri", spec.get());
-    } else {
-      LOG_FUNC_WITH_PARAM(gImgLog,
-                          "ProgressTracker::Notify async", "uri", "<unknown>");
-    }
+    LOG_FUNC_WITH_PARAM(gImgLog,
+                        "ProgressTracker::Notify async", "uri", image);
   }
 
   aObserver->MarkPendingNotify();
 
   // If we have an existing runnable that we can use, we just append this
   // observer to its list of observers to be notified. This ensures we don't
   // unnecessarily delay onload.
   AsyncNotifyRunnable* runnable =
@@ -248,22 +240,18 @@ ProgressTracker::NotifyCurrentState(IPro
 
   if (aObserver->NotificationsDeferred()) {
     // There is a pending notification, or the observer isn't ready yet.
     return;
   }
 
   if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
     RefPtr<Image> image = GetImage();
-    nsAutoCString spec;
-    if (image && image->GetURI()) {
-      image->GetURI()->GetSpec(spec);
-    }
     LOG_FUNC_WITH_PARAM(gImgLog,
-                        "ProgressTracker::NotifyCurrentState", "uri", spec.get());
+                        "ProgressTracker::NotifyCurrentState", "uri", image);
   }
 
   aObserver->MarkPendingNotify();
 
   nsCOMPtr<nsIRunnable> ev = new AsyncNotifyCurrentStateRunnable(this,
                                                                  aObserver);
   mEventTarget->Dispatch(ev.forget(), NS_DISPATCH_NORMAL);
 }
@@ -396,23 +384,18 @@ ProgressTracker::SyncNotifyProgress(Prog
 }
 
 void
 ProgressTracker::SyncNotify(IProgressObserver* aObserver)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   RefPtr<Image> image = GetImage();
-
-  nsAutoCString spec;
-  if (image && image->GetURI()) {
-    image->GetURI()->GetSpec(spec);
-  }
   LOG_SCOPE_WITH_PARAM(gImgLog,
-                       "ProgressTracker::SyncNotify", "uri", spec.get());
+                       "ProgressTracker::SyncNotify", "uri", image);
 
   nsIntRect rect;
   if (image) {
     int32_t width, height;
     if (NS_FAILED(image->GetWidth(&width)) ||
         NS_FAILED(image->GetHeight(&height))) {
       // Either the image has no intrinsic size, or it has an error.
       rect = GetMaxSizedIntRect();
@@ -591,21 +574,17 @@ ProgressTracker::FireFailureNotification
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   // Some kind of problem has happened with image decoding.
   // Report the URI to net:failed-to-process-uri-conent observers.
   RefPtr<Image> image = GetImage();
   if (image) {
     // Should be on main thread, so ok to create a new nsIURI.
-    nsCOMPtr<nsIURI> uri;
-    {
-      RefPtr<ImageURL> threadsafeUriData = image->GetURI();
-      uri = threadsafeUriData ? threadsafeUriData->ToIURI() : nullptr;
-    }
+    nsCOMPtr<nsIURI> uri = image->GetURI();
     if (uri) {
       nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
       if (os) {
         os->NotifyObservers(uri, "net:failed-to-process-uri-content", nullptr);
       }
     }
   }
 }
--- a/image/imgLoader.cpp
+++ b/image/imgLoader.cpp
@@ -989,20 +989,20 @@ void imgCacheEntry::UpdateLoadTime()
 }
 
 void
 imgCacheEntry::SetHasNoProxies(bool hasNoProxies)
 {
   if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
     if (hasNoProxies) {
       LOG_FUNC_WITH_PARAM(gImgLog, "imgCacheEntry::SetHasNoProxies true",
-                          "uri", mRequest->CacheKey().Spec());
+                          "uri", mRequest->CacheKey().URI());
     } else {
       LOG_FUNC_WITH_PARAM(gImgLog, "imgCacheEntry::SetHasNoProxies false",
-                          "uri", mRequest->CacheKey().Spec());
+                          "uri", mRequest->CacheKey().URI());
     }
   }
 
   mHasNoProxies = hasNoProxies;
 }
 
 imgCacheQueue::imgCacheQueue()
  : mDirty(false),
@@ -1167,17 +1167,17 @@ imgLoader::CreateNewProxyForRequest(imgR
 
   RefPtr<imgRequestProxy> proxyRequest = new imgRequestProxy();
 
   /* It is important to call |SetLoadFlags()| before calling |Init()| because
      |Init()| adds the request to the loadgroup.
    */
   proxyRequest->SetLoadFlags(aLoadFlags);
 
-  RefPtr<ImageURL> uri;
+  nsCOMPtr<nsIURI> uri;
   aRequest->GetURI(getter_AddRefs(uri));
 
   // init adds itself to imgRequest's list of observers
   nsresult rv = proxyRequest->Init(aRequest, aLoadGroup, aLoadingDocument,
                                    uri, aObserver);
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
@@ -1210,17 +1210,17 @@ imgCacheExpirationTracker::NotifyExpired
   // mechanism doesn't.
   RefPtr<imgCacheEntry> kungFuDeathGrip(entry);
 
   if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
     RefPtr<imgRequest> req = entry->GetRequest();
     if (req) {
       LOG_FUNC_WITH_PARAM(gImgLog,
                          "imgCacheExpirationTracker::NotifyExpired",
-                         "entry", req->CacheKey().Spec());
+                         "entry", req->CacheKey().URI());
     }
   }
 
   // We can be called multiple times on the same entry. Don't do work multiple
   // times.
   if (!entry->Evicted()) {
     entry->Loader()->RemoveFromCache(entry);
   }
@@ -1575,17 +1575,17 @@ imgLoader::MinimizeCaches()
 }
 
 bool
 imgLoader::PutIntoCache(const ImageCacheKey& aKey, imgCacheEntry* entry)
 {
   imgCacheTable& cache = GetCache(aKey);
 
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
-                             "imgLoader::PutIntoCache", "uri", aKey.Spec());
+                             "imgLoader::PutIntoCache", "uri", aKey.URI());
 
   // Check to see if this request already exists in the cache. If so, we'll
   // replace the old version.
   RefPtr<imgCacheEntry> tmpCacheEntry;
   if (cache.Get(aKey, getter_AddRefs(tmpCacheEntry)) && tmpCacheEntry) {
     MOZ_LOG(gImgLog, LogLevel::Debug,
            ("[this=%p] imgLoader::PutIntoCache -- Element already in the cache",
             nullptr));
@@ -1633,17 +1633,17 @@ imgLoader::PutIntoCache(const ImageCache
   return true;
 }
 
 bool
 imgLoader::SetHasNoProxies(imgRequest* aRequest, imgCacheEntry* aEntry)
 {
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                              "imgLoader::SetHasNoProxies", "uri",
-                             aRequest->CacheKey().Spec());
+                             aRequest->CacheKey().URI());
 
   aEntry->SetHasNoProxies(true);
 
   if (aEntry->Evicted()) {
     return false;
   }
 
   imgCacheQueue& queue = GetCacheQueue(aRequest->IsChrome());
@@ -1668,17 +1668,17 @@ bool
 imgLoader::SetHasProxies(imgRequest* aRequest)
 {
   VerifyCacheSizes();
 
   const ImageCacheKey& key = aRequest->CacheKey();
   imgCacheTable& cache = GetCache(key);
 
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
-                             "imgLoader::SetHasProxies", "uri", key.Spec());
+                             "imgLoader::SetHasProxies", "uri", key.URI());
 
   RefPtr<imgCacheEntry> entry;
   if (cache.Get(key, getter_AddRefs(entry)) && entry) {
     // Make sure the cache entry is for the right request
     RefPtr<imgRequest> entryRequest = entry->GetRequest();
     if (entryRequest == aRequest && entry->HasNoProxies()) {
       imgCacheQueue& queue = GetCacheQueue(key);
       queue.Remove(entry);
@@ -1724,17 +1724,17 @@ imgLoader::CheckCacheLimits(imgCacheTabl
 
     NS_ASSERTION(entry, "imgLoader::CheckCacheLimits -- NULL entry pointer");
 
     if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
       RefPtr<imgRequest> req = entry->GetRequest();
       if (req) {
         LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                                    "imgLoader::CheckCacheLimits",
-                                   "entry", req->CacheKey().Spec());
+                                   "entry", req->CacheKey().URI());
       }
     }
 
     if (entry) {
       // We just popped this entry from the queue, so pass AlreadyRemoved
       // to avoid searching the queue again in RemoveFromCache.
       RemoveFromCache(entry, QueueState::AlreadyRemoved);
     }
@@ -1999,17 +1999,17 @@ imgLoader::ValidateEntry(imgCacheEntry* 
 
   return !validateRequest;
 }
 
 bool
 imgLoader::RemoveFromCache(const ImageCacheKey& aKey)
 {
   LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
-                             "imgLoader::RemoveFromCache", "uri", aKey.Spec());
+                             "imgLoader::RemoveFromCache", "uri", aKey.URI());
 
   imgCacheTable& cache = GetCache(aKey);
   imgCacheQueue& queue = GetCacheQueue(aKey);
 
   RefPtr<imgCacheEntry> entry;
   cache.Remove(aKey, getter_AddRefs(entry));
   if (entry) {
     MOZ_ASSERT(!entry->Evicted(), "Evicting an already-evicted cache entry!");
@@ -2041,17 +2041,17 @@ imgLoader::RemoveFromCache(imgCacheEntry
   RefPtr<imgRequest> request = entry->GetRequest();
   if (request) {
     const ImageCacheKey& key = request->CacheKey();
     imgCacheTable& cache = GetCache(key);
     imgCacheQueue& queue = GetCacheQueue(key);
 
     LOG_STATIC_FUNC_WITH_PARAM(gImgLog,
                                "imgLoader::RemoveFromCache", "entry's uri",
-                               key.Spec());
+                               key.URI());
 
     cache.Remove(key);
 
     if (entry->HasNoProxies()) {
       LOG_STATIC_FUNC(gImgLog,
                       "imgLoader::RemoveFromCache removing from tracker");
       if (mCacheTracker) {
         mCacheTracker->RemoveObject(entry);
@@ -2209,18 +2209,17 @@ imgLoader::LoadImage(nsIURI* aURI,
   VerifyCacheSizes();
 
   NS_ASSERTION(aURI, "imgLoader::LoadImage -- NULL URI pointer");
 
   if (!aURI) {
     return NS_ERROR_NULL_POINTER;
   }
 
-  LOG_SCOPE_WITH_PARAM(gImgLog, "imgLoader::LoadImage", "aURI",
-                       aURI->GetSpecOrDefault().get());
+  LOG_SCOPE_WITH_PARAM(gImgLog, "imgLoader::LoadImage", "aURI", aURI);
 
   *_retval = nullptr;
 
   RefPtr<imgRequest> request;
 
   nsresult rv;
   nsLoadFlags requestFlags = nsIRequest::LOAD_NORMAL;
 
@@ -2305,17 +2304,17 @@ imgLoader::LoadImage(nsIURI* aURI,
                       aLoadingDocument, requestFlags, aContentPolicyType, true,
                       _retval, aTriggeringPrincipal, corsmode)) {
       request = 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", key.Spec());
+          "imgLoader::LoadImage() adding proxyless entry", "uri", key.URI());
         MOZ_ASSERT(!request->HasCacheEntry(),
           "Proxyless entry's request has cache entry!");
         request->SetCacheEntry(entry);
 
         if (mCacheTracker && entry->GetExpirationState()->IsTracked()) {
           mCacheTracker->MarkUsed(entry);
         }
       }
@@ -2593,17 +2592,17 @@ imgLoader::LoadImageWithChannel(nsIChann
       }
 
       if (request && entry) {
         // If this entry has no proxies, its request has no reference to
         // the entry.
         if (entry->HasNoProxies()) {
           LOG_FUNC_WITH_PARAM(gImgLog,
             "imgLoader::LoadImageWithChannel() adding proxyless entry",
-            "uri", key.Spec());
+            "uri", key.URI());
           MOZ_ASSERT(!request->HasCacheEntry(),
             "Proxyless entry's request has cache entry!");
           request->SetCacheEntry(entry);
 
           if (mCacheTracker && entry->GetExpirationState()->IsTracked()) {
             mCacheTracker->MarkUsed(entry);
           }
         }
@@ -3062,27 +3061,21 @@ imgCacheValidator::OnStartRequest(nsIReq
       UpdateProxies(/* aCancelRequest */ false, /* aSyncNotify */ true);
       return NS_OK;
     }
   }
 
   // We can't load out of cache. We have to create a whole new request for the
   // data that's coming in off the channel.
   nsCOMPtr<nsIURI> uri;
-  {
-    RefPtr<ImageURL> imageURL;
-    mRequest->GetURI(getter_AddRefs(imageURL));
-    uri = imageURL->ToIURI();
-  }
-
-  if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
-    LOG_MSG_WITH_PARAM(gImgLog,
-                       "imgCacheValidator::OnStartRequest creating new request",
-                       "uri", uri->GetSpecOrDefault().get());
-  }
+  mRequest->GetURI(getter_AddRefs(uri));
+
+  LOG_MSG_WITH_PARAM(gImgLog,
+                     "imgCacheValidator::OnStartRequest creating new request",
+                     "uri", uri);
 
   int32_t corsmode = mRequest->GetCORSMode();
   ReferrerPolicy refpol = mRequest->GetReferrerPolicy();
   nsCOMPtr<nsIPrincipal> triggeringPrincipal = mRequest->GetTriggeringPrincipal();
 
   // Doom the old request's cache entry
   mRequest->RemoveFromCache();
 
--- a/image/imgLoader.h
+++ b/image/imgLoader.h
@@ -29,17 +29,16 @@ class imgLoader;
 class imgRequestProxy;
 class imgINotificationObserver;
 class nsILoadGroup;
 class imgCacheExpirationTracker;
 class imgMemoryReporter;
 
 namespace mozilla {
 namespace image {
-class ImageURL;
 } // namespace image
 } // namespace mozilla
 
 class imgCacheEntry
 {
 public:
   static uint32_t SecondsFromPRTime(PRTime prTime);
 
@@ -229,17 +228,16 @@ class imgLoader final : public imgILoade
                         public imgICache,
                         public nsSupportsWeakReference,
                         public nsIObserver
 {
   virtual ~imgLoader();
 
 public:
   typedef mozilla::image::ImageCacheKey ImageCacheKey;
-  typedef mozilla::image::ImageURL ImageURL;
   typedef nsRefPtrHashtable<nsGenericHashKey<ImageCacheKey>,
                             imgCacheEntry> imgCacheTable;
   typedef nsTHashtable<nsPtrHashKey<imgRequest>> imgSet;
   typedef mozilla::net::ReferrerPolicy ReferrerPolicy;
   typedef mozilla::Mutex Mutex;
 
   NS_DECL_ISUPPORTS
   NS_DECL_IMGILOADER
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -75,20 +75,18 @@ imgRequest::imgRequest(imgLoader* aLoade
 }
 
 imgRequest::~imgRequest()
 {
   if (mLoader) {
     mLoader->RemoveFromUncachedImages(this);
   }
   if (mURI) {
-    nsAutoCString spec;
-    mURI->GetSpec(spec);
     LOG_FUNC_WITH_PARAM(gImgLog, "imgRequest::~imgRequest()",
-                        "keyuri", spec.get());
+                        "keyuri", mURI);
   } else
     LOG_FUNC(gImgLog, "imgRequest::~imgRequest()");
 }
 
 nsresult
 imgRequest::Init(nsIURI *aURI,
                  nsIURI *aFinalURI,
                  bool aHadInsecureRedirect,
@@ -106,27 +104,21 @@ imgRequest::Init(nsIURI *aURI,
 
   MOZ_ASSERT(!mImage, "Multiple calls to init");
   MOZ_ASSERT(aURI, "No uri");
   MOZ_ASSERT(aFinalURI, "No final uri");
   MOZ_ASSERT(aRequest, "No request");
   MOZ_ASSERT(aChannel, "No channel");
 
   mProperties = do_CreateInstance("@mozilla.org/properties;1");
-
-  // Use ImageURL to ensure access to URI data off main thread.
-  nsresult rv;
-  mURI = new ImageURL(aURI, rv);
-  NS_ENSURE_SUCCESS(rv, rv);
-
+  mURI = aURI;
   mFinalURI = aFinalURI;
   mRequest = aRequest;
   mChannel = aChannel;
   mTimedChannel = do_QueryInterface(mChannel);
-
   mTriggeringPrincipal = aTriggeringPrincipal;
   mCORSMode = aCORSMode;
   mReferrerPolicy = aReferrerPolicy;
 
   // If the original URI and the final URI are different, check whether the
   // original URI is secure. We deliberately don't take the final URI into
   // account, as it needs to be handled using more complicated rules than
   // earlier elements of the redirect chain.
@@ -260,22 +252,20 @@ imgRequest::RemoveProxy(imgRequestProxy*
     // been cancelled and thus removed from the cache, tell the image loader so
     // we can be evicted from the cache.
     if (mCacheEntry) {
       MOZ_ASSERT(mURI, "Removing last observer without key uri.");
 
       if (mLoader) {
         mLoader->SetHasNoProxies(this, mCacheEntry);
       }
-    } else if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
-      nsAutoCString spec;
-      mURI->GetSpec(spec);
+    } else {
       LOG_MSG_WITH_PARAM(gImgLog,
                          "imgRequest::RemoveProxy no cache entry",
-                         "uri", spec.get());
+                         "uri", mURI);
     }
 
     /* If |aStatus| is a failure code, then cancel the load if it is still in
        progress.  Otherwise, let the load continue, keeping 'this' in the cache
        with no observers.  This way, if a proxy is destroyed without calling
        cancel on it, it won't leak and won't leave a bad pointer in the observer
        list.
      */
@@ -417,17 +407,17 @@ imgRequest::StartDecoding()
 
 bool
 imgRequest::IsDecodeRequested() const
 {
   MutexAutoLock lock(mMutex);
   return mDecodeRequested;
 }
 
-nsresult imgRequest::GetURI(ImageURL** aURI)
+nsresult imgRequest::GetURI(nsIURI** aURI)
 {
   MOZ_ASSERT(aURI);
 
   LOG_FUNC(gImgLog, "imgRequest::GetURI");
 
   if (mURI) {
     *aURI = mURI;
     NS_ADDREF(*aURI);
@@ -983,17 +973,17 @@ struct NewPartResult final
   RefPtr<image::Image> mImage;
   const bool mIsFirstPart;
   bool mSucceeded;
   bool mShouldResetCacheEntry;
 };
 
 static NewPartResult
 PrepareForNewPart(nsIRequest* aRequest, nsIInputStream* aInStr, uint32_t aCount,
-                  ImageURL* aURI, bool aIsMultipart, image::Image* aExistingImage,
+                  nsIURI* aURI, bool aIsMultipart, image::Image* aExistingImage,
                   ProgressTracker* aProgressTracker, uint32_t aInnerWindowId)
 {
   NewPartResult result(aExistingImage);
 
   if (aInStr) {
     mimetype_closure closure;
     closure.newType = &result.mContentType;
 
--- a/image/imgRequest.h
+++ b/image/imgRequest.h
@@ -30,32 +30,30 @@ class nsIApplicationCache;
 class nsIProperties;
 class nsIRequest;
 class nsITimedChannel;
 class nsIURI;
 
 namespace mozilla {
 namespace image {
 class Image;
-class ImageURL;
 class ProgressTracker;
 } // namespace image
 } // namespace mozilla
 
 struct NewPartResult;
 
 class imgRequest final : public nsIStreamListener,
                          public nsIThreadRetargetableStreamListener,
                          public nsIChannelEventSink,
                          public nsIInterfaceRequestor,
                          public nsIAsyncVerifyRedirectCallback
 {
   typedef mozilla::image::Image Image;
   typedef mozilla::image::ImageCacheKey ImageCacheKey;
-  typedef mozilla::image::ImageURL ImageURL;
   typedef mozilla::image::ProgressTracker ProgressTracker;
   typedef mozilla::net::ReferrerPolicy ReferrerPolicy;
 
 public:
   imgRequest(imgLoader* aLoader, const ImageCacheKey& aCacheKey);
 
   NS_DECL_THREADSAFE_ISUPPORTS
   NS_DECL_NSISTREAMLISTENER
@@ -146,17 +144,17 @@ public:
 
   /// Get the ImageCacheKey associated with this request.
   const ImageCacheKey& CacheKey() const { return mCacheKey; }
 
   // Resize the cache entry to 0 if it exists
   void ResetCacheEntry();
 
   // OK to use on any thread.
-  nsresult GetURI(ImageURL** aURI);
+  nsresult GetURI(nsIURI** aURI);
   nsresult GetFinalURI(nsIURI** aURI);
   bool IsScheme(const char* aScheme) const;
   bool IsChrome() const;
   bool IsData() const;
 
   nsresult GetImageErrorCode(void);
 
   /// Returns true if we've received any data.
@@ -230,17 +228,17 @@ private:
   void AdjustPriorityInternal(int32_t aDelta);
 
   // Weak reference to parent loader; this request cannot outlive its owner.
   imgLoader* mLoader;
   nsCOMPtr<nsIRequest> mRequest;
   // The original URI we were loaded with. This is the same as the URI we are
   // keyed on in the cache. We store a string here to avoid off main thread
   // refcounting issues with nsStandardURL.
-  RefPtr<ImageURL> mURI;
+  nsCOMPtr<nsIURI> mURI;
   // The URI of the resource we ended up loading after all redirects, etc.
   nsCOMPtr<nsIURI> mFinalURI;
   // The principal which triggered the load of this image. Generally either
   // the principal of the document the image is being loaded into, or of the
   // stylesheet which specified the image to load. Used when validating for CORS.
   nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
   // The principal of this image.
   nsCOMPtr<nsIPrincipal> mPrincipal;
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -175,17 +175,17 @@ imgRequestProxy::~imgRequestProxy()
   RemoveFromLoadGroup();
   LOG_FUNC(gImgLog, "imgRequestProxy::~imgRequestProxy");
 }
 
 nsresult
 imgRequestProxy::Init(imgRequest* aOwner,
                       nsILoadGroup* aLoadGroup,
                       nsIDocument* aLoadingDocument,
-                      ImageURL* aURI,
+                      nsIURI* aURI,
                       imgINotificationObserver* aObserver)
 {
   MOZ_ASSERT(!GetOwner() && !mListener,
              "imgRequestProxy is already initialized");
 
   LOG_SCOPE_WITH_PARAM(gImgLog, "imgRequestProxy::Init", "request",
                        aOwner);
 
@@ -767,43 +767,31 @@ imgRequestProxy::GetImageErrorCode(nsres
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 imgRequestProxy::GetURI(nsIURI** aURI)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread to convert URI");
-  nsCOMPtr<nsIURI> uri = mURI->ToIURI();
+  nsCOMPtr<nsIURI> uri = mURI;
   uri.forget(aURI);
   return NS_OK;
 }
 
 nsresult
 imgRequestProxy::GetFinalURI(nsIURI** aURI)
 {
   if (!GetOwner()) {
     return NS_ERROR_FAILURE;
   }
 
   return GetOwner()->GetFinalURI(aURI);
 }
 
-nsresult
-imgRequestProxy::GetURI(ImageURL** aURI)
-{
-  if (!mURI) {
-    return NS_ERROR_FAILURE;
-  }
-
-  NS_ADDREF(*aURI = mURI);
-
-  return NS_OK;
-}
-
 NS_IMETHODIMP
 imgRequestProxy::GetNotificationObserver(imgINotificationObserver** aObserver)
 {
   *aObserver = mListener;
   NS_IF_ADDREF(*aObserver);
   return NS_OK;
 }
 
@@ -1090,22 +1078,18 @@ imgRequestProxy::Notify(int32_t aType, c
   nsCOMPtr<imgINotificationObserver> listener(mListener);
 
   listener->Notify(this, aType, aRect);
 }
 
 void
 imgRequestProxy::OnLoadComplete(bool aLastPart)
 {
-  if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
-    nsAutoCString name;
-    GetName(name);
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::OnLoadComplete",
-                        "name", name.get());
-  }
+  LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::OnLoadComplete",
+                      "uri", mURI);
 
   // There's all sorts of stuff here that could kill us (the OnStopRequest call
   // on the listener, the removal from the loadgroup, the release of the
   // listener, etc).  Don't let them do it.
   RefPtr<imgRequestProxy> self(this);
 
   if (!IsOnEventTarget()) {
     DispatchWithTarget(NS_NewRunnableFunction("imgRequestProxy::OnLoadComplete",
--- a/image/imgRequestProxy.h
+++ b/image/imgRequestProxy.h
@@ -37,33 +37,31 @@ class ProxyBehaviour;
 
 namespace mozilla {
 namespace dom {
 class TabGroup;
 }
 
 namespace image {
 class Image;
-class ImageURL;
 class ProgressTracker;
 } // namespace image
 } // namespace mozilla
 
 class imgRequestProxy : public imgIRequest,
                         public mozilla::image::IProgressObserver,
                         public nsISupportsPriority,
                         public nsISecurityInfoProvider,
                         public nsITimedChannel
 {
 protected:
   virtual ~imgRequestProxy();
 
 public:
   typedef mozilla::image::Image Image;
-  typedef mozilla::image::ImageURL ImageURL;
   typedef mozilla::image::ProgressTracker ProgressTracker;
 
   MOZ_DECLARE_REFCOUNTED_TYPENAME(imgRequestProxy)
   NS_DECL_ISUPPORTS
   NS_DECL_IMGIREQUEST
   NS_DECL_NSIREQUEST
   NS_DECL_NSISUPPORTSPRIORITY
   NS_DECL_NSISECURITYINFOPROVIDER
@@ -71,17 +69,17 @@ public:
 
   imgRequestProxy();
 
   // Callers to Init or ChangeOwner are required to call NotifyListener after
   // (although not immediately after) doing so.
   nsresult Init(imgRequest* aOwner,
                 nsILoadGroup* aLoadGroup,
                 nsIDocument* aLoadingDocument,
-                ImageURL* aURI,
+                nsIURI* aURI,
                 imgINotificationObserver* aObserver);
 
   nsresult ChangeOwner(imgRequest* aNewOwner); // this will change mOwner.
                                                // Do not call this if the
                                                // previous owner has already
                                                // sent notifications out!
 
   // Add the request to the load group, if any. This should only be called once
@@ -145,18 +143,16 @@ public:
                      nsIDocument* aLoadingDocument,
                      imgRequestProxy** aClone);
   nsresult Clone(imgINotificationObserver* aObserver,
                  nsIDocument* aLoadingDocument,
                  imgRequestProxy** aClone);
   nsresult GetStaticRequest(nsIDocument* aLoadingDocument,
                             imgRequestProxy** aReturn);
 
-  nsresult GetURI(ImageURL** aURI);
-
 protected:
   friend class mozilla::image::ProgressTracker;
   friend class imgStatusNotifyRunnable;
 
   class imgCancelRunnable;
   friend class imgCancelRunnable;
 
   class imgCancelRunnable : public mozilla::Runnable
@@ -225,17 +221,17 @@ private:
 
   void AddToOwner(nsIDocument* aLoadingDocument);
   void RemoveFromOwner(nsresult aStatus);
 
   nsresult DispatchWithTargetIfAvailable(already_AddRefed<nsIRunnable> aEvent);
   void DispatchWithTarget(already_AddRefed<nsIRunnable> aEvent);
 
   // The URI of our request.
-  RefPtr<ImageURL> mURI;
+  nsCOMPtr<nsIURI> mURI;
 
   // mListener is only promised to be a weak ref (see imgILoader.idl),
   // but we actually keep a strong ref to it until we've seen our
   // first OnStopRequest.
   imgINotificationObserver* MOZ_UNSAFE_REF("Observers must call Cancel() or "
                                            "CancelAndForgetObserver() before "
                                            "they are destroyed") mListener;