dom/smil/test/test_smilRepeatTiming.xhtml

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 <html xmlns="http://www.w3.org/1999/xhtml">
     2 <!--
     3 https://bugzilla.mozilla.org/show_bug.cgi?id=485157
     4 -->
     5 <head>
     6   <title>Test repeat timing</title>
     7   <script type="text/javascript" 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"
    12   href="https://bugzilla.mozilla.org/show_bug.cgi?id=485157">Mozilla Bug
    13   485157</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    16 <svg id="svg" xmlns="http://www.w3.org/2000/svg" width="100px" height="100px">
    17   <rect width="100" height="100" fill="green">
    18     <set attributeName="width" to="100" dur="20s" repeatCount="5" begin="0s"
    19       id="a" onrepeat="startWaiting(evt)"/>
    20     <set attributeName="fill" attributeType="CSS" to="green"
    21       begin="a.repeat(1)" onbegin="expectedBegin()" dur="20s"/>
    22     <set attributeName="x" to="100"
    23       begin="a.repeat(2)" onbegin="unexpectedBegin(this)" dur="20s"/>
    24     <set attributeName="y" to="100"
    25       begin="a.repeat(0)" onbegin="unexpectedBegin(this)" dur="20s"/>
    26     <set attributeName="width" to="100"
    27       begin="a.repeat(-1)" onbegin="unexpectedBegin(this)" dur="20s"/>
    28     <set attributeName="height" to="100"
    29       begin="a.repeat(a)" onbegin="unexpectedBegin(this)" dur="20s"/>
    30   </rect>
    31 </svg>
    32 </div>
    33 <pre id="test">
    34 <script class="testbody" type="text/javascript">
    35 <![CDATA[
    36 /** Test SMIL repeat timing **/
    38 /* Global Variables */
    39 const gTimeoutDur = 5000; // Time until we give up waiting for events in ms
    40 var gSvg  = document.getElementById('svg');
    41 var gRect = document.getElementById('circle');
    42 var gTimeoutID;
    43 var gGotBegin = false;
    45 SimpleTest.waitForExplicitFinish();
    47 function testBegin()
    48 {
    49   gSvg.setCurrentTime(19.999);
    50 }
    52 function startWaiting(evt)
    53 {
    54   is(evt.detail, 1, "Unexpected repeat event received: test broken");
    55   if (gGotBegin)
    56     return;
    58   gTimeoutID = setTimeout(timeoutFail, gTimeoutDur);
    59 }
    61 function timeoutFail()
    62 {
    63   ok(false, "Timed out waiting for begin event");
    64   finish();
    65 }
    67 function expectedBegin()
    68 {
    69   is(gGotBegin, false,
    70      "Got begin event more than once for non-repeating animation");
    71   gGotBegin = true;
    72   clearTimeout(gTimeoutID);
    73   // Wait a moment before finishing in case there are erroneous events waiting
    74   // to be processed.
    75   setTimeout(finish, 10);
    76 }
    78 function unexpectedBegin(elem)
    79 {
    80   ok(false, "Got unexpected begin from animation with spec: " +
    81             elem.getAttribute('begin'));
    82 }
    84 function finish()
    85 {
    86   gSvg.pauseAnimations();
    87   SimpleTest.finish();
    88 }
    90 window.addEventListener("load", testBegin, false);
    91 ]]>
    92 </script>
    93 </pre>
    94 </body>
    95 </html>

mercurial