From fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:14:29 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- image/test/mochitest/1835509.gif | Bin 0 -> 552 bytes image/test/mochitest/imgutils.js | 16 ++++---- image/test/mochitest/mochitest.toml | 1 + image/test/mochitest/test_animSVGImage2.html | 2 +- image/test/mochitest/test_animation_operators.html | 2 +- image/test/mochitest/test_bug601470.html | 2 +- .../test/mochitest/test_discardAnimatedImage.html | 41 +++++++++++++++++---- .../test_discardFinishedAnimatedImage.html | 2 +- image/test/mochitest/test_has_transparency.html | 4 +- image/test/mochitest/test_net_failedtoprocess.html | 2 +- image/test/mochitest/test_removal_ondecode.html | 4 +- image/test/mochitest/test_removal_onload.html | 6 +-- 12 files changed, 54 insertions(+), 28 deletions(-) create mode 100644 image/test/mochitest/1835509.gif (limited to 'image/test/mochitest') diff --git a/image/test/mochitest/1835509.gif b/image/test/mochitest/1835509.gif new file mode 100644 index 0000000000..46a0cb5b65 Binary files /dev/null and b/image/test/mochitest/1835509.gif differ diff --git a/image/test/mochitest/imgutils.js b/image/test/mochitest/imgutils.js index b16ad1d065..e7e696f768 100644 --- a/image/test/mochitest/imgutils.js +++ b/image/test/mochitest/imgutils.js @@ -126,12 +126,12 @@ function getImagePref(pref) { // JS implementation of imgIScriptedNotificationObserver with stubs for all of its methods. function ImageDecoderObserverStub() { - this.sizeAvailable = function sizeAvailable(aRequest) {}; - this.frameComplete = function frameComplete(aRequest) {}; - this.decodeComplete = function decodeComplete(aRequest) {}; - this.loadComplete = function loadComplete(aRequest) {}; - this.frameUpdate = function frameUpdate(aRequest) {}; - this.discard = function discard(aRequest) {}; - this.isAnimated = function isAnimated(aRequest) {}; - this.hasTransparency = function hasTransparency(aRequest) {}; + this.sizeAvailable = function sizeAvailable() {}; + this.frameComplete = function frameComplete() {}; + this.decodeComplete = function decodeComplete() {}; + this.loadComplete = function loadComplete() {}; + this.frameUpdate = function frameUpdate() {}; + this.discard = function discard() {}; + this.isAnimated = function isAnimated() {}; + this.hasTransparency = function hasTransparency() {}; } diff --git a/image/test/mochitest/mochitest.toml b/image/test/mochitest/mochitest.toml index 96aaa8a0c3..803b8d48ad 100644 --- a/image/test/mochitest/mochitest.toml +++ b/image/test/mochitest/mochitest.toml @@ -100,6 +100,7 @@ support-files = [ "6M-pixels.png", "12M-pixels-1.png", "12M-pixels-2.png", + "1835509.gif", ] ["test_animSVGImage.html"] diff --git a/image/test/mochitest/test_animSVGImage2.html b/image/test/mochitest/test_animSVGImage2.html index 0f3ae046c5..11972bdb36 100644 --- a/image/test/mochitest/test_animSVGImage2.html +++ b/image/test/mochitest/test_animSVGImage2.html @@ -55,7 +55,7 @@ function takeReferenceSnapshot() { "reference div should disappear when it becomes display:none"); } -function myOnFrameUpdate(aRequest) { +function myOnFrameUpdate() { if (gIsTestFinished) { return; } diff --git a/image/test/mochitest/test_animation_operators.html b/image/test/mochitest/test_animation_operators.html index 2d3a6f6d67..2ccd4a7de5 100644 --- a/image/test/mochitest/test_animation_operators.html +++ b/image/test/mochitest/test_animation_operators.html @@ -101,7 +101,7 @@ function startTest(i) element.setAttribute("scrolling", "no"); element.src = url; document.body.appendChild(element); - function handleLoad(event) + function handleLoad() { iframe.loaded = true; if (iframe == reference) { diff --git a/image/test/mochitest/test_bug601470.html b/image/test/mochitest/test_bug601470.html index fdf2d074f8..c4b772c877 100644 --- a/image/test/mochitest/test_bug601470.html +++ b/image/test/mochitest/test_bug601470.html @@ -26,7 +26,7 @@ window.onload = function() { .getService(SpecialPowers.Ci.nsIMemoryReporterManager); var amount = 0; - var handleReport = function(aProcess, aPath, aKind, aUnits, aAmount, aDesc) { + var handleReport = function(aProcess, aPath, aKind, aUnits, aAmount) { amount += aAmount; } diff --git a/image/test/mochitest/test_discardAnimatedImage.html b/image/test/mochitest/test_discardAnimatedImage.html index 09bd9372c6..f9ccc806ce 100644 --- a/image/test/mochitest/test_discardAnimatedImage.html +++ b/image/test/mochitest/test_discardAnimatedImage.html @@ -16,14 +16,27 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=686905
+ + + + + + +
@@ -45,6 +58,7 @@ window.onload = function() {
 }
 
 var gImgs = ['infinitepng', 'infinitegif', 'infinitewebp', 'infiniteavif',
+             'corruptinfinitegif',
              'finitepng',   'finitegif',   'finitewebp', 'finiteavif'];
 // If we are currently counting frame updates.
 var gCountingFrameUpdates = false;
@@ -52,18 +66,25 @@ var gCountingFrameUpdates = false;
 // after discarding. (The last two images are finite looping so we don't expect
 // them to get incremented but it's possible if they don't finish their
 // animation before we discard them.)
-var gNumFrameUpdates = [0, 0, 0, 0, 0, 0];
+var gNumFrameUpdates = [0, 0, 0, 0, 0, 0, 0, 0, 0];
 // The last snapshot of the image. Used to check that the image actually changes.
-var gLastSnapShot = [null, null, null, null, null, null];
+var gLastSnapShot = [null, null, null, null, null, null, null, null, null];
 // Number of observed changes in the snapshot.
-var gNumSnapShotChanges = [0, 0, 0, 0, 0, 0];
+var gNumSnapShotChanges = [0, 0, 0, 0, 0, 0, 0, 0, 0];
 // If we've removed the observer.
-var gRemovedObserver = [false, false, false, false, false, false];
+var gRemovedObserver = [false, false, false, false, false, false, false, false, false];
 
 // 2 would probably be a good enough test, we arbitrarily choose 4.
-var kNumFrameUpdatesToExpect = 4;
+var kNumFrameUpdatesToExpect = 5;
 
 function runTest() {
+  let numImgsInDoc = document.getElementsByTagName("img").length;
+  ok(gImgs.length == numImgsInDoc, "gImgs missing img");
+  ok(gNumFrameUpdates.length == numImgsInDoc, "gNumFrameUpdates missing img");
+  ok(gLastSnapShot.length == numImgsInDoc, "gLastSnapShot missing img");
+  ok(gNumSnapShotChanges.length == numImgsInDoc, "gNumSnapShotChanges missing img");
+  ok(gRemovedObserver.length == numImgsInDoc, "gRemovedObserver missing img");
+
   var animatedDiscardable =
     SpecialPowers.getBoolPref('image.mem.animated.discardable');
   if (!animatedDiscardable) {
@@ -117,9 +138,13 @@ function checkIfFinished() {
   if ((gNumFrameUpdates[0] >= kNumFrameUpdatesToExpect) &&
       (gNumFrameUpdates[1] >= kNumFrameUpdatesToExpect) &&
       (gNumFrameUpdates[2] >= kNumFrameUpdatesToExpect) &&
+      (gNumFrameUpdates[3] >= kNumFrameUpdatesToExpect) &&
+      (gNumFrameUpdates[4] >= kNumFrameUpdatesToExpect) &&
       (gNumSnapShotChanges[0] >= kNumFrameUpdatesToExpect) &&
       (gNumSnapShotChanges[1] >= kNumFrameUpdatesToExpect) &&
-      (gNumSnapShotChanges[2] >= kNumFrameUpdatesToExpect)) {
+      (gNumSnapShotChanges[2] >= kNumFrameUpdatesToExpect) &&
+      (gNumSnapShotChanges[3] >= kNumFrameUpdatesToExpect) &&
+      (gNumSnapShotChanges[4] >= kNumFrameUpdatesToExpect)) {
     ok(true, "got expected frame updates");
     gFinished = true;
     SimpleTest.finish();
@@ -133,8 +158,8 @@ function addCallbacks(anImage, arrayIndex) {
   observer.discard = function () {
     gNumDiscards++;
     ok(true, "got image discard");
-    if (arrayIndex >= 3) {
-      // The last two images are finite, so we don't expect any frame updates,
+    if (arrayIndex >= 5) {
+      // The last four images are finite, so we don't expect any frame updates,
       // this image is done the test, so remove the observer.
       if (!gRemovedObserver[arrayIndex]) {
         gRemovedObserver[arrayIndex] = true;
diff --git a/image/test/mochitest/test_discardFinishedAnimatedImage.html b/image/test/mochitest/test_discardFinishedAnimatedImage.html
index 190cb1d1a0..f5b7a94e35 100644
--- a/image/test/mochitest/test_discardFinishedAnimatedImage.html
+++ b/image/test/mochitest/test_discardFinishedAnimatedImage.html
@@ -129,7 +129,7 @@ function addCallbacks(anImage) {
   imgLoadingContent.addObserver(scriptedObserver);
 }
 
-function removeObserver(anImage) {
+function removeObserver() {
   imgLoadingContent.removeObserver(scriptedObserver);
 }
 
diff --git a/image/test/mochitest/test_has_transparency.html b/image/test/mochitest/test_has_transparency.html
index 482aaf96b9..cec8edfe78 100644
--- a/image/test/mochitest/test_has_transparency.html
+++ b/image/test/mochitest/test_has_transparency.html
@@ -80,11 +80,11 @@ function loadNext() {
   gImg.setAttribute("src", currentFile);
 }
 
-function onHasTransparency(aRequest) {
+function onHasTransparency() {
   gHasTransparencyWasCalled = true;
 }
 
-function onDecodeComplete(aRequest) {
+function onDecodeComplete() {
   if (!gCurrentFileIsTransparent) {
     ok(!gHasTransparencyWasCalled,
        "onHasTransparency was not called for non-transparent file " + gImg.src);
diff --git a/image/test/mochitest/test_net_failedtoprocess.html b/image/test/mochitest/test_net_failedtoprocess.html
index 95ab5c0cc3..5d731f2234 100644
--- a/image/test/mochitest/test_net_failedtoprocess.html
+++ b/image/test/mochitest/test_net_failedtoprocess.html
@@ -30,7 +30,7 @@ var observer = {
     throw Components.Exception("", Cr.NS_ERROR_NO_INTERFACE);
   },
 
-  observe(subject, topic, data) {
+  observe(subject, topic) {
     ok(topic == "net:failed-to-process-uri-content", "wrong topic");
     subject = subject.QueryInterface(Ci.nsIURI);
     is(subject.asciiSpec, `${location.origin}/tests/image/test/mochitest/invalid.jpg`, "wrong subject");
diff --git a/image/test/mochitest/test_removal_ondecode.html b/image/test/mochitest/test_removal_ondecode.html
index 4ce7555757..b764c8e2ed 100644
--- a/image/test/mochitest/test_removal_ondecode.html
+++ b/image/test/mochitest/test_removal_ondecode.html
@@ -45,7 +45,7 @@ function* fileToLoad() {
   yield "rillybad.jpg";
 }
 
-function onSizeAvailable(aRequest) {
+function onSizeAvailable() {
   ok(true, "AfterLoad.onSizeAvailable called for " + gImg.src);
 }
 function onLoadComplete(aRequest) {
@@ -68,7 +68,7 @@ function onLoadComplete(aRequest) {
   }
 }
 
-function onDecodeComplete(aRequest) {
+function onDecodeComplete() {
   ok(gExpected > gRemovals, "AfterLoad.onDecodeComplete called for " + gImg.src);
   SimpleTest.executeSoon(function() {
     try {
diff --git a/image/test/mochitest/test_removal_onload.html b/image/test/mochitest/test_removal_onload.html
index 0a060542f5..288b987f2e 100644
--- a/image/test/mochitest/test_removal_onload.html
+++ b/image/test/mochitest/test_removal_onload.html
@@ -45,10 +45,10 @@ function* fileToLoad() {
   yield "rillybad.jpg";
 }
 
-function onSizeAvailable(aRequest) {
+function onSizeAvailable() {
   ok(true, "AfterLoad.onSizeAvailable called for " + gImg.src);
 }
-function onLoadComplete(aRequest) {
+function onLoadComplete() {
   ok(gExpected > gLoads, "AfterLoad.onLoadComplete called for " + gImg.src);
   gLoads++;
   SimpleTest.executeSoon(function() {
@@ -60,7 +60,7 @@ function onLoadComplete(aRequest) {
     maybeAdvance();
   });
 }
-function onDecodeComplete(aRequest) {
+function onDecodeComplete() {
   ok(true, "AfterLoad.onDecodeComplete called for " + gImg.src);
 }
 
-- 
cgit v1.2.3