diff options
Diffstat (limited to 'image/test')
24 files changed, 83 insertions, 53 deletions
diff --git a/image/test/browser/browser_bug666317.js b/image/test/browser/browser_bug666317.js index 7f58c61c56..5d039575c8 100644 --- a/image/test/browser/browser_bug666317.js +++ b/image/test/browser/browser_bug666317.js @@ -15,11 +15,11 @@ var gScriptedObserver; var gClonedRequest; function ImageObserver(decodeCallback, discardCallback) { - this.decodeComplete = function onDecodeComplete(aRequest) { + this.decodeComplete = function onDecodeComplete() { decodeCallback(); }; - this.discard = function onDiscard(request) { + this.discard = function onDiscard() { if (!gWaitingForDiscard) { return; } diff --git a/image/test/browser/browser_offscreen_image_in_out_of_process_iframe.js b/image/test/browser/browser_offscreen_image_in_out_of_process_iframe.js index b431902eb7..346413b602 100644 --- a/image/test/browser/browser_offscreen_image_in_out_of_process_iframe.js +++ b/image/test/browser/browser_offscreen_image_in_out_of_process_iframe.js @@ -75,14 +75,14 @@ add_task(async function () { // Returns the count of frameUpdate during |time| (in ms) period. async function observeFrameUpdate(time) { 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() {}; } // Start from the callback of setTimeout. @@ -140,7 +140,7 @@ add_task(async function () { await new Promise(resolve => requestAnimationFrame(resolve)); frameCount = await SpecialPowers.spawn(iframe, [1000], observeFrameUpdate); - ok(frameCount > 0, "There should be frameUpdate(s)"); + Assert.greater(frameCount, 0, "There should be frameUpdate(s)"); await new Promise(resolve => requestAnimationFrame(resolve)); diff --git a/image/test/browser/head.js b/image/test/browser/head.js index 29fc67a1a7..00f35babb2 100644 --- a/image/test/browser/head.js +++ b/image/test/browser/head.js @@ -27,7 +27,7 @@ function actOnMozImage(doc, id, func) { function assertPrefVal(name, val) { let boolValue = Services.prefs.getBoolPref(name); - ok(boolValue === val, `pref ${name} is set to ${val}`); + Assert.strictEqual(boolValue, val, `pref ${name} is set to ${val}`); if (boolValue !== val) { throw Error(`pref ${name} is not set to ${val}`); } @@ -121,7 +121,7 @@ async function createMozIconInFile(ext, expectSuccess = true) { await waitLoad; const icon = content.document.getElementById(`moz-icon-${_ext}-${_kSize}`); - ok(icon !== null, `got a valid ${_ext} moz-icon`); + Assert.notStrictEqual(icon, null, `got a valid ${_ext} moz-icon`); is(icon.width, _kSize, `${_kSize} px width ${_ext} moz-icon`); is(icon.height, _kSize, `${_kSize} px height ${_ext} moz-icon`); }; diff --git a/image/test/crashtests/crashtests.list b/image/test/crashtests/crashtests.list index 93dec82954..7e137b1d09 100644 --- a/image/test/crashtests/crashtests.list +++ b/image/test/crashtests/crashtests.list @@ -25,7 +25,7 @@ load 1242093-1.html load 1242778-1.png load 1249576-1.png load 1253362-1.html -skip-if(Android&&browserIsRemote) load 1355898-1.html # bug 1507207 +skip-if(Android) load 1355898-1.html # bug 1507207 load 1375842-1.html load 1413762-1.gif pref(image.downscale-during-decode.enabled,true) load 1443232-1.html diff --git a/image/test/mochitest/1835509.gif b/image/test/mochitest/1835509.gif Binary files differnew file mode 100644 index 0000000000..46a0cb5b65 --- /dev/null +++ b/image/test/mochitest/1835509.gif 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); } diff --git a/image/test/reftest/downscaling/reftest.list b/image/test/reftest/downscaling/reftest.list index f01780ffaa..9051761997 100644 --- a/image/test/reftest/downscaling/reftest.list +++ b/image/test/reftest/downscaling/reftest.list @@ -114,7 +114,7 @@ fuzzy(0-1,0-50) == downscale-orient.html downscale-orient-ref.html # =============================================== defaults pref(image.downscale-during-decode.enabled,true) -fuzzy(0-31,0-127) fuzzy-if(d2d,0-31,0-147) == downscale-1.html downscale-1-ref.html # intermittently 147 pixels on win7 accelerated only (not win8) +fuzzy(0-31,0-127) fuzzy-if(winWidget,0-31,0-147) == downscale-1.html downscale-1-ref.html # intermittently 147 pixels on win7 accelerated only (not win8) fuzzy(0-20,0-999) != downscale-2a.html?203,52,left about:blank fuzzy(0-20,0-999) != downscale-2b.html?203,52,left about:blank diff --git a/image/test/reftest/generic/reftest.list b/image/test/reftest/generic/reftest.list index 6f236399ef..5190b52a0e 100644 --- a/image/test/reftest/generic/reftest.list +++ b/image/test/reftest/generic/reftest.list @@ -3,4 +3,4 @@ skip-if(Android) != moz-icon-1.html about:blank == moz-icon-blank-1.html moz-icon-blank-1-ref.html skip-if(Android) != moz-icon-blank-1-ref.html moz-icon-blank-1-antiref.html skip-if(Android) != moz-icon-blank-1-ref.html moz-icon-blank-1-antiref2.html -fuzzy-if(OSX,44-49,335-348) fuzzy-if(winWidget,64-140,45-191) == moz-icon-blank-1-almostref.html moz-icon-blank-1-ref.html +fuzzy-if(cocoaWidget,44-49,335-348) fuzzy-if(winWidget,64-140,45-191) == moz-icon-blank-1-almostref.html moz-icon-blank-1-ref.html diff --git a/image/test/reftest/png/green10-invalidchunkname.png b/image/test/reftest/png/green10-invalidchunkname.png Binary files differnew file mode 100644 index 0000000000..6ca9cf948e --- /dev/null +++ b/image/test/reftest/png/green10-invalidchunkname.png diff --git a/image/test/reftest/png/green10.png b/image/test/reftest/png/green10.png Binary files differnew file mode 100644 index 0000000000..1aa954ba2f --- /dev/null +++ b/image/test/reftest/png/green10.png diff --git a/image/test/reftest/png/reftest.list b/image/test/reftest/png/reftest.list new file mode 100644 index 0000000000..ef3012fe7a --- /dev/null +++ b/image/test/reftest/png/reftest.list @@ -0,0 +1 @@ +== green10-invalidchunkname.png green10.png diff --git a/image/test/reftest/reftest.list b/image/test/reftest/reftest.list index 109a0676e1..9dd3a938b3 100644 --- a/image/test/reftest/reftest.list +++ b/image/test/reftest/reftest.list @@ -18,6 +18,9 @@ include pngsuite-oddsizes/reftest.list include pngsuite-palettes/reftest.list include pngsuite-zlib/reftest.list +# PNG tests +include png/reftest.list + # BMP tests skip-if(Android) include bmp/reftest.list @@ -28,7 +31,7 @@ skip-if(Android) include ico/reftest.list include jpeg/reftest.list # JXL tests -skip-if(Android||!jxl) include jxl/reftest.list +skip-if(Android||release_or_beta) include jxl/reftest.list # GIF tests include gif/reftest.list diff --git a/image/test/unit/async_load_tests.js b/image/test/unit/async_load_tests.js index f19e146314..1fdbe590e3 100644 --- a/image/test/unit/async_load_tests.js +++ b/image/test/unit/async_load_tests.js @@ -50,7 +50,7 @@ function checkClone(other_listener, aRequest) { // For as long as clone notification is synchronous, we can't test the clone state reliably. var listener = new ImageListener( null, - function (foo, bar) { + function () { do_test_finished(); } /* getCloneStopCallback(other_listener)*/ ); @@ -63,7 +63,7 @@ function checkClone(other_listener, aRequest) { } // Ensure that all the callbacks were called on aRequest. -function checkSizeAndLoad(listener, aRequest) { +function checkSizeAndLoad(listener) { Assert.notEqual(listener.state & SIZE_AVAILABLE, 0); Assert.notEqual(listener.state & LOAD_COMPLETE, 0); @@ -127,7 +127,7 @@ function checkSecondLoad() { listener.synchronous = false; } -function firstLoadDone(oldlistener, aRequest) { +function firstLoadDone() { checkSecondLoad(uri); do_test_finished(); @@ -136,7 +136,7 @@ function firstLoadDone(oldlistener, aRequest) { // Return a closure that allows us to check the stream listener's status when the // image finishes loading. function getChannelLoadImageStopCallback(streamlistener, next) { - return function channelLoadStop(imglistener, aRequest) { + return function channelLoadStop() { next(); do_test_finished(); @@ -216,7 +216,7 @@ function startImageCallback(otherCb) { return function (listener, request) { // Make sure we can load the same image immediately out of the cache. do_test_pending(); - var listener2 = new ImageListener(null, function (foo, bar) { + var listener2 = new ImageListener(null, function () { do_test_finished(); }); var outer = Cc["@mozilla.org/image/tools;1"] diff --git a/image/test/unit/image_load_helpers.js b/image/test/unit/image_load_helpers.js index 6d1e605bf5..3a97db00ca 100644 --- a/image/test/unit/image_load_helpers.js +++ b/image/test/unit/image_load_helpers.js @@ -31,12 +31,12 @@ function ImageListener(start_callback, stop_callback) { this.start_callback(this, aRequest); } }; - this.frameComplete = function onFrameComplete(aRequest) { + this.frameComplete = function onFrameComplete() { Assert.ok(!this.synchronous); this.state |= FRAME_COMPLETE; }; - this.decodeComplete = function onDecodeComplete(aRequest) { + this.decodeComplete = function onDecodeComplete() { Assert.ok(!this.synchronous); this.state |= DECODE_COMPLETE; @@ -50,7 +50,7 @@ function ImageListener(start_callback, stop_callback) { this.stop_callback(this, aRequest); } }; - this.frameUpdate = function onFrameUpdate(aRequest) {}; + this.frameUpdate = function onFrameUpdate() {}; this.isAnimated = function onIsAnimated() {}; // Initialize the synchronous flag to true to start. This must be set to |