Bug 1404422 - Part 4. Remove imgIOnloadBlocker and related from tree as redundant. r=tnikkel
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 01 Nov 2017 06:59:10 -0400
changeset 389634 f24a18bffbc70de57437b69fcd9e36734d252199
parent 389633 5c766b0509d52fd217c00596af227a1758c73370
child 389635 8fb7879b388f48c66712e23fd69bc8919436b834
push id32789
push userarchaeopteryx@coole-files.de
push dateWed, 01 Nov 2017 21:55:42 +0000
treeherdermozilla-central@e81094853e1d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1404422
milestone58.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 1404422 - Part 4. Remove imgIOnloadBlocker and related from tree as redundant. r=tnikkel
dom/base/nsGenConImageContent.cpp
dom/base/nsImageLoadingContent.cpp
dom/base/nsImageLoadingContent.h
dom/html/HTMLEmbedElement.cpp
dom/html/HTMLImageElement.cpp
dom/html/HTMLImageElement.h
dom/html/HTMLInputElement.cpp
dom/html/HTMLObjectElement.cpp
dom/svg/SVGFEImageElement.cpp
dom/svg/SVGImageElement.cpp
image/IProgressObserver.h
image/MultipartImage.cpp
image/MultipartImage.h
image/ProgressTracker.cpp
image/ProgressTracker.h
image/RasterImage.cpp
image/VectorImage.cpp
image/imgIOnloadBlocker.idl
image/imgRequest.cpp
image/imgRequestProxy.cpp
image/imgRequestProxy.h
image/moz.build
layout/generic/nsBulletFrame.cpp
layout/generic/nsBulletFrame.h
layout/style/ImageLoader.cpp
layout/style/ImageLoader.h
layout/style/nsCSSDataBlock.h
layout/xul/nsImageBoxFrame.cpp
layout/xul/nsImageBoxFrame.h
--- a/dom/base/nsGenConImageContent.cpp
+++ b/dom/base/nsGenConImageContent.cpp
@@ -65,18 +65,17 @@ private:
 
 public:
   NS_DECL_ISUPPORTS_INHERITED
 };
 
 NS_IMPL_ISUPPORTS_INHERITED(nsGenConImageContent,
                             nsXMLElement,
                             nsIImageLoadingContent,
-                            imgINotificationObserver,
-                            imgIOnloadBlocker)
+                            imgINotificationObserver)
 
 nsresult
 NS_NewGenConImageContent(nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
                          imgRequestProxy* aImageRequest)
 {
   NS_PRECONDITION(aImageRequest, "Must have request!");
   nsGenConImageContent *it = new nsGenConImageContent(aNodeInfo);
   NS_ADDREF(*aResult = it);
--- a/dom/base/nsImageLoadingContent.cpp
+++ b/dom/base/nsImageLoadingContent.cpp
@@ -838,62 +838,16 @@ nsImageLoadingContent::ForceReload(bool 
     notify.Construct() = aNotify;
   }
 
   ErrorResult result;
   ForceReload(notify, result);
   return result.StealNSResult();
 }
 
