content/media/test/seek6.js

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 function test_seek6(v, seekTime, is, ok, finish) {
     3 // Test for bug identified by Chris Pearce in comment 40 on
     4 // bug 449159.
     5 var seekCount = 0;
     6 var completed = false;
     7 var interval;
     8 var sum = 0;
    10 function poll() {
    11   sum += v.currentTime;
    12 }
    14 function startTest() {
    15   if (completed)
    16     return;
    17   interval = setInterval(poll, 10);
    18   v.currentTime = Math.random() * v.duration;
    19 }
    21 function seekEnded() {
    22   if (completed)
    23     return;
    25   seekCount++;
    26   ok(true, "Seek " + seekCount);
    27   if (seekCount == 3) {
    28     clearInterval(interval);
    29     completed = true;
    30     finish();
    31   } else {
    32     v.currentTime = Math.random() * v.duration;
    33   }
    34 }
    36 v.addEventListener("loadedmetadata", startTest, false);
    37 v.addEventListener("seeked", seekEnded, false);
    39 }

mercurial