Bug 505385 - Part 17: Clean up unused arguments in imgStatusTracker observers, document unclear things, etc. r=joe
authorJosh Matthews <josh@joshmatthews.net>
Fri, 12 Oct 2012 12:11:23 -0400
changeset 110242 96f82111d090fdfeccf343662d40023d43b99d35
parent 110241 90b6d2a44348697568047fcc43e3e3dae5ce6370
child 110243 78f0949318a5214b732aae686a645c8bc6656f02
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewersjoe
bugs505385
milestone19.0a1
Bug 505385 - Part 17: Clean up unused arguments in imgStatusTracker observers, document unclear things, etc. r=joe
image/public/imgIContainerObserver.idl
image/public/imgIDecoderObserver.idl
image/src/Decoder.cpp
image/src/RasterImage.cpp
image/src/VectorImage.cpp
image/src/imgRequestProxy.cpp
image/src/imgRequestProxy.h
image/src/imgStatusTracker.cpp
image/src/imgStatusTracker.h
--- a/image/public/imgIContainerObserver.idl
+++ b/image/public/imgIContainerObserver.idl
@@ -5,25 +5,22 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "nsISupports.idl"
 
 %{C++
 #include "nsRect.h"
 %}
 
-interface imgIContainer;
 interface imgIRequest;
 [ptr] native nsIntRect(nsIntRect);
 
 /**
  * imgIContainerObserver interface
  *
  * @author Stuart Parmenter <pavlov@netscape.com>
  * @version 0.1
  */
-[scriptable, uuid(f01efdb3-4b20-4313-a636-a2aa01a4ef5d)]
+[scriptable, uuid(f4aaf410-e88f-4036-b91c-610c9c11d825)]
 interface imgIContainerObserver : nsISupports
 {
-  [noscript] void frameChanged(in imgIRequest aRequest,
-                               in imgIContainer aContainer,
-                               [const] in nsIntRect aDirtyRect);
+  [noscript] void frameChanged([const] in nsIntRect aDirtyRect);
 };
--- a/image/public/imgIDecoderObserver.idl
+++ b/image/public/imgIDecoderObserver.idl
@@ -38,97 +38,90 @@ interface imgIContainer;
  * all, some, or none of the notifications may fire before the call returns.
  *
  * This interface will be cleaned up in bug 505385.
  *
  * @author Stuart Parmenter <pavlov@netscape.com>
  * @version 0.1
  * @see imagelib2
  */
-[scriptable, uuid(7abf38ca-242b-413a-ab18-80532dd81133)]
+[scriptable, uuid(dad8093d-384b-4923-b83c-351c4e5f9dce)]
 interface imgIDecoderObserver : imgIContainerObserver
 {
   /**
    * Load notification.
    *
    * called at the same time that nsIRequestObserver::onStartRequest would be
    * (used only for observers of imgIRequest objects, which are nsIRequests,
    * not imgIDecoder objects)
    */
-  void onStartRequest(in imgIRequest aRequest);
+  void onStartRequest();
 
   /**
    * Decode notification.
    *
    * Called as soon as the image begins getting decoded. This does not include
    * "header-only" decodes used by decode-on-draw to parse the width/height
    * out of the image. Thus, it is a decode notification only.
    */
-  void onStartDecode(in imgIRequest aRequest);
+  void onStartDecode();
 
   /**
    * Load notification.
    *
    * Called once enough data has been loaded from the network that we were able
    * to parse the width/height from the image. By the time this callback is been
    * called, the size has been set on the container and STATUS_SIZE_AVAILABLE
    * has been set on the associated imgRequest.
    */
-  void onStartContainer(in imgIRequest aRequest, in imgIContainer aContainer);
+  void onStartContainer();
 
   /**
    * Decode notification.
    *
    * called when each frame is created.
    */
-  void onStartFrame(in imgIRequest aRequest, in unsigned long aFrame);
+  void onStartFrame();
 
   /**
    * Decode notification.
    *
    * called when there is more to paint.
    */
-  [noscript] void onDataAvailable(in imgIRequest aRequest, in boolean aCurrentFrame, [const] in nsIntRect aRect);
+  [noscript] void onDataAvailable([const] in nsIntRect aRect);
 
   /**
    * Decode notification.
    *
    * called when a frame is finished decoding.
    */
-  void onStopFrame(in imgIRequest aRequest, in unsigned long aFrame);
+  void onStopFrame();
 
   /**
    * Notification for when an image is known to be animated. This should be
    * fired at the earliest possible time.
    */
-  void onImageIsAnimated(in imgIRequest aRequest);
+  void onImageIsAnimated();
 
   /**
-   * In theory a decode notification, but currently a load notification.
+   * Decode notification.
    *
-   * Ideally this would be called when the decode is complete. Unfortunately,
-   * this is currently the only way to signal decoding errors to consumers,
-   * and the only decoding errors that consumers care about (indeed, the only
-   * ones that they're prepared to hear about) are failures to instantiate the
-   * decoder (<img src="foo.html"> for example). Thus, currently this is just
-   * a companion to onStopDecode to signal success or failure. This will be
-   * revisited in bug 505385. If you're thinking of doing something new with
-   * this, please talk to bholley first.
+   * Called when all decoding has terminated.
    */
-  void onStopDecode(in imgIRequest aRequest, in nsresult status);
+  void onStopDecode(in nsresult status);
 
   /**
    * Load notification.
    *
    * called at the same time that nsIRequestObserver::onStopRequest would be
    * (used only for observers of imgIRequest objects, which are nsIRequests,
    * not imgIDecoder objects)
    */
-  void onStopRequest(in imgIRequest aRequest, in boolean aIsLastPart);
+  void onStopRequest(in boolean aIsLastPart);
 
   /**
    * Called when the decoded image data is discarded. This means that the frames
    * no longer exist in decoded form, and any attempt to access or draw the
    * image will initiate a new series of progressive decode notifications.
    */
-  void onDiscard(in imgIRequest aRequest);
+  void onDiscard();
 
 };
