From 35083f75e6e0819bf8419a3ffd25d6c23fc5b9eb Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Tue, 25 Oct 2022 08:27:02 +0000 Subject: [PATCH] Bug 1574487 - Remove loadstart and loadend event from , r=edgar Depends on D159930 Differential Revision: https://phabricator.services.mozilla.com/D159931 --- dom/base/nsImageLoadingContent.cpp | 14 -------------- dom/base/nsImageLoadingContent.h | 3 +-- dom/tests/mochitest/general/test_interfaces.js | 2 -- dom/webidl/EventHandler.webidl | 1 - .../historical-progress-event.window.js.ini | 7 ------- .../test/browser/browser_staticPartition_saveAs.js | 2 +- 6 files changed, 2 insertions(+), 27 deletions(-) delete mode 100644 testing/web-platform/meta/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js.ini diff --git a/dom/base/nsImageLoadingContent.cpp b/dom/base/nsImageLoadingContent.cpp index 98d94fc1ccd7..25180de20879 100644 --- a/dom/base/nsImageLoadingContent.cpp +++ b/dom/base/nsImageLoadingContent.cpp @@ -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; diff --git a/dom/base/nsImageLoadingContent.h b/dom/base/nsImageLoadingContent.h index 69cc0b8927c4..0437380323b6 100644 --- a/dom/base/nsImageLoadingContent.h +++ b/dom/base/nsImageLoadingContent.h @@ -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); diff --git a/dom/tests/mochitest/general/test_interfaces.js b/dom/tests/mochitest/general/test_interfaces.js index c9a9b9caf290..9f28a1646fc0 100644 --- a/dom/tests/mochitest/general/test_interfaces.js +++ b/dom/tests/mochitest/general/test_interfaces.js @@ -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 }, diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index 5711ffdffe46..3f996485ef93 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -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; diff --git a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js.ini b/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js.ini deleted file mode 100644 index 364c503f9696..000000000000 --- a/testing/web-platform/meta/html/semantics/embedded-content/the-img-element/historical-progress-event.window.js.ini +++ /dev/null @@ -1,7 +0,0 @@ -[historical-progress-event.window.html] - [onloadend is not exposed] - expected: FAIL - - [ does not support ProgressEvent or loadstart/progress/loadend] - expected: FAIL - diff --git a/toolkit/components/antitracking/test/browser/browser_staticPartition_saveAs.js b/toolkit/components/antitracking/test/browser/browser_staticPartition_saveAs.js index c446ed2a37ac..fc11f56ba249 100644 --- a/toolkit/components/antitracking/test/browser/browser_staticPartition_saveAs.js +++ b/toolkit/components/antitracking/test/browser/browser_staticPartition_saveAs.js @@ -423,7 +423,7 @@ add_task(async function testPageInfoMediaSaveAs() { let preview = pageInfo.document.getElementById("thepreviewimage"); let mediaType = pageInfo.gImageView.data[i][1]; // COL_IMAGE_TYPE if (mediaType == "Image") { - await BrowserTestUtils.waitForEvent(preview, "loadend"); + await BrowserTestUtils.waitForEvent(preview, "load"); } else if (mediaType == "Video") { await BrowserTestUtils.waitForEvent(preview, "canplaythrough"); }