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.

michael@0 1 //Shell version of Clock Benchmark: https://bug548388.bugzilla.mozilla.org/attachment.cgi?id=434576
michael@0 2
michael@0 3 var t0;
michael@0 4 var tl;
michael@0 5
michael@0 6 function alloc(dt) {
michael@0 7 if (dt > 100)
michael@0 8 dt = 100;
michael@0 9 for (var i = 0; i < dt * 1000; ++i) {
michael@0 10 var o = new String("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
michael@0 11 }
michael@0 12 }
michael@0 13
michael@0 14 function cycle() {
michael@0 15 if (!running)
michael@0 16 return;
michael@0 17
michael@0 18 var t1 = new Date;
michael@0 19 if (t0 == undefined) t0 = t1;
michael@0 20
michael@0 21 if (tl != undefined) {
michael@0 22 var dt = t1 - tl;
michael@0 23 alloc(dt);
michael@0 24 }
michael@0 25
michael@0 26 tl = t1;
michael@0 27
michael@0 28 if(t1 - t0 > (5 * 1000))
michael@0 29 running = false;
michael@0 30 }
michael@0 31
michael@0 32 var running = true;
michael@0 33 while(running)
michael@0 34 cycle();
michael@0 35

mercurial