--- a/image/src/Decoder.cpp
+++ b/image/src/Decoder.cpp
@@ -40,17 +40,17 @@ Decoder::~Decoder()
 void
 Decoder::Init()
 {
   // No re-initializing
   NS_ABORT_IF_FALSE(!mInitialized, "Can't re-initialize a decoder!");
 
   // Fire OnStartDecode at init time to support bug 512435
   if (!IsSizeDecode() && mObserver)
-      mObserver->OnStartDecode(nullptr);
+      mObserver->OnStartDecode();
 
   // Implementation-specific initialization
   InitInternal();
   mInitialized = true;
 }
 
 // Initializes a decoder whose aImage and aObserver is already being used by a
 // parent decoder
@@ -119,17 +119,17 @@ Decoder::Finish()
     bool salvage = !HasDecoderError() && mImage.GetNumFrames();
 
     // If we're salvaging, say we finished decoding
     if (salvage)
       mImage.DecodingComplete();
 
     // Fire teardown notifications
     if (mObserver) {
-      mObserver->OnStopDecode(nullptr, salvage ? NS_OK : NS_ERROR_FAILURE);
+      mObserver->OnStopDecode(salvage ? NS_OK : NS_ERROR_FAILURE);
     }
   }
 }
 
 void
 Decoder::FinishSharedDecoder()
 {
   if (!HasError()) {
@@ -161,18 +161,17 @@ Decoder::FlushInvalidations()
 
     mImage.GetWidth(&width);
     mImage.GetHeight(&height);
     nsIntRect mImageBound(0, 0, width, height);
 
     mInvalidRect.Inflate(1);
     mInvalidRect = mInvalidRect.Intersect(mImageBound);
 #endif
-    bool isCurrentFrame = mImage.GetCurrentFrameIndex() == (mFrameCount - 1);
-    mObserver->OnDataAvailable(nullptr, isCurrentFrame, &mInvalidRect);
+    mObserver->OnDataAvailable(&mInvalidRect);
   }
 
   // Clear the invalidation rectangle
   mInvalidRect.SetEmpty();
 }
 
 /*
  * Hook stubs. Override these as necessary in decoder implementations.
@@ -193,17 +192,17 @@ Decoder::PostSize(int32_t aWidth, int32_
   NS_ABORT_IF_FALSE(aWidth >= 0, "Width can't be negative!");
   NS_ABORT_IF_FALSE(aHeight >= 0, "Height can't be negative!");
 
   // Tell the image
   mImage.SetSize(aWidth, aHeight);
 
   // Notify the observer
   if (mObserver)
-    mObserver->OnStartContainer(nullptr, &mImage);
+    mObserver->OnStartContainer();
 }
 
 void
 Decoder::PostFrameStart()
 {
   // We shouldn't already be mid-frame
   NS_ABORT_IF_FALSE(!mInFrame, "Starting new frame but not done with old one!");
 
@@ -219,37 +218,37 @@ Decoder::PostFrameStart()
   // Decoder implementations should only call this method if they successfully
   // appended the frame to the image. So mFrameCount should always match that
   // reported by the Image.
   NS_ABORT_IF_FALSE(mFrameCount == mImage.GetNumFrames(),
                     "Decoder frame count doesn't match image's!");
 
   // Fire notification
   if (mObserver)
-    mObserver->OnStartFrame(nullptr, mFrameCount - 1); // frame # is zero-indexed
+    mObserver->OnStartFrame();
 }
 
 void
 Decoder::PostFrameStop()
 {
   // We should be mid-frame
   NS_ABORT_IF_FALSE(mInFrame, "Stopping frame when we didn't start one!");
 
   // Update our state
   mInFrame = false;
 
   // Flush any invalidations before we finish the frame
   FlushInvalidations();
 
   // Fire notifications
   if (mObserver) {
-    mObserver->OnStopFrame(nullptr, mFrameCount - 1); // frame # is zero-indexed
+    mObserver->OnStopFrame();
     if (mFrameCount > 1 && !mIsAnimated) {
       mIsAnimated = true;
-      mObserver->OnImageIsAnimated(nullptr);
+      mObserver->OnImageIsAnimated();
     }
   }
 }
 
 void
 Decoder::PostInvalidation(nsIntRect& aRect)
 {
   // We should be mid-frame
@@ -272,17 +271,17 @@ Decoder::PostDecodeDone()
   bool isNonPremult = GetDecodeFlags() & DECODER_NO_PREMULTIPLY_ALPHA;
   for (int i = 0; i < frames; i++) {
     mImage.SetFrameAsNonPremult(i, isNonPremult);
   }
 
   // Notify
   mImage.DecodingComplete();
   if (mObserver) {
-    mObserver->OnStopDecode(nullptr, NS_OK);
+    mObserver->OnStopDecode(NS_OK);
   }
 }
 
 void
 Decoder::PostDataError()
 {
   mDataError = true;
 }
--- a/image/src/RasterImage.cpp
+++ b/image/src/RasterImage.cpp
@@ -509,17 +509,17 @@ RasterImage::RequestRefresh(const mozill
     // Notify listeners that our frame has actually changed, but do this only
     // once for all frames that we've now passed (if AdvanceFrame() was called
     // more than once).
     #ifdef DEBUG
       mFramesNotified++;
     #endif
 
     UpdateImageContainer();
-    observer->FrameChanged(nullptr, this, &dirtyRect);
+    observer->FrameChanged(&dirtyRect);
   }
 }
 
 //******************************************************************************
 /* [noscript] imgIContainer extractFrame(uint32_t aWhichFrame,
  *                                       [const] in nsIntRect aRegion,
  *                                       in uint32_t aFlags); */
 NS_IMETHODIMP
