Commit 00ec8a85 authored by Olli Pettay's avatar Olli Pettay
Browse files

Bug 1574487 - Remove loadstart and loadend event from <img>, r=edgar

Depends on D159930

Differential Revision: https://phabricator.services.mozilla.com/D159931
parent 721c4db0
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -252,15 +252,8 @@ void nsImageLoadingContent::OnLoadComplete(imgIRequest* aRequest,
  // Fire the appropriate DOM event.
  if (NS_SUCCEEDED(aStatus)) {
    FireEvent(u"load"_ns);

    // Do not fire loadend event for multipart/x-mixed-replace image streams.
    bool isMultipart;
    if (NS_FAILED(aRequest->GetMultipart(&isMultipart)) || !isMultipart) {
      FireEvent(u"loadend"_ns);
    }
  } else {
    FireEvent(u"error"_ns);
    FireEvent(u"loadend"_ns);
  }

  SVGObserverUtils::InvalidateDirectRenderingObservers(
@@ -987,7 +980,6 @@ nsImageLoadingContent::LoadImageWithChannel(nsIChannel* aChannel,
  if (!mCurrentRequest) aChannel->GetURI(getter_AddRefs(mCurrentURI));

  FireEvent(u"error"_ns);
  FireEvent(u"loadend"_ns);
  return rv;
}

@@ -1063,14 +1055,10 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
    return NS_OK;
  }

  // Fire loadstart event if required
  FireEvent(u"loadstart"_ns);

  if (!mLoadingEnabled) {
    // XXX Why fire an error here? seems like the callers to SetLoadingEnabled
    // don't want/need it.
    FireEvent(u"error"_ns);
    FireEvent(u"loadend"_ns);
    return NS_OK;
  }

@@ -1100,7 +1088,6 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
    ClearPendingRequest(NS_BINDING_ABORTED, Some(OnNonvisible::DiscardImages));

    FireEvent(u"error"_ns);
    FireEvent(u"loadend"_ns);
    return NS_OK;
  }

@@ -1207,7 +1194,6 @@ nsresult nsImageLoadingContent::LoadImage(nsIURI* aNewURI, bool aForce,
    }

    FireEvent(u"error"_ns);
    FireEvent(u"loadend"_ns);
  }

  return NS_OK;
+1 −2
Original line number Diff line number Diff line
@@ -356,8 +356,7 @@ class nsImageLoadingContent : public nsIImageLoadingContent {
  /**
   * Method to fire an event once we know what's going on with the image load.
   *
   * @param aEventType "loadstart", "loadend", "load", or "error" depending on
   *                   how things went
   * @param aEventType "load", or "error" depending on how things went
   * @param aIsCancelable true if event is cancelable.
   */
  nsresult FireEvent(const nsAString& aEventType, bool aIsCancelable = false);
+0 −2
Original line number Diff line number Diff line
@@ -1618,8 +1618,6 @@ let interfaceNamesInGlobalScope = [
  // IMPORTANT: Do not change this list without review from a DOM peer!
  { name: "onloadedmetadata", insecureContext: true },
  // IMPORTANT: Do not change this list without review from a DOM peer!
  { name: "onloadend", insecureContext: true },
  // IMPORTANT: Do not change this list without review from a DOM peer!
  { name: "onloadstart", insecureContext: true },
  // IMPORTANT: Do not change this list without review from a DOM peer!
  { name: "onlostpointercapture", insecureContext: true },
+0 −1
Original line number Diff line number Diff line
@@ -62,7 +62,6 @@ interface mixin GlobalEventHandlers {
           attribute EventHandler onload;
           attribute EventHandler onloadeddata;
           attribute EventHandler onloadedmetadata;
           attribute EventHandler onloadend;
           attribute EventHandler onloadstart;
           attribute EventHandler onmousedown;
  [LegacyLenientThis] attribute EventHandler onmouseenter;
+0 −7
Original line number Diff line number Diff line
[historical-progress-event.window.html]
  [onloadend is not exposed]
    expected: FAIL

  [<img> does not support ProgressEvent or loadstart/progress/loadend]
    expected: FAIL