diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/svg/test/test_animLengthObjectIdentity.xhtml | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/svg/test/test_animLengthObjectIdentity.xhtml')
-rw-r--r-- | dom/svg/test/test_animLengthObjectIdentity.xhtml | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/dom/svg/test/test_animLengthObjectIdentity.xhtml b/dom/svg/test/test_animLengthObjectIdentity.xhtml new file mode 100644 index 000000000..af6ababd5 --- /dev/null +++ b/dom/svg/test/test_animLengthObjectIdentity.xhtml @@ -0,0 +1,86 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=508496 +--> +<head> + <title>Test for object identity of SVG animated lengths</title> + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.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=506856">Mozilla Bug 508496</a> +<p id="display"></p> +<div id="content" style="display: none"> +<svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px" + onload="this.pauseAnimations()"> + <circle cx="-100" cy="-100" r="15" fill="blue" id="circle"> + <animate attributeName="cx" from="0" to="100" dur="4s" begin="1s; 10s" + fill="freeze" id="animate"/> + </circle> +</svg> +</div> +<pre id="test"> +<script class="testbody" type="text/javascript"> +<![CDATA[ +/** Test object identity of animated lengths **/ + +/* Global Variables */ +const svgns="http://www.w3.org/2000/svg"; +var svg = document.getElementById("svg"); +var circle = document.getElementById('circle'); + +SimpleTest.waitForExplicitFinish(); + +function main() { + ok(svg.animationsPaused(), "should be paused by <svg> load handler"); + is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler"); + + var animLength = circle.cx; + ok(animLength === circle.cx, + "Got different SVGAnimatedLength objects at startup"); + + var baseVal = circle.cx.baseVal; + ok(baseVal === circle.cx.baseVal, + "Got different baseVal SVGLength objects at startup"); + + var animVal = circle.cx.animVal; + ok(animVal === circle.cx.animVal, + "Got different animVal SVGLength objects at startup"); + + var animate = document.getElementById('animate'); + if (animate && animate.targetElement) { + // Sample mid-way through the animation + svg.setCurrentTime(5); + + ok(animLength === circle.cx, + "Got different SVGAnimatedLength objects during animation"); + ok(baseVal === circle.cx.baseVal, + "Got different baseVal SVGLength objects during animation"); + ok(animVal === circle.cx.animVal, + "Got different animVal SVGLength objects during animation"); + } + + // Drop all references to the tear off objects + var oldValue = circle.cx.animVal.value; // Just a float, not an object ref + animLength = null; + baseVal = null; + animVal = null; + SpecialPowers.gc(); + + // The tearoff objects should no longer exist and we should create new ones. + // If somehow, the tearoff objects have died and yet not been removed from the + // hashmap we'll end up in all sorts of trouble when we try to access them. + // So in the following, we're not really interested in the value, just that we + // don't crash. + is(circle.cx.animVal.value, oldValue, + "Unexpected result accessing new(?) length object."); + + SimpleTest.finish(); +} + +window.addEventListener("load", main, false); +]]> +</script> +</pre> +</body> +</html> |