@@ -1495,17 +1495,17 @@ RasterImage::ResetAnimation()
   UpdateImageContainer();
 
   // Note - We probably want to kick off a redecode somewhere around here when
   // we fix bug 500402.
 
   // Update display if we were animating before
   nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(mObserver));
   if (mAnimating && observer)
-    observer->FrameChanged(nullptr, this, &(mAnim->firstFrameRefreshArea));
+    observer->FrameChanged(&(mAnim->firstFrameRefreshArea));
 
   if (ShouldAnimate()) {
     StartAnimation();
     // The animation may not have been running before, if mAnimationFinished
     // was false (before we changed it to true in this function). So, mark the
     // animation as running.
     mAnimating = true;
   }
@@ -2279,17 +2279,17 @@ RasterImage::Discard(bool force)
   mFrames.Clear();
 
   // Flag that we no longer have decoded frames for this image
   mDecoded = false;
 
   // Notify that we discarded
   nsCOMPtr<imgIDecoderObserver> observer(do_QueryReferent(mObserver));
   if (observer)
-    observer->OnDiscard(nullptr);
+    observer->OnDiscard();
 
   if (force)
     DiscardTracker::Remove(&mDiscardTrackerNode);
 
   // Log
   PR_LOG(gCompressedImageAccountingLog, PR_LOG_DEBUG,
          ("CompressedImageAccounting: discarded uncompressed image "
           "data from RasterImage %p (%s) - %d frames (cached count: %d); "
@@ -2769,17 +2769,17 @@ RasterImage::DrawWorker::Run()
     if (request->stopped) {
       ScaleRequest::Stop(request->image);
     }
     nsCOMPtr<imgIContainerObserver> observer(do_QueryReferent(request->image->mObserver));
     if (request->done && observer) {
       imgFrame *scaledFrame = request->dstFrame.get();
       scaledFrame->ImageUpdated(scaledFrame->GetRect());
       nsIntRect frameRect = request->srcFrame->GetRect();
-      observer->FrameChanged(nullptr, request->image, &frameRect);
+      observer->FrameChanged(&frameRect);
     }
   }
 
   return NS_OK;
 }
 
 void
 RasterImage::DrawWorker::RequestDraw(RasterImage* aImg)
--- a/image/src/VectorImage.cpp
+++ b/image/src/VectorImage.cpp
@@ -676,21 +676,21 @@ VectorImage::OnStopRequest(nsIRequest* a
 
   // Start listening to our image for rendering updates
   mRenderingObserver = new SVGRootRenderingObserver(mSVGDocumentWrapper, this);
 
   // Tell *our* observers that we're done loading
   nsCOMPtr<imgIDecoderObserver> observer = do_QueryReferent(mObserver);
   if (observer) {
     // NOTE: This signals that width/height are available.
-    observer->OnStartContainer(nullptr, this);
+    observer->OnStartContainer();
 
-    observer->FrameChanged(nullptr, this, &nsIntRect::GetMaxSizedIntRect());
-    observer->OnStopFrame(nullptr, 0);
-    observer->OnStopDecode(nullptr, NS_OK);
+    observer->FrameChanged(&nsIntRect::GetMaxSizedIntRect());
+    observer->OnStopFrame();
+    observer->OnStopDecode(NS_OK);
   }
   EvaluateAnimation();
 
   return rv;
 }
 
 //------------------------------------------------------------------------------
 // nsIStreamListener method
@@ -717,19 +717,19 @@ VectorImage::OnDataAvailable(nsIRequest*
 void
 VectorImage::InvalidateObserver()
 {
   if (!mObserver)
     return;
 
   nsCOMPtr<imgIContainerObserver> containerObs(do_QueryReferent(mObserver));
   if (containerObs) {
-    containerObs->FrameChanged(nullptr, this, &nsIntRect::GetMaxSizedIntRect());
+    containerObs->FrameChanged(&nsIntRect::GetMaxSizedIntRect());
   }
 
   nsCOMPtr<imgIDecoderObserver> decoderObs(do_QueryReferent(mObserver));
   if (decoderObs) {
-    decoderObs->OnStopFrame(nullptr, imgIContainer::FRAME_CURRENT);
+    decoderObs->OnStopFrame();
   }
 }
 
 } // namespace image
 } // namespace mozilla
--- a/image/src/imgRequestProxy.cpp
+++ b/image/src/imgRequestProxy.cpp
@@ -607,18 +607,17 @@ NS_IMETHODIMP imgRequestProxy::GetHasTra
     *hasData = mOwner->HasTransferredData();
   } else {
     // The safe thing to do is to claim we have data
     *hasData = true;
   }
   return NS_OK;
 }
 
