This is split from the previous changeset since if we include dom/ the file size is too large for phabricator to handle. This is an autogenerated commit to handle scripts loading mochitest harness files, in the simple case where the script src is on the same line as the tag. This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170 using the `--part 2` argument. Differential Revision: https://phabricator.services.mozilla.com/D27457
104 lines
3.2 KiB
HTML
104 lines
3.2 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=699143
|
|
-->
|
|
<head>
|
|
<title>Test for Bug 699143</title>
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<script type="text/javascript" src="smilTestUtils.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=699143">Mozilla Bug 699143</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
<svg xmlns="http://www.w3.org/2000/svg">
|
|
<rect id="r" height="500px" width="500px" fill="blue"/>
|
|
</svg>
|
|
</div>
|
|
<pre id="test">
|
|
<script type="text/javascript">
|
|
<![CDATA[
|
|
|
|
/** Test for Bug 699143 **/
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
// Values for 'width' attr on the <rect> above
|
|
const INITIAL_VAL = "500px"
|
|
const FROM_VAL = "20px";
|
|
const TO_VAL = "80px";
|
|
|
|
// Helper functions
|
|
|
|
// This function allows 10ms to pass
|
|
function allowTimeToPass() {
|
|
var initialDate = new Date();
|
|
while (new Date() - initialDate < 10) {}
|
|
}
|
|
|
|
// This function returns a newly created <animate> element for use in this test
|
|
function createAnim() {
|
|
var a = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
|
|
a.setAttribute('attributeName', 'width');
|
|
a.setAttribute('from', FROM_VAL);
|
|
a.setAttribute('to', TO_VAL);
|
|
a.setAttribute('begin', 'indefinite');
|
|
a.setAttribute('dur', '3s');
|
|
a.setAttribute('fill', 'freeze');
|
|
return a;
|
|
}
|
|
|
|
// Main Functions
|
|
function main() {
|
|
// In unpatched Firefox builds, we'll only trigger Bug 699143 if we insert
|
|
// an animation and call beginElement() **after** the document start-time.
|
|
// Hence, we use executeSoon here to allow some time to pass. (And then
|
|
// we'll use a short busy-loop, for good measure.)
|
|
SimpleTest.executeSoon(runTest);
|
|
}
|
|
|
|
function runTest() {
|
|
var svg = SMILUtil.getSVGRoot();
|
|
|
|
// In case our executeSoon fired immediately, we force a very small amount
|
|
// of time to pass here, using a 10ms busy-loop.
|
|
allowTimeToPass();
|
|
|
|
is(svg.getCurrentTime(), 0,
|
|
"even though we've allowed time to pass, we shouldn't have bothered " +
|
|
"updating the current time, since there aren't any animation elements");
|
|
|
|
// Insert an animation elem (should affect currentTime but not targeted attr)
|
|
var r = document.getElementById("r");
|
|
var a = createAnim();
|
|
r.appendChild(a);
|
|
isnot(svg.getCurrentTime(), 0,
|
|
"insertion of first animation element should have triggered a " +
|
|
"synchronous sample and updated our current time");
|
|
is(r.width.animVal.valueAsString, INITIAL_VAL,
|
|
"inserted animation shouldn't have affected its targeted attribute, " +
|
|
"since it doesn't have any intervals yet");
|
|
|
|
// Trigger the animation & be sure it takes effect
|
|
a.beginElement();
|
|
is(r.width.animVal.valueAsString, FROM_VAL,
|
|
"beginElement() should activate our animation & set its 'from' val");
|
|
|
|
// Rewind to time=0 & check target attr, to be sure beginElement()-generated
|
|
// interval starts later than that.
|
|
svg.setCurrentTime(0);
|
|
is(r.width.animVal.valueAsString, INITIAL_VAL,
|
|
"after rewinding to 0, our beginElement()-generated interval " +
|
|
"shouldn't be active yet");
|
|
|
|
SimpleTest.finish();
|
|
}
|
|
|
|
window.addEventListener("load", main);
|
|
|
|
]]>
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|