summaryrefslogtreecommitdiffstats
path: root/image/test/mochitest
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /image/test/mochitest
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz
firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'image/test/mochitest')
-rw-r--r--image/test/mochitest/1835509.gifbin0 -> 552 bytes
-rw-r--r--image/test/mochitest/imgutils.js16
-rw-r--r--image/test/mochitest/mochitest.toml1
-rw-r--r--image/test/mochitest/test_animSVGImage2.html2
-rw-r--r--image/test/mochitest/test_animation_operators.html2
-rw-r--r--image/test/mochitest/test_bug601470.html2
-rw-r--r--image/test/mochitest/test_discardAnimatedImage.html41
-rw-r--r--image/test/mochitest/test_discardFinishedAnimatedImage.html2
-rw-r--r--image/test/mochitest/test_has_transparency.html4
-rw-r--r--image/test/mochitest/test_net_failedtoprocess.html2
-rw-r--r--image/test/mochitest/test_removal_ondecode.html4
-rw-r--r--image/test/mochitest/test_removal_onload.html6
12 files changed, 54 insertions, 28 deletions
diff --git a/image/test/mochitest/1835509.gif b/image/test/mochitest/1835509.gif
new file mode 100644
index 0000000000..46a0cb5b65
--- /dev/null
+++ b/image/test/mochitest/1835509.gif
Binary files 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
<div id="content">
<div id="container">
<canvas id="canvas" width="100" height="100"></canvas>
+
+ <!-- NOTE if adding a new image here you need to adjust four other places:
+ * add it to the gImgs array below
+ * add it to the 4 arrays below that
+ * add it to the condition in checkIfFinished if it's infinite
+ * potentially update the starting index of finite imgs in
+ addCallbacks observer.discard.
+ -->
<img id="infinitepng" src="infinite-apng.png">
<img id="infinitegif" src="animated1.gif">
<img id="infinitewebp" src="infinite.webp">
<img id="infiniteavif" src="infinite.avif">
+
+ <img id="corruptinfinitegif" src="1835509.gif">
+
<img id="finitepng" src="restore-previous.png">
<img id="finitegif" src="animated-gif.gif">
<img id="finitewebp" src="keep.webp">
<img id="finiteavif" src="animated-avif.avif">
+ <!-- NOTE see above the steps you need to do if adding an img here -->
+
</div>
</div>
<pre id="test">
@@ -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);
}