-void imgRequestProxy::FrameChanged(imgIContainer *container,
-                                   const nsIntRect *dirtyRect)
+void imgRequestProxy::FrameChanged(const nsIntRect *dirtyRect)
 {
   LOG_FUNC(gImgLog, "imgRequestProxy::FrameChanged");
 
   if (mListener && !mCanceled) {
     // Hold a ref to the listener while we call it, just in case.
     nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
     mListener->Notify(this, imgINotificationObserver::FRAME_CHANGED, dirtyRect);
   }
@@ -632,51 +631,51 @@ void imgRequestProxy::OnStartDecode()
 
   if (mListener && !mCanceled) {
     // Hold a ref to the listener while we call it, just in case.
     nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
     mListener->Notify(this, imgINotificationObserver::START_DECODE, nullptr);
   }
 }
 
-void imgRequestProxy::OnStartContainer(imgIContainer *image)
+void imgRequestProxy::OnStartContainer()
 {
   LOG_FUNC(gImgLog, "imgRequestProxy::OnStartContainer");
 
   if (mListener && !mCanceled && !mSentStartContainer) {
     // Hold a ref to the listener while we call it, just in case.
     nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
     mListener->Notify(this, imgINotificationObserver::START_CONTAINER, nullptr);
     mSentStartContainer = true;
   }
 }
 
-void imgRequestProxy::OnStartFrame(uint32_t frame)
+void imgRequestProxy::OnStartFrame()
 {
   LOG_FUNC(gImgLog, "imgRequestProxy::OnStartFrame");
 
   if (mListener && !mCanceled) {
     // Hold a ref to the listener while we call it, just in case.
     nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
     mListener->Notify(this, imgINotificationObserver::START_FRAME, nullptr);
   }
 }
 
-void imgRequestProxy::OnDataAvailable(bool aCurrentFrame, const nsIntRect * rect)
+void imgRequestProxy::OnDataAvailable(const nsIntRect * rect)
 {
   LOG_FUNC(gImgLog, "imgRequestProxy::OnDataAvailable");
 
   if (mListener && !mCanceled) {
     // Hold a ref to the listener while we call it, just in case.
     nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
     mListener->Notify(this, imgINotificationObserver::DATA_AVAILABLE, rect);
   }
 }
 
-void imgRequestProxy::OnStopFrame(uint32_t frame)
+void imgRequestProxy::OnStopFrame()
 {
   LOG_FUNC(gImgLog, "imgRequestProxy::OnStopFrame");
 
   if (mListener && !mCanceled) {
     // Hold a ref to the listener while we call it, just in case.
     nsCOMPtr<imgINotificationObserver> kungFuDeathGrip(mListener);
     mListener->Notify(this, imgINotificationObserver::STOP_FRAME, nullptr);
   }
--- a/image/src/imgRequestProxy.h
+++ b/image/src/imgRequestProxy.h
@@ -128,27 +128,26 @@ protected:
   };
 
   // The following notification functions are protected to ensure that (friend
   // class) imgStatusTracker is the only class allowed to send us
   // notifications.
 
   /* non-virtual imgIDecoderObserver methods */
   void OnStartDecode     ();
-  void OnStartContainer  (imgIContainer *aContainer);
-  void OnStartFrame      (uint32_t aFrame);
-  void OnDataAvailable   (bool aCurrentFrame, const nsIntRect * aRect);
-  void OnStopFrame       (uint32_t aFrame);
+  void OnStartContainer  ();
+  void OnStartFrame      ();
+  void OnDataAvailable   (const nsIntRect * aRect);
+  void OnStopFrame       ();
   void OnStopDecode      ();
   void OnDiscard         ();
   void OnImageIsAnimated ();
 
   /* non-virtual imgIContainerObserver methods */
-  void FrameChanged(imgIContainer *aContainer,
-                    const nsIntRect *aDirtyRect);
+  void FrameChanged(const nsIntRect *aDirtyRect);
 
   /* non-virtual sort-of-nsIRequestObserver methods */
   void OnStartRequest();
   void OnStopRequest(bool aLastPart);
 
   /* non-virtual imgIOnloadBlocker methods */
   void BlockOnload();
   void UnblockOnload();
@@ -251,14 +250,13 @@ protected:
   // Our image. We have to hold a strong reference here, because that's normally
   // the job of the underlying request.
   nsRefPtr<mozilla::image::Image> mImage;
 
   // Our principal. We have to cache it, rather than accessing the underlying
   // request on-demand, because static proxies don't have an underlying request.
   nsCOMPtr<nsIPrincipal> mPrincipal;
 
-private:
   mozilla::image::Image* GetImage() const MOZ_OVERRIDE;
   using imgRequestProxy::GetImage;
 };
 
 #endif // imgRequestProxy_h__
--- a/image/src/imgStatusTracker.cpp
+++ b/image/src/imgStatusTracker.cpp
@@ -22,47 +22,42 @@ using namespace mozilla::image;
 
 NS_IMPL_ISUPPORTS3(imgStatusTrackerObserver,
                    imgIDecoderObserver,
                    imgIContainerObserver,
                    nsISupportsWeakReference)
 
 /** imgIContainerObserver methods **/
 
