Bug 1941128 - Turn off network.dns.native_https_query on Mac again
[gecko.git] / dom / svg / test / test_animLengthObjectIdentity.xhtml
blobb4bce755b9eb58b61cbd64f344e79ebb11983b5f
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=508496
4 -->
5 <head>
6 <title>Test for object identity of SVG animated lengths</title>
7 <script src="/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 </head>
10 <body>
11 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=506856">Mozilla Bug 508496</a>
12 <p id="display"></p>
13 <div id="content" style="display: none">
14 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="120px" height="120px"
15 onload="this.pauseAnimations()">
16 <circle cx="-100" cy="-100" r="15" fill="blue" id="circle">
17 <animate attributeName="cx" from="0" to="100" dur="4s" begin="1s; 10s"
18 fill="freeze" id="animate"/>
19 </circle>
20 </svg>
21 </div>
22 <pre id="test">
23 <script class="testbody" type="text/javascript">
24 <![CDATA[
25 /** Test object identity of animated lengths **/
27 /* Global Variables */
28 const svgns = "http://www.w3.org/2000/svg";
29 var svg = document.getElementById("svg");
30 var circle = document.getElementById("circle");
32 SimpleTest.waitForExplicitFinish();
34 function main() {
35 ok(svg.animationsPaused(), "should be paused by <svg> load handler");
36 is(svg.getCurrentTime(), 0, "should be paused at 0 in <svg> load handler");
38 var animLength = circle.cx;
39 ok(animLength === circle.cx,
40 "Got different SVGAnimatedLength objects at startup");
42 var baseVal = circle.cx.baseVal;
43 ok(baseVal === circle.cx.baseVal,
44 "Got different baseVal SVGLength objects at startup");
46 var animVal = circle.cx.animVal;
47 ok(animVal === circle.cx.animVal,
48 "Got different animVal SVGLength objects at startup");
50 var animate = document.getElementById("animate");
51 if (animate && animate.targetElement) {
52 // Sample mid-way through the animation
53 svg.setCurrentTime(5);
55 ok(animLength === circle.cx,
56 "Got different SVGAnimatedLength objects during animation");
57 ok(baseVal === circle.cx.baseVal,
58 "Got different baseVal SVGLength objects during animation");
59 ok(animVal === circle.cx.animVal,
60 "Got different animVal SVGLength objects during animation");
63 // Drop all references to the tear off objects
64 var oldValue = circle.cx.animVal.value; // Just a float, not an object ref
65 animLength = null;
66 baseVal = null;
67 animVal = null;
68 SpecialPowers.gc();
70 // The tearoff objects should no longer exist and we should create new ones.
71 // If somehow, the tearoff objects have died and yet not been removed from the
72 // hashmap we'll end up in all sorts of trouble when we try to access them.
73 // So in the following, we're not really interested in the value, just that we
74 // don't crash.
75 is(circle.cx.animVal.value, oldValue,
76 "Unexpected result accessing new(?) length object.");
78 SimpleTest.finish();
81 window.addEventListener("load", main);
82 ]]>
83 </script>
84 </pre>
85 </body>
86 </html>