SimpleTest.requestFlakyTimeout("Pre-existing timeouts when converting from mochitest-chrome");
SimpleTest.requestCompleteLog();
SimpleTest.waitForExplicitFinish();
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
var gMyDecoderObserver; // value will be set in main() var gReferenceSnapshot; // value will be set in takeReferenceSnapshot() var gPollCounter = 0; var gIsTestFinished = false; var gSVGImages = [ "lime-anim-100x100.svg", // SMIL animation "lime-css-anim-100x100.svg" // CSS animation
] var gSVGCurrentImage = 0;
function takeReferenceSnapshot() {
// Take a snapshot of the initial (essentially blank) page
let blankSnapshot = snapshotWindow(window, false);
// Show reference div, & take a snapshot
let referenceDiv = document.getElementById("referenceDiv");
referenceDiv.style.display = "block";
gReferenceSnapshot = snapshotWindow(window, false);
ok(compareSnapshots(blankSnapshot, gReferenceSnapshot, false)[0], "reference snapshot shouldn't match blank page snapshot");
// Re-hide reference div, and take another snapshot to be sure it's gone
referenceDiv.style.display = "none";
let blankSnapshot2 = snapshotWindow(window, false);
ok(compareSnapshots(blankSnapshot, blankSnapshot2, true)[0], "reference div should disappear when it becomes display:none");
}
function loadNextImageAndPoll()
{
// kick off image-loading! onload/onerror handlers call myPoll to handles
// the rest.
gListen = true;
gImg.setAttribute("src", gSVGImages[gSVGCurrentImage]);
}
function myPoll() {
gPollCounter++;
ok(true, "myPoll called");
let currentSnapshot = snapshotWindow(window, false);
if (compareSnapshots(currentSnapshot, gReferenceSnapshot, true)[0]) {
// SUCCESS!
ok(true, "Animated image looks correct, " + "at call #" + gPollCounter + " to myPoll");
function failTest() {
ok(false, "timing out after " + FAILURE_TIMEOUT + "ms. " + "Animated image still doesn't look correct, " + "after call #" + gPollCounter + " to myPoll");
cleanUpAndFinish();
}
function cleanUpAndFinish() {
// On the off chance that failTest and myPoll are triggered
// back-to-back, use a flag to prevent multiple calls to SimpleTest.finish.
if (gIsTestFinished) {
return;
}
SimpleTest.finish();
gIsTestFinished = true;
}
function main() {
takeReferenceSnapshot();
// We want to test the cold loading behavior, so clear cache in case an
// earlier test got our image in there already.
clearAllImageCaches();
loadNextImageAndPoll();
// In case something goes wrong, fail earlier than mochitest timeout,
// and with more information.
setTimeout(failTest, FAILURE_TIMEOUT);
}
window.onload = main;
</script>
</pre>
</body>
</html>
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.23 Sekunden
(vorverarbeitet am 2026-04-26)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.