-/* [noscript] void frameChanged (in imgIRequest request,
-   in imgIContainer container,
-   in nsIntRect dirtyRect); */
-NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(imgIRequest *request,
-                                                     imgIContainer *container,
-                                                     const nsIntRect *dirtyRect)
+/* [noscript] void frameChanged (in nsIntRect dirtyRect); */
+NS_IMETHODIMP imgStatusTrackerObserver::FrameChanged(const nsIntRect *dirtyRect)
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::FrameChanged");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "FrameChanged callback before we've created our image");
 
-  mTracker->RecordFrameChanged(container, dirtyRect);
+  mTracker->RecordFrameChanged(dirtyRect);
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
-    mTracker->SendFrameChanged(iter.GetNext(), container, dirtyRect);
+    mTracker->SendFrameChanged(iter.GetNext(), dirtyRect);
   }
 
   return NS_OK;
 }
 
 /** imgIDecoderObserver methods **/
 
-/* void onStartDecode (in imgIRequest request); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode(imgIRequest *request)
+/* void onStartDecode (); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnStartDecode()
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartDecode");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStartDecode callback before we've created our image");
 
-
   mTracker->RecordStartDecode();
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
     mTracker->SendStartDecode(iter.GetNext());
   }
 
   if (!mTracker->GetRequest()->GetMultipart()) {
@@ -82,94 +77,85 @@ NS_IMETHODIMP imgStatusTrackerObserver::
      The cache entry's size therefore needs to be reset to 0 here.  If we do not do this,
      the code in imgStatusTrackerObserver::OnStopFrame will continue to increase the data size cumulatively.
   */
   mTracker->GetRequest()->ResetCacheEntry();
 
   return NS_OK;
 }
 
-NS_IMETHODIMP imgStatusTrackerObserver::OnStartRequest(imgIRequest *aRequest)
+NS_IMETHODIMP imgStatusTrackerObserver::OnStartRequest()
 {
   NS_NOTREACHED("imgRequest(imgIDecoderObserver)::OnStartRequest");
   return NS_OK;
 }
 
-/* void onStartContainer (in imgIRequest request, in imgIContainer image); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnStartContainer(imgIRequest *request, imgIContainer *image)
+/* void onStartContainer (); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnStartContainer()
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartContainer");
 
-  NS_ASSERTION(image, "imgStatusTrackerObserver::OnStartContainer called with a null image!");
-  if (!image) return NS_ERROR_UNEXPECTED;
-
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStartContainer callback before we've created our image");
-  NS_ABORT_IF_FALSE(image == mTracker->GetImage(),
-                    "OnStartContainer callback from an image we don't own");
-  mTracker->RecordStartContainer(image);
+  mTracker->RecordStartContainer(mTracker->GetImage());
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
-    mTracker->SendStartContainer(iter.GetNext(), image);
+    mTracker->SendStartContainer(iter.GetNext());
   }
 
   return NS_OK;
 }
 
-/* void onStartFrame (in imgIRequest request, in unsigned long frame); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnStartFrame(imgIRequest *request,
-                                       uint32_t frame)
+/* void onStartFrame (); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnStartFrame()
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStartFrame");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStartFrame callback before we've created our image");
 
-  mTracker->RecordStartFrame(frame);
+  mTracker->RecordStartFrame();
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
-    mTracker->SendStartFrame(iter.GetNext(), frame);
+    mTracker->SendStartFrame(iter.GetNext());
   }
 
   return NS_OK;
 }
 
-/* [noscript] void onDataAvailable (in imgIRequest request, in boolean aCurrentFrame, [const] in nsIntRect rect); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnDataAvailable(imgIRequest *request,
-                                          bool aCurrentFrame,
-                                          const nsIntRect * rect)
+/* [noscript] void onDataAvailable ([const] in nsIntRect rect); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnDataAvailable(const nsIntRect * rect)
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnDataAvailable");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnDataAvailable callback before we've created our image");
 
-  mTracker->RecordDataAvailable(aCurrentFrame, rect);
+  mTracker->RecordDataAvailable();
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
-    mTracker->SendDataAvailable(iter.GetNext(), aCurrentFrame, rect);
+    mTracker->SendDataAvailable(iter.GetNext(), rect);
   }
 
   return NS_OK;
 }
 
-/* void onStopFrame (in imgIRequest request, in unsigned long frame); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnStopFrame(imgIRequest *request,
-                                      uint32_t frame)
+/* void onStopFrame (); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnStopFrame()
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStopFrame");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStopFrame callback before we've created our image");
 
-  mTracker->RecordStopFrame(frame);
+  mTracker->RecordStopFrame();
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
-    mTracker->SendStopFrame(iter.GetNext(), frame);
+    mTracker->SendStopFrame(iter.GetNext());
   }
 
   mTracker->MaybeUnblockOnload();
 
   return NS_OK;
 }
 
 static void
@@ -181,19 +167,18 @@ FireFailureNotification(imgRequest* aReq
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (os) {
     nsCOMPtr<nsIURI> uri;
     aRequest->GetURI(getter_AddRefs(uri));
     os->NotifyObservers(uri, "net:failed-to-process-uri-content", nullptr);
   }
 }
 
-/* void onStopDecode (in imgIRequest request, in nsresult status, in wstring statusArg); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnStopDecode(imgIRequest *aRequest,
-                                                     nsresult aStatus)
+/* void onStopDecode (in nsresult status); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnStopDecode(nsresult aStatus)
 {
   LOG_SCOPE(gImgLog, "imgStatusTrackerObserver::OnStopDecode");
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnStopDecode callback before we've created our image");
 
   // We finished the decode, and thus have the decoded frames. Update the cache
   // entry size to take this into account.
   mTracker->GetRequest()->UpdateCacheEntrySize();
@@ -213,25 +198,24 @@ NS_IMETHODIMP imgStatusTrackerObserver::
 
   if (NS_FAILED(aStatus) && !preexistingError) {
     FireFailureNotification(mTracker->GetRequest());
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP imgStatusTrackerObserver::OnStopRequest(imgIRequest *aRequest,
-                                        bool aLastPart)
+NS_IMETHODIMP imgStatusTrackerObserver::OnStopRequest(bool aLastPart)
 {
   NS_NOTREACHED("imgRequest(imgIDecoderObserver)::OnStopRequest");
   return NS_OK;
 }
 
-/* void onDiscard (in imgIRequest request); */
-NS_IMETHODIMP imgStatusTrackerObserver::OnDiscard(imgIRequest *aRequest)
+/* void onDiscard (); */
+NS_IMETHODIMP imgStatusTrackerObserver::OnDiscard()
 {
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnDiscard callback before we've created our image");
 
   mTracker->RecordDiscard();
 
   // Update the cache entry size, since we just got rid of frame data
   mTracker->GetRequest()->UpdateCacheEntrySize();
@@ -239,42 +223,32 @@ NS_IMETHODIMP imgStatusTrackerObserver::
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
     mTracker->SendDiscard(iter.GetNext());
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP imgStatusTrackerObserver::OnImageIsAnimated(imgIRequest *aRequest)
+NS_IMETHODIMP imgStatusTrackerObserver::OnImageIsAnimated()
 {
   NS_ABORT_IF_FALSE(mTracker->GetImage(),
                     "OnImageIsAnimated callback before we've created our image");
   mTracker->RecordImageIsAnimated();
 
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mTracker->mConsumers);
   while (iter.HasMore()) {
     mTracker->SendImageIsAnimated(iter.GetNext());
   }
 
   return NS_OK;
 }
 
 // imgStatusTracker methods
 
