js/src/devtools/gc/tests/clock.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 //Shell version of Clock Benchmark: https://bug548388.bugzilla.mozilla.org/attachment.cgi?id=434576
     3 var t0;
     4 var tl;
     6 function alloc(dt) {
     7     if (dt > 100)
     8         dt = 100;
     9     for (var i = 0; i < dt * 1000; ++i) {
    10         var o = new String("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
    11     }
    12 }
    14 function cycle() {
    15     if (!running)
    16         return;
    18     var t1 = new Date;
    19     if (t0 == undefined) t0 = t1;
    21     if (tl != undefined) {
    22         var dt = t1 - tl;
    23         alloc(dt);
    24     }
    26     tl = t1;
    28     if(t1 - t0 > (5 * 1000))
    29         running = false;
    30 }
    32 var running = true;
    33 while(running)
    34     cycle();

mercurial