author David Major <>
Wed, 20 Dec 2017 09:07:46 -0500
changeset 448763 e9cfe039a796e2963a6d3e7d2a161b02cdbadcac
parent 374655 7b434711753b98a87603453caaa0945791ffe12b
child 528458 ba6f655fd68963530c866d0d4a48c3db3d307777
permissions -rw-r--r--
Bug 1425906: Rename LINK to LINKER throughout the build system. r=glandium Windows linkers give special meaning to getenv("LINK"), which makes `export LINK=...` in mozconfigs do unexpected things.

<html xmlns="">
  <title>Test for Bug 699143</title>
  <script type="text/javascript" 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"/>
<a target="_blank" href="">Mozilla Bug 699143</a>
<p id="display"></p>
<div id="content" style="display: none">
  <svg xmlns="">
    <rect id="r" height="500px" width="500px" fill="blue"/>
<pre id="test">
<script type="text/javascript">

/** Test for Bug 699143 **/

// 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('', '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.)

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.

  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();
  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
  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.
  is(r.width.animVal.valueAsString, INITIAL_VAL,
     "after rewinding to 0, our beginElement()-generated interval " +
     "shouldn't be active yet");


window.addEventListener("load", main);