-static nsresult
-GetResultFromImageStatus(uint32_t aStatus)
-{
-  if (aStatus & imgIRequest::STATUS_ERROR)
-    return NS_IMAGELIB_ERROR_FAILURE;
-  if (aStatus & imgIRequest::STATUS_LOAD_COMPLETE)
-    return NS_IMAGELIB_SUCCESS_LOAD_FINISHED;
-  return NS_OK;
-}
-
 imgStatusTracker::imgStatusTracker(Image* aImage, imgRequest* aRequest)
   : mImage(aImage),
     mRequest(aRequest),
     mState(0),
     mImageStatus(imgIRequest::STATUS_NONE),
     mHadLastPart(false),
     mBlockingOnload(false),
     mTrackerObserver(new imgStatusTrackerObserver(this))
@@ -439,46 +413,43 @@ imgStatusTracker::SyncNotify(imgRequestP
   nsCOMPtr<imgIRequest> kungFuDeathGrip(proxy);
 
   // OnStartRequest
   if (mState & stateRequestStarted)
     proxy->OnStartRequest();
 
   // OnStartContainer
   if (mState & stateHasSize)
-    proxy->OnStartContainer(mImage);
+    proxy->OnStartContainer();
 
   // OnStartDecode
   if (mState & stateDecodeStarted)
     proxy->OnStartDecode();
 
   // BlockOnload
   if (mState & stateBlockingOnload)
     proxy->BlockOnload();
 
   if (mImage) {
     int16_t imageType = mImage->GetType();
     // Send frame messages (OnStartFrame, OnDataAvailable, OnStopFrame)
     if (imageType == imgIContainer::TYPE_VECTOR ||
         static_cast<RasterImage*>(mImage)->GetNumFrames() > 0) {
 
-      uint32_t frame = (imageType == imgIContainer::TYPE_VECTOR) ?
-        0 : static_cast<RasterImage*>(mImage)->GetCurrentFrameIndex();
-
-      proxy->OnStartFrame(frame);
+      proxy->OnStartFrame();
 
       // OnDataAvailable
       // XXX - Should only send partial rects here, but that needs to
       // wait until we fix up the observer interface
       nsIntRect r;
       mImage->GetCurrentFrameRect(r);
-      proxy->OnDataAvailable(frame, &r);
+      proxy->OnDataAvailable(&r);
 
       if (mState & stateFrameStopped)
-        proxy->OnStopFrame(frame);
+        proxy->OnStopFrame();
     }
 
     // OnImageIsAnimated
     bool isAnimated = false;
 
     nsresult rv = mImage->GetAnimated(&isAnimated);
     if (NS_SUCCEEDED(rv) && isAnimated) {
       proxy->OnImageIsAnimated();
@@ -496,16 +467,18 @@ imgStatusTracker::SyncNotify(imgRequestP
 }
 
 void
 imgStatusTracker::EmulateRequestFinished(imgRequestProxy* aProxy,
                                          nsresult aStatus)
 {
   nsCOMPtr<imgIRequest> kungFuDeathGrip(aProxy);
 
+  // In certain cases the request might not have started yet.
+  // We still need to fulfill the contract.
   if (!(mState & stateRequestStarted)) {
     aProxy->OnStartRequest();
   }
 
   if (mState & stateBlockingOnload) {
     aProxy->UnblockOnload();
   }
 
@@ -515,23 +488,22 @@ imgStatusTracker::EmulateRequestFinished
 }
 
 void
 imgStatusTracker::AddConsumer(imgRequestProxy* aConsumer)
 {
   mConsumers.AppendElementUnlessExists(aConsumer);
 }
 
-// XXX - The two argument should go away.
+// XXX - The last argument should go away.
 bool
 imgStatusTracker::RemoveConsumer(imgRequestProxy* aConsumer, nsresult aStatus)
 {
   // Remove the proxy from the list.
   bool removed = mConsumers.RemoveElement(aConsumer);
-  //MOZ_NONFATAL_ASSERT(removed, "Trying to remove a consumer we don't have");
 
   // Consumers can get confused if they don't get all the proper teardown
   // notifications. Part ways on good terms.
   if (removed)
     EmulateRequestFinished(aConsumer, aStatus);
   return removed;
 }
 
@@ -581,68 +553,68 @@ imgStatusTracker::RecordStartContainer(i
                     "RecordStartContainer called before we have an Image");
   NS_ABORT_IF_FALSE(mImage == aContainer,
                     "RecordStartContainer called with wrong Image");
   mState |= stateHasSize;
   mImageStatus |= imgIRequest::STATUS_SIZE_AVAILABLE;
 }
 
 void
-imgStatusTracker::SendStartContainer(imgRequestProxy* aProxy, imgIContainer* aContainer)
+imgStatusTracker::SendStartContainer(imgRequestProxy* aProxy)
 {
   if (!aProxy->NotificationsDeferred())
-    aProxy->OnStartContainer(aContainer);
+    aProxy->OnStartContainer();
 }
 
 void
-imgStatusTracker::RecordStartFrame(uint32_t aFrame)
+imgStatusTracker::RecordStartFrame()
 {
   NS_ABORT_IF_FALSE(mImage, "RecordStartFrame called before we have an Image");
   // no bookkeeping necessary here - this is implied by imgIContainer's number
   // of frames
 }
 
 void
-imgStatusTracker::SendStartFrame(imgRequestProxy* aProxy, uint32_t aFrame)
+imgStatusTracker::SendStartFrame(imgRequestProxy* aProxy)
 {
   if (!aProxy->NotificationsDeferred())
-    aProxy->OnStartFrame(aFrame);
+    aProxy->OnStartFrame();
 }
 
 void
-imgStatusTracker::RecordDataAvailable(bool aCurrentFrame, const nsIntRect* aRect)
+imgStatusTracker::RecordDataAvailable()
 {
   NS_ABORT_IF_FALSE(mImage,
                     "RecordDataAvailable called before we have an Image");
   // no bookkeeping necessary here - this is implied by imgIContainer's
   // number of frames and frame rect
 }
 
 void
-imgStatusTracker::SendDataAvailable(imgRequestProxy* aProxy, bool aCurrentFrame,
-                                         const nsIntRect* aRect)
+imgStatusTracker::SendDataAvailable(imgRequestProxy* aProxy,
+                                    const nsIntRect* aRect)
 {
   if (!aProxy->NotificationsDeferred())
-    aProxy->OnDataAvailable(aCurrentFrame, aRect);
+    aProxy->OnDataAvailable(aRect);
 }
 
 
 void
-imgStatusTracker::RecordStopFrame(uint32_t aFrame)
+imgStatusTracker::RecordStopFrame()
 {
   NS_ABORT_IF_FALSE(mImage, "RecordStopFrame called before we have an Image");
   mState |= stateFrameStopped;
   mImageStatus |= imgIRequest::STATUS_FRAME_COMPLETE;
 }
 
 void
-imgStatusTracker::SendStopFrame(imgRequestProxy* aProxy, uint32_t aFrame)
+imgStatusTracker::SendStopFrame(imgRequestProxy* aProxy)
 {
   if (!aProxy->NotificationsDeferred())
-    aProxy->OnStopFrame(aFrame);
+    aProxy->OnStopFrame();
 }
 
 void
 imgStatusTracker::RecordStopDecode(nsresult aStatus)
 {
   NS_ABORT_IF_FALSE(mImage,
                     "RecordStopDecode called before we have an Image");
   mState |= stateDecodeStopped;
@@ -650,17 +622,18 @@ imgStatusTracker::RecordStopDecode(nsres
   if (NS_SUCCEEDED(aStatus) && mImageStatus != imgIRequest::STATUS_ERROR)
     mImageStatus |= imgIRequest::STATUS_DECODE_COMPLETE;
   // If we weren't successful, clear all success status bits and set error.
   else
     mImageStatus = imgIRequest::STATUS_ERROR;
 }
 
 void
-imgStatusTracker::SendStopDecode(imgRequestProxy* aProxy, nsresult aStatus)
+imgStatusTracker::SendStopDecode(imgRequestProxy* aProxy,
+                                 nsresult aStatus)
 {
   if (!aProxy->NotificationsDeferred())
     aProxy->OnStopDecode();
 }
 
 void
 imgStatusTracker::RecordDiscard()
 {
@@ -698,31 +671,30 @@ void
 imgStatusTracker::SendDiscard(imgRequestProxy* aProxy)
 {
   if (!aProxy->NotificationsDeferred())
     aProxy->OnDiscard();
 }
 
 /* non-virtual imgIContainerObserver methods */
 void
-imgStatusTracker::RecordFrameChanged(imgIContainer* aContainer,
-                                     const nsIntRect* aDirtyRect)
+imgStatusTracker::RecordFrameChanged(const nsIntRect* aDirtyRect)
 {
   NS_ABORT_IF_FALSE(mImage,
                     "RecordFrameChanged called before we have an Image");
   // no bookkeeping necessary here - this is only for in-frame updates, which we
   // don't fire while we're recording
 }
 
 void
-imgStatusTracker::SendFrameChanged(imgRequestProxy* aProxy, imgIContainer* aContainer,
+imgStatusTracker::SendFrameChanged(imgRequestProxy* aProxy,
                                    const nsIntRect* aDirtyRect)
 {
   if (!aProxy->NotificationsDeferred())
-    aProxy->FrameChanged(aContainer, aDirtyRect);
+    aProxy->FrameChanged(aDirtyRect);
 }
 
 /* non-virtual sort-of-nsIRequestObserver methods */
 void
 imgStatusTracker::RecordStartRequest()
 {
   // We're starting a new load, so clear any status and state bits indicating
   // load/decode
@@ -751,38 +723,42 @@ imgStatusTracker::OnStartRequest()
   RecordStartRequest();
   nsTObserverArray<imgRequestProxy*>::ForwardIterator iter(mConsumers);
   while (iter.HasMore()) {
     SendStartRequest(iter.GetNext());
   }
 }
 
 void
-imgStatusTracker::RecordStopRequest(bool aLastPart, nsresult aStatus)
+imgStatusTracker::RecordStopRequest(bool aLastPart,
+                                    nsresult aStatus)
 {
   mHadLastPart = aLastPart;
   mState |= stateRequestStopped;
 
   // If we were successful in loading, note that the image is complete.
   if (NS_SUCCEEDED(aStatus) && mImageStatus != imgIRequest::STATUS_ERROR)
     mImageStatus |= imgIRequest::STATUS_LOAD_COMPLETE;
   else
     mImageStatus = imgIRequest::STATUS_ERROR;
 }
 
 void
-imgStatusTracker::SendStopRequest(imgRequestProxy* aProxy, bool aLastPart, nsresult aStatus)
+imgStatusTracker::SendStopRequest(imgRequestProxy* aProxy,
+                                  bool aLastPart,
+                                  nsresult aStatus)
 {
   if (!aProxy->NotificationsDeferred()) {
     aProxy->OnStopRequest(aLastPart);
   }
 }
 
 void
-imgStatusTracker::OnStopRequest(bool aLastPart, nsresult aStatus)
+imgStatusTracker::OnStopRequest(bool aLastPart,
+                                nsresult aStatus)
 {
   bool preexistingError = mImageStatus == imgIRequest::STATUS_ERROR;
 
   RecordStopRequest(aLastPart, aStatus);
   /* notify the kids */
   nsTObserverArray<imgRequestProxy*>::ForwardIterator srIter(mConsumers);
   while (srIter.HasMore()) {
     SendStopRequest(srIter.GetNext(), aLastPart, aStatus);
--- a/image/src/imgStatusTracker.h
+++ b/image/src/imgStatusTracker.h
@@ -147,35 +147,33 @@ public:
   // Shorthand for recording all the decode notifications: StartDecode,
   // StartFrame, DataAvailable, StopFrame, StopDecode.
   void RecordDecoded();
 
   /* non-virtual imgIDecoderObserver methods */
   void RecordStartDecode();
   void SendStartDecode(imgRequestProxy* aProxy);
   void RecordStartContainer(imgIContainer* aContainer);
-  void SendStartContainer(imgRequestProxy* aProxy, imgIContainer* aContainer);
-  void RecordStartFrame(uint32_t aFrame);
-  void SendStartFrame(imgRequestProxy* aProxy, uint32_t aFrame);
-  void RecordDataAvailable(bool aCurrentFrame, const nsIntRect* aRect);
-  void SendDataAvailable(imgRequestProxy* aProxy, bool aCurrentFrame, const nsIntRect* aRect);
-  void RecordStopFrame(uint32_t aFrame);
-  void SendStopFrame(imgRequestProxy* aProxy, uint32_t aFrame);
+  void SendStartContainer(imgRequestProxy* aProxy);
+  void RecordStartFrame();
+  void SendStartFrame(imgRequestProxy* aProxy);
+  void RecordDataAvailable();
+  void SendDataAvailable(imgRequestProxy* aProxy, const nsIntRect* aRect);
+  void RecordStopFrame();
+  void SendStopFrame(imgRequestProxy* aProxy);
   void RecordStopDecode(nsresult statusg);
   void SendStopDecode(imgRequestProxy* aProxy, nsresult aStatus);
   void RecordDiscard();
   void SendDiscard(imgRequestProxy* aProxy);
   void RecordImageIsAnimated();
   void SendImageIsAnimated(imgRequestProxy *aProxy);
 
   /* non-virtual imgIContainerObserver methods */
-  void RecordFrameChanged(imgIContainer* aContainer,
-                          const nsIntRect* aDirtyRect);
-  void SendFrameChanged(imgRequestProxy* aProxy, imgIContainer* aContainer,
-                        const nsIntRect* aDirtyRect);
+  void RecordFrameChanged(const nsIntRect* aDirtyRect);
+  void SendFrameChanged(imgRequestProxy* aProxy, const nsIntRect* aDirtyRect);
 
   /* non-virtual sort-of-nsIRequestObserver methods */
   void RecordStartRequest();
   void SendStartRequest(imgRequestProxy* aProxy);
   void RecordStopRequest(bool aLastPart, nsresult aStatus);
   void SendStopRequest(imgRequestProxy* aProxy, bool aLastPart, nsresult aStatus);
 
   void OnStartRequest();