dom/smil/test/test_smilInvalidValues.html

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 <!doctype html>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=941315
     5 -->
     6 <head>
     7   <meta charset="utf-8">
     8   <title>Test invalid values cause the model to be updated (bug 941315)</title>
     9   <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=941315">Mozilla Bug 941315</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    16 <svg width="100%" height="1" onload="this.pauseAnimations()">
    17   <rect>
    18     <animate id="a" dur="100s"/>
    19     <animate id="b" dur="5s" begin="a.end"/>
    20   </rect>
    21   <circle cx="-100" cy="20" r="15" fill="blue" id="circle"/>
    22 </svg>
    23 </div>
    24 <pre id="test">
    25 <script class="testbody" type="text/javascript">
    26   var a = $('a'),
    27       b = $('b');
    29   // Animation doesn't start until onload
    30   SimpleTest.waitForExplicitFinish();
    31   window.addEventListener("load", runTests, false);
    33   // Make testing getStartTime easier
    34   SVGAnimationElement.prototype.safeGetStartTime = function() {
    35     try {
    36       return this.getStartTime();
    37     } catch(e) {
    38       if (e.name == "InvalidStateError" &&
    39           e.code == DOMException.INVALID_STATE_ERR) {
    40         return 'none';
    41       } else {
    42         ok(false, "Unexpected exception: " + e);
    43         return null;
    44       }
    45     }
    46   };
    48   function runTests() {
    49     [testSimpleDuration, testMin, testMax, testRepeatDur, testRepeatCount]
    50       .forEach(function(test) {
    51         ise(b.getStartTime(), 100, "initial state before running " + test.name);
    52         test();
    53         ise(b.getStartTime(), 100, "final state after running " + test.name);
    54       });
    55     SimpleTest.finish();
    56   }
    58   function testSimpleDuration() {
    59     // Verify a valid value updates as expected
    60     a.setAttribute("dur", "50s");
    61     ise(b.safeGetStartTime(), 50, "valid simple duration");
    63     // Check an invalid value also causes the model to be updated
    64     a.setAttribute("dur", "abc"); // -> indefinite
    65     ise(b.safeGetStartTime(), "none", "invalid simple duration");
    67     // Restore state
    68     a.setAttribute("dur", "100s");
    69   }
    71   function testMin() {
    72     a.setAttribute("min", "200s");
    73     ise(b.safeGetStartTime(), 200, "valid min duration");
    75     a.setAttribute("min", "abc"); // -> indefinite
    76     ise(b.safeGetStartTime(), 100, "invalid min duration");
    78     a.removeAttribute("min");
    79   }
    81   function testMax() {
    82     a.setAttribute("max", "50s");
    83     ise(b.safeGetStartTime(), 50, "valid max duration");
    85     a.setAttribute("max", "abc"); // -> indefinite
    86     ise(b.safeGetStartTime(), 100, "invalid max duration");
    88     a.removeAttribute("max");
    89   }
    91   function testRepeatDur() {
    92     a.setAttribute("repeatDur", "200s");
    93     ise(b.safeGetStartTime(), 200, "valid repeatDur duration");
    95     a.setAttribute("repeatDur", "abc"); // -> indefinite
    96     ise(b.safeGetStartTime(), 100, "invalid repeatDur duration");
    98     a.removeAttribute("repeatDur");
    99   }
   101   function testRepeatCount() {
   102     a.setAttribute("repeatCount", "2");
   103     ise(b.safeGetStartTime(), 200, "valid repeatCount duration");
   105     a.setAttribute("repeatCount", "abc"); // -> indefinite
   106     ise(b.safeGetStartTime(), 100, "invalid repeatCount duration");
   108     a.removeAttribute("repeatCount");
   109   }
   110 </script>
   111 </pre>
   112 </body>
   113 </html>

mercurial