gecko-dev/dom/svg/test/test_animLengthObjectIdentity.xhtml
Brian Grinstead 0d460e3432 Bug 1544322 - Part 2.2 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in dom/ r=bzbarsky
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

--HG--
extra : moz-landing-system : lando
2019-04-16 03:53:28 +00:00

87 lines
2.8 KiB
HTML

<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 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);
]]>
</script>
</pre>
</body>
</html>