-NS_IMETHODIMP
-nsImageLoadingContent::BlockOnload(imgIRequest* aRequest)
-{
-  if (aRequest == mCurrentRequest) {
-    NS_ASSERTION(!(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD),
-                 "Double BlockOnload!?");
-    mCurrentRequestFlags |= REQUEST_BLOCKS_ONLOAD;
-  } else if (aRequest == mPendingRequest) {
-    NS_ASSERTION(!(mPendingRequestFlags & REQUEST_BLOCKS_ONLOAD),
-                 "Double BlockOnload!?");
-    mPendingRequestFlags |= REQUEST_BLOCKS_ONLOAD;
-  } else {
-    return NS_OK;
-  }
-
-  nsIDocument* doc = GetOurCurrentDoc();
-  if (doc) {
-    doc->BlockOnload();
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsImageLoadingContent::UnblockOnload(imgIRequest* aRequest)
-{
-  if (aRequest == mCurrentRequest) {
-    NS_ASSERTION(mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD,
-                 "Double UnblockOnload!?");
-    mCurrentRequestFlags &= ~REQUEST_BLOCKS_ONLOAD;
-  } else if (aRequest == mPendingRequest) {
-    NS_ASSERTION(mPendingRequestFlags & REQUEST_BLOCKS_ONLOAD,
-                 "Double UnblockOnload!?");
-    mPendingRequestFlags &= ~REQUEST_BLOCKS_ONLOAD;
-  } else {
-    return NS_OK;
-  }
-
-  nsIDocument* doc = GetOurCurrentDoc();
-  if (doc) {
-    doc->UnblockOnload(false);
-  }
-
-  return NS_OK;
-}
-
 /*
  * Non-interface methods
  */
 
 nsresult
 nsImageLoadingContent::LoadImage(const nsAString& aNewURI,
                                  bool aForce,
                                  bool aNotify,
@@ -1602,34 +1556,28 @@ nsImageLoadingContent::BindToTree(nsIDoc
 {
   // We may be entering the document, so if our image should be tracked,
   // track it.
   if (!aDocument)
     return;
 
   TrackImage(mCurrentRequest);
   TrackImage(mPendingRequest);
-
-  if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
-    aDocument->BlockOnload();
 }
 
 void
 nsImageLoadingContent::UnbindFromTree(bool aDeep, bool aNullParent)
 {
   // We may be leaving the document, so if our image is tracked, untrack it.
   nsCOMPtr<nsIDocument> doc = GetOurCurrentDoc();
   if (!doc)
     return;
 
   UntrackImage(mCurrentRequest);
   UntrackImage(mPendingRequest);
-
-  if (mCurrentRequestFlags & REQUEST_BLOCKS_ONLOAD)
-    doc->UnblockOnload(false);
 }
 
 void
 nsImageLoadingContent::OnVisibilityChange(Visibility aNewVisibility,
                                           const Maybe<OnNonvisible>& aNonvisibleAction)
 {
   switch (aNewVisibility) {
     case Visibility::APPROXIMATELY_VISIBLE:
--- a/dom/base/nsImageLoadingContent.h
+++ b/dom/base/nsImageLoadingContent.h
@@ -9,17 +9,16 @@
  * subclassed by various content nodes that want to provide image
  * loading functionality (eg <img>, <object>, etc).
  */
 
 #ifndef nsImageLoadingContent_h__
 #define nsImageLoadingContent_h__
 
 #include "imgINotificationObserver.h"
-#include "imgIOnloadBlocker.h"
 #include "mozilla/CORSMode.h"
 #include "mozilla/EventStates.h"
 #include "mozilla/TimeStamp.h"
 #include "nsCOMPtr.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIRequest.h"
 #include "mozilla/ErrorResult.h"
 #include "nsIContentPolicy.h"
@@ -36,32 +35,30 @@ namespace mozilla {
 class AsyncEventDispatcher;
 } // namespace mozilla
 
 #ifdef LoadImage
 // Undefine LoadImage to prevent naming conflict with Windows.
 #undef LoadImage
 #endif
 
-class nsImageLoadingContent : public nsIImageLoadingContent,
-                              public imgIOnloadBlocker
+class nsImageLoadingContent : public nsIImageLoadingContent
 {
   template <typename T> using Maybe = mozilla::Maybe<T>;
   using Nothing = mozilla::Nothing;
   using OnNonvisible = mozilla::OnNonvisible;
   using Visibility = mozilla::Visibility;
 
   /* METHODS */
 public:
   nsImageLoadingContent();
   virtual ~nsImageLoadingContent();
 
   NS_DECL_IMGINOTIFICATIONOBSERVER
   NS_DECL_NSIIMAGELOADINGCONTENT
-  NS_DECL_IMGIONLOADBLOCKER
 
   // Web IDL binding methods.
   // Note that the XPCOM SetLoadingEnabled, AddObserver, RemoveObserver,
   // ForceImageState methods are OK for Web IDL bindings to use as well,
   // since none of them throw when called via the Web IDL bindings.
 
   bool LoadingEnabled() const { return mLoadingEnabled; }
   int16_t ImageBlockingStatus() const
@@ -416,18 +413,16 @@ protected:
   RefPtr<imgRequestProxy> mCurrentRequest;
   RefPtr<imgRequestProxy> mPendingRequest;
   uint32_t mCurrentRequestFlags;
   uint32_t mPendingRequestFlags;
 
   enum {
     // Set if the request needs ResetAnimation called on it.
     REQUEST_NEEDS_ANIMATION_RESET = 0x00000001U,
-    // Set if the request is blocking onload.
-    REQUEST_BLOCKS_ONLOAD = 0x00000002U,
     // Set if the request is currently tracked with the document.
     REQUEST_IS_TRACKED = 0x00000004U,
     // Set if this is an imageset request, such as from <img srcset> or
     // <picture>
     REQUEST_IS_IMAGESET = 0x00000008U
   };
 
   // If the image was blocked or if there was an error loading, it's nice to
--- a/dom/html/HTMLEmbedElement.cpp
+++ b/dom/html/HTMLEmbedElement.cpp
@@ -58,17 +58,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLEmbedElement,
                                              nsGenericHTMLElement,
                                              nsIRequestObserver,
                                              nsIStreamListener,
                                              nsIFrameLoaderOwner,
                                              nsIObjectLoadingContent,
                                              imgINotificationObserver,
                                              nsIImageLoadingContent,
-                                             imgIOnloadBlocker,
                                              nsIChannelEventSink)
 
 NS_IMPL_ELEMENT_CLONE(HTMLEmbedElement)
 
 #ifdef XP_MACOSX
 
 NS_IMETHODIMP
 HTMLEmbedElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
--- a/dom/html/HTMLImageElement.cpp
+++ b/dom/html/HTMLImageElement.cpp
@@ -134,17 +134,16 @@ HTMLImageElement::~HTMLImageElement()
 
 NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
                                    nsGenericHTMLElement,
                                    mResponsiveSelector)
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLImageElement,
                                              nsGenericHTMLElement,
                                              nsIImageLoadingContent,
-                                             imgIOnloadBlocker,
                                              imgINotificationObserver)
 
 NS_IMPL_ELEMENT_CLONE(HTMLImageElement)
 
 
 bool
 HTMLImageElement::IsInteractiveHTMLContent(bool aIgnoreTabindex) const
 {
--- a/dom/html/HTMLImageElement.h
+++ b/dom/html/HTMLImageElement.h
@@ -5,17 +5,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_dom_HTMLImageElement_h
 #define mozilla_dom_HTMLImageElement_h
 
 #include "mozilla/Attributes.h"
 #include "nsGenericHTMLElement.h"
 #include "nsImageLoadingContent.h"
-#include "imgRequestProxy.h"
 #include "Units.h"
 #include "nsCycleCollectionParticipant.h"
 
 namespace mozilla {
 class EventChainPreVisitor;
 namespace dom {
 
 class ImageLoadTask;
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -1248,17 +1248,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLInputElement,
                                              nsGenericHTMLFormElementWithState,
                                              nsIDOMHTMLInputElement,
                                              nsITextControlElement,
                                              imgINotificationObserver,
                                              nsIImageLoadingContent,
-                                             imgIOnloadBlocker,
                                              nsIDOMNSEditableElement,
                                              nsIConstraintValidation)
 
 // nsIDOMNode
 
 nsresult
 HTMLInputElement::Clone(mozilla::dom::NodeInfo* aNodeInfo, nsINode** aResult,
                         bool aPreallocateArrays) const
--- a/dom/html/HTMLObjectElement.cpp
+++ b/dom/html/HTMLObjectElement.cpp
@@ -99,17 +99,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLObjectElement,
                                              nsGenericHTMLFormElement,
                                              imgINotificationObserver,
                                              nsIRequestObserver,
                                              nsIStreamListener,
                                              nsIFrameLoaderOwner,
                                              nsIObjectLoadingContent,
                                              nsIImageLoadingContent,
-                                             imgIOnloadBlocker,
                                              nsIChannelEventSink,
                                              nsIConstraintValidation)
 
 NS_IMPL_ELEMENT_CLONE(HTMLObjectElement)
 
 #ifdef XP_MACOSX
 
 static nsIWidget* GetWidget(Element* aElement)
--- a/dom/svg/SVGFEImageElement.cpp
+++ b/dom/svg/SVGFEImageElement.cpp
@@ -39,18 +39,17 @@ nsSVGElement::StringInfo SVGFEImageEleme
   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
 };
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGFEImageElement, SVGFEImageElementBase,
                             nsIDOMNode, nsIDOMElement, nsIDOMSVGElement,
-                            imgINotificationObserver, nsIImageLoadingContent,
-                            imgIOnloadBlocker)
+                            imgINotificationObserver, nsIImageLoadingContent)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGFEImageElement::SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGFEImageElementBase(aNodeInfo)
 {
   // We start out broken
--- a/dom/svg/SVGImageElement.cpp
+++ b/dom/svg/SVGImageElement.cpp
@@ -46,17 +46,17 @@ nsSVGElement::StringInfo SVGImageElement
 
 //----------------------------------------------------------------------
 // nsISupports methods
 
 NS_IMPL_ISUPPORTS_INHERITED(SVGImageElement, SVGImageElementBase,
                             nsIDOMNode, nsIDOMElement,
                             nsIDOMSVGElement,
                             imgINotificationObserver,
-                            nsIImageLoadingContent, imgIOnloadBlocker)
+                            nsIImageLoadingContent)
 
 //----------------------------------------------------------------------
 // Implementation
 
 SVGImageElement::SVGImageElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
   : SVGImageElementBase(aNodeInfo)
 {
   // We start out broken
--- a/image/IProgressObserver.h
+++ b/image/IProgressObserver.h
@@ -35,20 +35,16 @@ public:
   // Subclasses may or may not be XPCOM classes, so we just require that they
   // implement AddRef and Release.
   NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
 
   // imgINotificationObserver methods:
   virtual void Notify(int32_t aType, const nsIntRect* aRect = nullptr) = 0;
   virtual void OnLoadComplete(bool aLastPart) = 0;
 
-  // imgIOnloadBlocker methods:
-  virtual void BlockOnload() = 0;
-  virtual void UnblockOnload() = 0;
-
   // Other, internal-only methods:
   virtual void SetHasImage() = 0;
   virtual bool NotificationsDeferred() const = 0;
   virtual void SetNotificationsDeferred(bool aDeferNotifications) = 0;
 
   virtual already_AddRefed<nsIEventTarget> GetEventTarget() const
   {
     return nullptr;
--- a/image/MultipartImage.cpp
+++ b/image/MultipartImage.cpp
@@ -88,18 +88,16 @@ public:
     // notification, so go ahead and notify our owner right away.
     RefPtr<ProgressTracker> tracker = mImage->GetProgressTracker();
     if (tracker->GetProgress() & FLAG_HAS_ERROR) {
       FinishObserving();
     }
   }
 
   // Other notifications are ignored.
-  virtual void BlockOnload() override { }
-  virtual void UnblockOnload() override { }
   virtual void SetHasImage() override { }
   virtual bool NotificationsDeferred() const override { return false; }
   virtual void SetNotificationsDeferred(bool) override { }
 
 private:
   virtual ~NextPartObserver() { }
 
   void FinishObserving()
@@ -172,17 +170,17 @@ MultipartImage::BeginTransitionToPart(Im
 
 static Progress
 FilterProgress(Progress aProgress)
 {
   // Filter out onload blocking notifications, since we don't want to block
   // onload for multipart images.
   // Filter out errors, since we don't want errors in one part to error out
   // the whole stream.
-  return aProgress & ~(FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED | FLAG_HAS_ERROR);
+  return aProgress & ~FLAG_HAS_ERROR;
 }
 
 void
 MultipartImage::FinishTransition()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(mNextPart, "Should have a next part here");
 
--- a/image/MultipartImage.h
+++ b/image/MultipartImage.h
@@ -56,21 +56,16 @@ public:
   // Overridden IProgressObserver methods:
   virtual void Notify(int32_t aType,
                       const nsIntRect* aRect = nullptr) override;
   virtual void OnLoadComplete(bool aLastPart) override;
   virtual void SetHasImage() override;
   virtual bool NotificationsDeferred() const override;
   virtual void SetNotificationsDeferred(bool aDeferNotifications) override;
 
-  // We don't allow multipart images to block onload, so we override these
-  // methods to do nothing.
-  virtual void BlockOnload() override { }
-  virtual void UnblockOnload() override { }
-
 protected:
   virtual ~MultipartImage();
 
 private:
   friend class ImageFactory;
   friend class NextPartObserver;
 
   explicit MultipartImage(Image* aFirstPart);
--- a/image/ProgressTracker.cpp
+++ b/image/ProgressTracker.cpp
@@ -41,23 +41,16 @@ CheckProgressConsistency(Progress aOldPr
     MOZ_ASSERT(aIsMultipart || aNewProgress & (FLAG_FRAME_COMPLETE | FLAG_HAS_ERROR));
   }
   if (aNewProgress & FLAG_FRAME_COMPLETE) {
     MOZ_ASSERT(aNewProgress & FLAG_SIZE_AVAILABLE);
   }
   if (aNewProgress & FLAG_LOAD_COMPLETE) {
     MOZ_ASSERT(aIsMultipart || aNewProgress & (FLAG_SIZE_AVAILABLE | FLAG_HAS_ERROR));
   }
-  if (aNewProgress & FLAG_ONLOAD_BLOCKED) {
-    // No preconditions.
-  }
-  if (aNewProgress & FLAG_ONLOAD_UNBLOCKED) {
-    MOZ_ASSERT(aNewProgress & FLAG_ONLOAD_BLOCKED);
-    MOZ_ASSERT(aIsMultipart || aNewProgress & (FLAG_SIZE_AVAILABLE | FLAG_HAS_ERROR));
-  }
   if (aNewProgress & FLAG_IS_ANIMATED) {
     // No preconditions; like FLAG_HAS_TRANSPARENCY, we should normally never
     // discover this *after* FLAG_SIZE_AVAILABLE, but unfortunately some corrupt
     // GIFs may fool us.
   }
   if (aNewProgress & FLAG_HAS_TRANSPARENCY) {
     // XXX We'd like to assert that transparency is only set during metadata
     // decode but we don't have any way to assert that until bug 1254892 is fixed.
@@ -371,33 +364,19 @@ SyncNotifyInternal(const T& aObservers,
 
 void
 ProgressTracker::SyncNotifyProgress(Progress aProgress,
                                     const nsIntRect& aInvalidRect
                                                   /* = nsIntRect() */)
 {
   MOZ_ASSERT(NS_IsMainThread(), "Use mObservers on main thread only");
 
-  // Don't unblock onload if we're not blocked.
   Progress progress = Difference(aProgress);
-  if (!((mProgress | progress) & FLAG_ONLOAD_BLOCKED)) {
-    progress &= ~FLAG_ONLOAD_UNBLOCKED;
-  }
-
   CheckProgressConsistency(mProgress, mProgress | progress, mIsMultipart);
 
-  // XXX(seth): Hack to work around the fact that some observers have bugs and
-  // need to get onload blocking notifications multiple times. We should fix
-  // those observers and remove this.
-  if ((aProgress & FLAG_DECODE_COMPLETE) &&
-      (mProgress & FLAG_ONLOAD_BLOCKED) &&
-      (mProgress & FLAG_ONLOAD_UNBLOCKED)) {
-    progress |= FLAG_ONLOAD_BLOCKED | FLAG_ONLOAD_UNBLOCKED;
-  }
-
   // Apply the changes.
   mProgress |= progress;
 
   // Send notifications.
   mObservers.Read([&](const ObserverTable* aTable) {
     SyncNotifyInternal(aTable, HasImage(), progress, aInvalidRect);
   });
 
--- a/image/ProgressTracker.h
+++ b/image/ProgressTracker.h
@@ -34,18 +34,16 @@ class Image;
  * See CheckProgressConsistency() for the invariants we enforce about the
  * ordering dependencies betweeen these flags.
  */
 enum {
   FLAG_SIZE_AVAILABLE     = 1u << 0,  // STATUS_SIZE_AVAILABLE
   FLAG_DECODE_COMPLETE    = 1u << 1,  // STATUS_DECODE_COMPLETE
   FLAG_FRAME_COMPLETE     = 1u << 2,  // STATUS_FRAME_COMPLETE
   FLAG_LOAD_COMPLETE      = 1u << 3,  // STATUS_LOAD_COMPLETE
-  FLAG_ONLOAD_BLOCKED     = 1u << 4,
-  FLAG_ONLOAD_UNBLOCKED   = 1u << 5,
   FLAG_IS_ANIMATED        = 1u << 6,  // STATUS_IS_ANIMATED
   FLAG_HAS_TRANSPARENCY   = 1u << 7,  // STATUS_HAS_TRANSPARENCY
   FLAG_LAST_PART_COMPLETE = 1u << 8,
   FLAG_HAS_ERROR          = 1u << 9   // STATUS_ERROR
 };
 
 typedef uint32_t Progress;
 
--- a/image/RasterImage.cpp
+++ b/image/RasterImage.cpp
@@ -1003,17 +1003,16 @@ RasterImage::OnImageDataComplete(nsIRequ
   }
 
   Progress loadProgress = LoadCompleteProgress(aLastPart, mError, finalStatus);
 
   if (!mHasSize && !mError) {
     // We don't have our size yet, so we'll fire the load event in SetSize().
     MOZ_ASSERT(!canSyncDecodeMetadata,
                "Firing load async after metadata sync decode?");
-    NotifyProgress(FLAG_ONLOAD_BLOCKED);
     mLoadProgress = Some(loadProgress);
     return finalStatus;
   }
 
   NotifyForLoadEvent(loadProgress);
 
   return finalStatus;
 }
@@ -1838,17 +1837,16 @@ RasterImage::NotifyDecodeComplete(const 
   }
 
   // XXX(aosmond): Can we get this far without mFinished == true?
   if (aStatus.mFinished && aStatus.mWasMetadataDecode) {
     // If we were waiting to fire the load event, go ahead and fire it now.
     if (mLoadProgress) {
       NotifyForLoadEvent(*mLoadProgress);
       mLoadProgress = Nothing();
-      NotifyProgress(FLAG_ONLOAD_UNBLOCKED);
     }
 
     // If we were a metadata decode and a full decode was requested, do it.
     if (mWantFullDecode) {
       mWantFullDecode = false;
       RequestDecodeForSize(mSize, DECODE_FLAGS_DEFAULT);
     }
   }
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -1192,26 +1192,16 @@ VectorImage::OnStartRequest(nsIRequest* 
   mSVGDocumentWrapper = new SVGDocumentWrapper();
   nsresult rv = mSVGDocumentWrapper->OnStartRequest(aRequest, aCtxt);
   if (NS_FAILED(rv)) {
     mSVGDocumentWrapper = nullptr;
     mError = true;
     return rv;
   }
 
-  // ProgressTracker::SyncNotifyProgress may release us, so ensure we
-  // stick around long enough to complete our work.
-  RefPtr<VectorImage> kungFuDeathGrip(this);
-
-  // Block page load until the document's ready.  (We unblock it in
-  // OnSVGDocumentLoaded or OnSVGDocumentError.)
-  if (mProgressTracker) {
-    mProgressTracker->SyncNotifyProgress(FLAG_ONLOAD_BLOCKED);
-  }
-
   // Create a listener to wait until the SVG document is fully loaded, which
   // will signal that this image is ready to render. Certain error conditions
   // will prevent us from ever getting this notification, so we also create a
   // listener that waits for parsing to complete and cancels the
   // SVGLoadEventListener if needed. The listeners are automatically attached
   // to the document by their constructors.
   nsIDocument* document = mSVGDocumentWrapper->GetDocument();
   mLoadEventListener = new SVGLoadEventListener(document, this);
@@ -1285,18 +1275,17 @@ VectorImage::OnSVGDocumentLoaded()
   // stick around long enough to complete our work.
   RefPtr<VectorImage> kungFuDeathGrip(this);
 
   // Tell *our* observers that we're done loading.
   if (mProgressTracker) {
     Progress progress = FLAG_SIZE_AVAILABLE |
                         FLAG_HAS_TRANSPARENCY |
                         FLAG_FRAME_COMPLETE |
-                        FLAG_DECODE_COMPLETE |
-                        FLAG_ONLOAD_UNBLOCKED;
+                        FLAG_DECODE_COMPLETE;
 
     if (mHaveAnimations) {
       progress |= FLAG_IS_ANIMATED;
     }
 
     // Merge in any saved progress from OnImageDataComplete.
     if (mLoadProgress) {
       progress |= *mLoadProgress;
@@ -1313,17 +1302,17 @@ void
 VectorImage::OnSVGDocumentError()
 {
   CancelAllListeners();
 
   mError = true;
 
   if (mProgressTracker) {
     // Notify observers about the error and unblock page load.
-    Progress progress = FLAG_ONLOAD_UNBLOCKED | FLAG_HAS_ERROR;
+    Progress progress = FLAG_HAS_ERROR;
 
     // Merge in any saved progress from OnImageDataComplete.
     if (mLoadProgress) {
       progress |= *mLoadProgress;
       mLoadProgress = Nothing();
     }
 
     mProgressTracker->SyncNotifyProgress(progress);
deleted file mode 100644
--- a/image/imgIOnloadBlocker.idl
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface imgIRequest;
-
-[uuid(dc126d90-0ee0-4683-b942-2fa66e443abc)]
-interface imgIOnloadBlocker : nsISupports
-{
-    /**
-     * blockOnload
-     * Called when it is appropriate to block onload for the given imgIRequest.
-     *
-     * @param aRequest
-     *        The request that should block onload.
-     */
-    void blockOnload(in imgIRequest aRequest);
-
-    /**
-     * unblockOnload
-     * Called when it is appropriate to unblock onload for the given
-     * imgIRequest.
-     *
-     * @param aRequest
-     *        The request that should unblock onload.
-     */
-    void unblockOnload(in imgIRequest aRequest);
-};
--- a/image/imgRequest.cpp
+++ b/image/imgRequest.cpp
@@ -349,17 +349,17 @@ imgRequest::Cancel(nsresult aStatus)
 }
 
 void
 imgRequest::ContinueCancel(nsresult aStatus)
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   RefPtr<ProgressTracker> progressTracker = GetProgressTracker();
-  progressTracker->SyncNotifyProgress(FLAG_HAS_ERROR | FLAG_ONLOAD_UNBLOCKED);
+  progressTracker->SyncNotifyProgress(FLAG_HAS_ERROR);
 
   RemoveFromCache();
 
   if (mRequest && !(progressTracker->GetProgress() & FLAG_LAST_PART_COMPLETE)) {
      mRequest->Cancel(aStatus);
   }
 }
 
--- a/image/imgRequestProxy.cpp
+++ b/image/imgRequestProxy.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  *
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ImageLogging.h"
 #include "imgRequestProxy.h"
-#include "imgIOnloadBlocker.h"
 #include "imgLoader.h"
 #include "Image.h"
 #include "ImageOps.h"
 #include "nsError.h"
 #include "nsCRTGlue.h"
 #include "imgINotificationObserver.h"
 #include "mozilla/dom/TabGroup.h"       // for TabGroup
 #include "mozilla/dom/DocGroup.h"       // for DocGroup
@@ -1100,70 +1099,16 @@ imgRequestProxy::OnLoadComplete(bool aLa
     // like that.  Don't add anything in this method after this point.
     imgINotificationObserver* obs = mListener;
     mListenerIsStrongRef = false;
     NS_RELEASE(obs);
   }
 }
 
 void
-imgRequestProxy::BlockOnload()
-{
-  if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
-    nsAutoCString name;
-    GetName(name);
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::BlockOnload",
-                        "name", name.get());
-  }
-
-  nsCOMPtr<imgIOnloadBlocker> blocker = do_QueryInterface(mListener);
-  if (!blocker) {
-    return;
-  }
-
-  if (!IsOnEventTarget()) {
-    RefPtr<imgRequestProxy> self(this);
-    DispatchWithTarget(NS_NewRunnableFunction("imgRequestProxy::BlockOnload",
-                                    [self]() -> void {
-      self->BlockOnload();
-    }));
-    return;
-  }
-
-  blocker->BlockOnload(this);
-}
-
-void
-imgRequestProxy::UnblockOnload()
-{
-  if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
-    nsAutoCString name;
-    GetName(name);
-    LOG_FUNC_WITH_PARAM(gImgLog, "imgRequestProxy::UnblockOnload",
-                        "name", name.get());
-  }
-
-  nsCOMPtr<imgIOnloadBlocker> blocker = do_QueryInterface(mListener);
-  if (!blocker) {
-    return;
-  }
-
-  if (!IsOnEventTarget()) {
-    RefPtr<imgRequestProxy> self(this);
-    DispatchWithTarget(NS_NewRunnableFunction("imgRequestProxy::UnblockOnload",
-                                    [self]() -> void {
-      self->UnblockOnload();
-    }));
-    return;
-  }
-
-  blocker->UnblockOnload(this);
-}
-
-void
 imgRequestProxy::NullOutListener()
 {
   // If we have animation consumers, then they don't matter anymore
   if (mListener) {
     ClearAnimationConsumers();
   }
 
   if (mListenerIsStrongRef) {
--- a/image/imgRequestProxy.h
+++ b/image/imgRequestProxy.h
@@ -102,20 +102,16 @@ public:
   // asynchronously-called function.
   void SyncNotifyListener();
 
   // imgINotificationObserver methods:
   virtual void Notify(int32_t aType,
                       const mozilla::gfx::IntRect* aRect = nullptr) override;
   virtual void OnLoadComplete(bool aLastPart) override;
 
-  // imgIOnloadBlocker methods:
-  virtual void BlockOnload() override;
-  virtual void UnblockOnload() override;
-
   // Other, internal-only methods:
   virtual void SetHasImage() override;
 
   // Whether we want notifications from ProgressTracker to be deferred until
   // an event it has scheduled has been fired.
   virtual bool NotificationsDeferred() const override
   {
     return mDeferNotifications;
--- a/image/moz.build
+++ b/image/moz.build
@@ -24,17 +24,16 @@ XPCSHELL_TESTS_MANIFESTS += ['test/unit/
 
 XPIDL_SOURCES += [
     'imgICache.idl',
     'imgIContainer.idl',
     'imgIContainerDebug.idl',
     'imgIEncoder.idl',
     'imgILoader.idl',
     'imgINotificationObserver.idl',
-    'imgIOnloadBlocker.idl',
     'imgIRequest.idl',
     'imgIScriptedNotificationObserver.idl',
     'imgITools.idl',
     'nsIIconURI.idl',
 ]
 
 XPIDL_MODULE = 'imglib2'
 
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -58,17 +58,16 @@ NS_IMPL_FRAMEARENA_HELPERS(nsBulletFrame
 #ifdef DEBUG
 NS_QUERYFRAME_HEAD(nsBulletFrame)
   NS_QUERYFRAME_ENTRY(nsBulletFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
 #endif
 
 nsBulletFrame::~nsBulletFrame()
 {
-  NS_ASSERTION(!mBlockingOnload, "Still blocking onload in destructor?");
 }
 
 void
 nsBulletFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   // Stop image loading first.
   DeregisterAndCancelImageRequest();
 
@@ -1223,52 +1222,16 @@ nsBulletFrame::Notify(imgIRequest *aRequ
         container->PropagateUseCounters(parent);
       }
     }
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsBulletFrame::BlockOnload(imgIRequest* aRequest)
-{
-  if (aRequest != mImageRequest) {
-    return NS_OK;
-  }
-
-  NS_ASSERTION(!mBlockingOnload, "Double BlockOnload for an nsBulletFrame?");
-
-  nsIDocument* doc = GetOurCurrentDoc();
-  if (doc) {
-    mBlockingOnload = true;
-    doc->BlockOnload();
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsBulletFrame::UnblockOnload(imgIRequest* aRequest)
-{
-  if (aRequest != mImageRequest) {
-    return NS_OK;
-  }
-
-  NS_ASSERTION(!mBlockingOnload, "Double UnblockOnload for an nsBulletFrame?");
-
-  nsIDocument* doc = GetOurCurrentDoc();
-  if (doc) {
-    doc->UnblockOnload(false);
-  }
-  mBlockingOnload = false;
-
-  return NS_OK;
-}
-
 nsIDocument*
 nsBulletFrame::GetOurCurrentDoc() const
 {
   nsIContent* parentContent = GetParent()->GetContent();
   return parentContent ? parentContent->GetComposedDoc()
                        : nullptr;
 }
 
@@ -1465,25 +1428,16 @@ nsBulletFrame::DeregisterAndCancelImageR
 
     // Deregister our image request from the refresh driver.
     nsLayoutUtils::DeregisterImageRequest(PresContext(),
                                           mImageRequest,
                                           &isRequestRegistered);
 
     isRequestRegistered = mRequestRegistered;
 
-    // Unblock onload if we blocked it.
-    if (mBlockingOnload) {
-      nsIDocument* doc = GetOurCurrentDoc();
-      if (doc) {
-        doc->UnblockOnload(false);
-      }
-      mBlockingOnload = false;
-    }
-
     // Cancel the image request and forget about it.
     mImageRequest->CancelAndForgetObserver(NS_ERROR_FAILURE);
     mImageRequest = nullptr;
   }
 }
 
 
 
@@ -1504,26 +1458,8 @@ nsBulletListener::~nsBulletListener()
 NS_IMETHODIMP
 nsBulletListener::Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData)
 {
   if (!mFrame) {
     return NS_ERROR_FAILURE;
   }
   return mFrame->Notify(aRequest, aType, aData);
 }
-
-NS_IMETHODIMP
-nsBulletListener::BlockOnload(imgIRequest* aRequest)
-{
-  if (!mFrame) {
-    return NS_ERROR_FAILURE;
-  }
-  return mFrame->BlockOnload(aRequest);
-}
-
-NS_IMETHODIMP
-nsBulletListener::UnblockOnload(imgIRequest* aRequest)
-{
-  if (!mFrame) {
-    return NS_ERROR_FAILURE;
-  }
-  return mFrame->UnblockOnload(aRequest);
-}
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -9,33 +9,30 @@
 #ifndef nsBulletFrame_h___
 #define nsBulletFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsFrame.h"
 
 #include "imgIContainer.h"
 #include "imgINotificationObserver.h"
-#include "imgIOnloadBlocker.h"
 
 class imgIContainer;
 class imgRequestProxy;
 
 class nsBulletFrame;
 class BulletRenderer;
 
-class nsBulletListener final : public imgINotificationObserver,
-                               public imgIOnloadBlocker
+class nsBulletListener final : public imgINotificationObserver
 {
 public:
   nsBulletListener();
 
   NS_DECL_ISUPPORTS
   NS_DECL_IMGINOTIFICATIONOBSERVER
-  NS_DECL_IMGIONLOADBLOCKER
 
   void SetFrame(nsBulletFrame *frame) { mFrame = frame; }
 
 private:
   virtual ~nsBulletListener();
 
   nsBulletFrame *mFrame;
 };
@@ -54,24 +51,21 @@ public:
 #endif
 
   explicit nsBulletFrame(nsStyleContext* aContext)
     : nsFrame(aContext, kClassID)
     , mPadding(GetWritingMode())
     , mIntrinsicSize(GetWritingMode())
     , mOrdinal(0)
     , mRequestRegistered(false)
-    , mBlockingOnload(false)
   {}
 
   virtual ~nsBulletFrame();
 
   NS_IMETHOD Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData);
-  NS_IMETHOD BlockOnload(imgIRequest* aRequest);
-  NS_IMETHOD UnblockOnload(imgIRequest* aRequest);
 
   // nsIFrame
   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
   virtual void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsDisplayListSet& aLists) override;
   virtual void DidSetStyleContext(nsStyleContext* aOldStyleContext) override;
 #ifdef DEBUG_FRAME_DUMP
   virtual nsresult GetFrameName(nsAString& aResult) const override;
@@ -148,14 +142,11 @@ protected:
 
 private:
   void RegisterImageRequest(bool aKnownToBeAnimated);
   void DeregisterAndCancelImageRequest();
 
   // This is a boolean flag indicating whether or not the current image request
   // has been registered with the refresh driver.
   bool mRequestRegistered : 1;
-
-  // Whether we're currently blocking onload.
-  bool mBlockingOnload : 1;
 };
 
 #endif /* nsBulletFrame_h___ */
--- a/layout/style/ImageLoader.cpp
+++ b/layout/style/ImageLoader.cpp
@@ -376,17 +376,16 @@ ImageLoader::DoRedraw(FrameSet* aFrameSe
   }
 }
 
 NS_IMPL_ADDREF(ImageLoader)
 NS_IMPL_RELEASE(ImageLoader)
 
 NS_INTERFACE_MAP_BEGIN(ImageLoader)
   NS_INTERFACE_MAP_ENTRY(imgINotificationObserver)
-  NS_INTERFACE_MAP_ENTRY(imgIOnloadBlocker)
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP
 ImageLoader::Notify(imgIRequest* aRequest, int32_t aType, const nsIntRect* aData)
 {
   if (aType == imgINotificationObserver::SIZE_AVAILABLE) {
     nsCOMPtr<imgIContainer> image;
     aRequest->GetImage(getter_AddRefs(image));
@@ -489,40 +488,16 @@ ImageLoader::OnFrameUpdate(imgIRequest* 
 
   NS_ASSERTION(frameSet, "This should never be null!");
 
   DoRedraw(frameSet, /* aForcePaint = */ false);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP
-ImageLoader::BlockOnload(imgIRequest* aRequest)
-{
-  if (!mDocument) {
-    return NS_OK;
-  }
-
-  mDocument->BlockOnload();
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-ImageLoader::UnblockOnload(imgIRequest* aRequest)
-{
-  if (!mDocument) {
-    return NS_OK;
-  }
-
-  mDocument->UnblockOnload(false);
-
-  return NS_OK;
-}
-
 void
 ImageLoader::FlushUseCounters()
 {
   for (auto iter = mImages.Iter(); !iter.Done(); iter.Next()) {
     nsPtrHashKey<Image>* key = iter.Get();
     ImageLoader::Image* image = key->GetKey();
 
     imgIRequest* request = image->mRequests.GetWeak(mDocument);
--- a/layout/style/ImageLoader.h
+++ b/layout/style/ImageLoader.h
@@ -9,47 +9,44 @@
 
 #ifndef mozilla_css_ImageLoader_h___
 #define mozilla_css_ImageLoader_h___
 
 #include "nsClassHashtable.h"
 #include "nsHashKeys.h"
 #include "nsTArray.h"
 #include "imgIRequest.h"
-#include "imgIOnloadBlocker.h"
 #include "imgINotificationObserver.h"
 #include "mozilla/Attributes.h"
 
 class imgIContainer;
 class nsIFrame;
 class nsIDocument;
 class nsPresContext;
 class nsIURI;
 class nsIPrincipal;
 
 namespace mozilla {
 namespace css {
 
 struct ImageValue;
 
-class ImageLoader final : public imgINotificationObserver,
-                          public imgIOnloadBlocker
+class ImageLoader final : public imgINotificationObserver
 {
 public:
   typedef mozilla::css::ImageValue Image;
 
   explicit ImageLoader(nsIDocument* aDocument)
   : mDocument(aDocument),
     mInClone(false)
   {
     MOZ_ASSERT(mDocument);
   }
 
   NS_DECL_ISUPPORTS
-  NS_DECL_IMGIONLOADBLOCKER
   NS_DECL_IMGINOTIFICATIONOBSERVER
 
   void DropDocumentReference();
 
   void MaybeRegisterCSSImage(Image* aImage);
   void DeregisterCSSImage(Image* aImage);
 
   void AssociateRequestToFrame(imgIRequest* aRequest,
--- a/layout/style/nsCSSDataBlock.h
+++ b/layout/style/nsCSSDataBlock.h
@@ -12,17 +12,16 @@
 #ifndef nsCSSDataBlock_h__
 #define nsCSSDataBlock_h__
 
 #include "mozilla/MemoryReporting.h"
 #include "nsCSSProps.h"
 #include "nsCSSPropertyIDSet.h"
 #include "nsCSSValue.h"
 #include "nsStyleStruct.h"
-#include "imgRequestProxy.h"
 
 struct nsRuleData;
 class nsCSSExpandedDataBlock;
 class nsIDocument;
 
 namespace mozilla {
 namespace css {
 class Declaration;
--- a/layout/xul/nsImageBoxFrame.cpp
+++ b/layout/xul/nsImageBoxFrame.cpp
@@ -910,17 +910,17 @@ nsImageBoxFrame::OnFrameUpdate(imgIReque
     return NS_OK;
   }
 
   InvalidateLayer(DisplayItemType::TYPE_XUL_IMAGE);
 
   return NS_OK;
 }
 
-NS_IMPL_ISUPPORTS(nsImageBoxListener, imgINotificationObserver, imgIOnloadBlocker)
+NS_IMPL_ISUPPORTS(nsImageBoxListener, imgINotificationObserver)
 
 nsImageBoxListener::nsImageBoxListener()
 {
 }
 
 nsImageBoxListener::~nsImageBoxListener()
 {
 }
@@ -928,28 +928,8 @@ nsImageBoxListener::~nsImageBoxListener(
 NS_IMETHODIMP
 nsImageBoxListener::Notify(imgIRequest *request, int32_t aType, const nsIntRect* aData)
 {
   if (!mFrame)
     return NS_OK;
 
   return mFrame->Notify(request, aType, aData);
 }
-
-NS_IMETHODIMP
-nsImageBoxListener::BlockOnload(imgIRequest *aRequest)
-{
-  if (mFrame && mFrame->GetContent() && mFrame->GetContent()->GetUncomposedDoc()) {
-    mFrame->GetContent()->GetUncomposedDoc()->BlockOnload();
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsImageBoxListener::UnblockOnload(imgIRequest *aRequest)
-{
-  if (mFrame && mFrame->GetContent() && mFrame->GetContent()->GetUncomposedDoc()) {
-    mFrame->GetContent()->GetUncomposedDoc()->UnblockOnload(false);
-  }
-
-  return NS_OK;
-}
--- a/layout/xul/nsImageBoxFrame.h
+++ b/layout/xul/nsImageBoxFrame.h
@@ -7,33 +7,29 @@
 #define nsImageBoxFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "nsLeafBoxFrame.h"
 
 #include "imgILoader.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
-#include "imgINotificationObserver.h"
-#include "imgIOnloadBlocker.h"
 
 class imgRequestProxy;
 class nsImageBoxFrame;
 
 class nsDisplayXULImage;
 
-class nsImageBoxListener final : public imgINotificationObserver,
-                                 public imgIOnloadBlocker
+class nsImageBoxListener final : public imgINotificationObserver
 {
 public:
   nsImageBoxListener();
 
   NS_DECL_ISUPPORTS
   NS_DECL_IMGINOTIFICATIONOBSERVER
-  NS_DECL_IMGIONLOADBLOCKER
 
   void SetFrame(nsImageBoxFrame *frame) { mFrame = frame; }
 
 private:
   virtual ~nsImageBoxListener();
 
   nsImageBoxFrame *mFrame;
 };