Bug 704482 patch 3: Mochitest to verify that we still allow certain whitelisted events to trigger SMIL animations in script-disabled environments. r=birtles r=jwir3
--HG-- rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-SVGLoad.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-begin.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-beginEvent.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-end.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-endEvent.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-repeat.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-repeatEvent.svg rename : image/test/mochitest/lime-anim-100x100.svg => image/test/mochitest/smil-event-repeatN.svg rename : image/test/mochitest/test_changeOfSource.html => image/test/mochitest/test_smilEventsAllowedInImages.html
@ -104,6 +104,15 @@ _CHROME_FILES = imgutils.js \
|
|||||||
animated-gif2.gif \
|
animated-gif2.gif \
|
||||||
purple.gif \
|
purple.gif \
|
||||||
test_svg_animatedGIF.html \
|
test_svg_animatedGIF.html \
|
||||||
|
smil-event-begin.svg \
|
||||||
|
smil-event-beginEvent.svg \
|
||||||
|
smil-event-end.svg \
|
||||||
|
smil-event-endEvent.svg \
|
||||||
|
smil-event-repeat.svg \
|
||||||
|
smil-event-repeatEvent.svg \
|
||||||
|
smil-event-repeatN.svg \
|
||||||
|
smil-event-SVGLoad.svg \
|
||||||
|
test_smilEventsAllowedInImages.html \
|
||||||
test_bullet_animation.html \
|
test_bullet_animation.html \
|
||||||
test_background_image_anim.html \
|
test_background_image_anim.html \
|
||||||
filter.svg \
|
filter.svg \
|
||||||
|
28
image/test/mochitest/smil-event-SVGLoad.svg
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses a valid event "SVGLoad" that isn't whitelisted in
|
||||||
|
script-disabled contexts. So when this file is viewed as an image,
|
||||||
|
the SVGLoad-triggered animation shouldn't fire. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100" id="svg">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- After 100ms, we slide in this lime rect and succeed -->
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="0.1"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
|
||||||
|
<!-- HOWEVER, if the following "bad" animation successfully registers to
|
||||||
|
trigger off of "SVGLoad" (which it shouldn't, inside of an image), then
|
||||||
|
this orange rect will slide in first and cover up the lime rect's
|
||||||
|
destination area, blocking it from view.
|
||||||
|
|
||||||
|
NOTE: SVGLoad corresponds to "time 0" in the SMIL timeline. So if the
|
||||||
|
"bad" animation fires, it'll run before the other one (and will get in
|
||||||
|
the way before the lime rect is onscreen, making the test fail). -->
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="orange">
|
||||||
|
<animate attributeName="x" by="600" begin="svg.SVGLoad"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
15
image/test/mochitest/smil-event-begin.svg
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses syncbase-timing with "begin". -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.begin"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 577 B |
16
image/test/mochitest/smil-event-beginEvent.svg
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses the event "beginEvent", which is whitelisted as
|
||||||
|
being usable in script-disabled contexts. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.beginEvent"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 647 B |
15
image/test/mochitest/smil-event-end.svg
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses syncbase-timing with "end". -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0" dur="0.01s"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.end"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 585 B |
16
image/test/mochitest/smil-event-endEvent.svg
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses the event "endEvent", which is whitelisted as
|
||||||
|
being usable in script-disabled contexts. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0" dur="0.01s"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.endEvent"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 655 B |
16
image/test/mochitest/smil-event-repeat.svg
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses the event "repeat", which is whitelisted as
|
||||||
|
being usable in script-disabled contexts. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0" dur="0.01s" repeatCount="2"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.repeat"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 667 B |
16
image/test/mochitest/smil-event-repeatEvent.svg
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses the event "repeatEvent", which is whitelisted as
|
||||||
|
being usable in script-disabled contexts. -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0" dur="0.01s" repeatCount="2"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.repeatEvent"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 677 B |
15
image/test/mochitest/smil-event-repeatN.svg
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<!-- Helper file for test_smilEventsAllowedInImages.html
|
||||||
|
This testcase uses repeat-based timing with "repeat(2)". -->
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" version="1.1"
|
||||||
|
width="100" height="100">
|
||||||
|
<!-- Red rect for initial bad rendering -->
|
||||||
|
<rect width="100%" height="100%" fill="red"/>
|
||||||
|
|
||||||
|
<!-- dummy animation that our real animation registers to listen to -->
|
||||||
|
<set id="trigger" begin="0" dur="0.01s" repeatCount="2"/>
|
||||||
|
|
||||||
|
<rect x="-600" width="100%" height="100%" fill="lime">
|
||||||
|
<animate attributeName="x" by="600" begin="trigger.repeat(1)"
|
||||||
|
dur="0.1" fill="freeze"/>
|
||||||
|
</rect>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 617 B |
86
image/test/mochitest/test_smilEventsAllowedInImages.html
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
https://bugzilla.mozilla.org/show_bug.cgi?id=704482
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for Bug 704482</title>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"></script>
|
||||||
|
<script type="application/javascript" src="imgutils.js"></script>
|
||||||
|
<script type="application/javascript" src="animationPolling.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=704482">
|
||||||
|
Mozilla Bug 704482
|
||||||
|
</a>
|
||||||
|
<p id="display"></p>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<div id="referenceDiv" style="height: 100px; width: 100px;
|
||||||
|
display: none; background: lime;">
|
||||||
|
</div>
|
||||||
|
<div id="animatedImage">
|
||||||
|
<img id="img" style="display: none">
|
||||||
|
</div>
|
||||||
|
<div id="debug" style="display: none">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="text/javascript;version=1.8">
|
||||||
|
const FAILURE_TIMEOUT = 120000; // Fail early after 120 seconds (2 minutes)
|
||||||
|
|
||||||
|
var gIntervalId;
|
||||||
|
var gImageList = [
|
||||||
|
"smil-event-begin.svg",
|
||||||
|
"smil-event-beginEvent.svg",
|
||||||
|
"smil-event-end.svg",
|
||||||
|
"smil-event-endEvent.svg",
|
||||||
|
"smil-event-repeat.svg",
|
||||||
|
"smil-event-repeatEvent.svg",
|
||||||
|
"smil-event-repeatN.svg",
|
||||||
|
"smil-event-SVGLoad.svg",
|
||||||
|
];
|
||||||
|
var gNextImageIdx = 0;
|
||||||
|
|
||||||
|
const gImageElem = document.getElementById("img");
|
||||||
|
const gRefElem = document.getElementById("referenceDiv");
|
||||||
|
const gDebugElem = document.getElementById("debug");
|
||||||
|
|
||||||
|
function preTestCleanup() {
|
||||||
|
gImageElem.removeAttribute("src");
|
||||||
|
gImageElem.style.display = "none";
|
||||||
|
gRefElem.style.display = "none";
|
||||||
|
gDebugElem.style.display = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
function beginNextTest() {
|
||||||
|
preTestCleanup();
|
||||||
|
|
||||||
|
let curImageIdx = gNextImageIdx++;
|
||||||
|
|
||||||
|
ok(curImageIdx < gImageList.length,
|
||||||
|
"test sanity-check -- shouldn't iterate past end of JS array");
|
||||||
|
|
||||||
|
gImageElem.setAttribute("src", gImageList[curImageIdx]);
|
||||||
|
|
||||||
|
let nextAction = (gNextImageIdx == gImageList.length ? null : beginNextTest);
|
||||||
|
|
||||||
|
let newTest = new AnimationTest(100, FAILURE_TIMEOUT, "referenceDiv",
|
||||||
|
"img", "debug" , "", "", false,
|
||||||
|
nextAction);
|
||||||
|
newTest.beginTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
function main()
|
||||||
|
{
|
||||||
|
beginNextTest();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = main;
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|