Sat, 03 Jan 2015 20:18:00 +0100
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 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 2 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 3 | |
michael@0 | 4 | /** |
michael@0 | 5 | * Test the eventLoopLag actor. |
michael@0 | 6 | */ |
michael@0 | 7 | |
michael@0 | 8 | "use strict"; |
michael@0 | 9 | |
michael@0 | 10 | function run_test() |
michael@0 | 11 | { |
michael@0 | 12 | let {EventLoopLagFront} = devtools.require("devtools/server/actors/eventlooplag"); |
michael@0 | 13 | |
michael@0 | 14 | DebuggerServer.init(function () { return true; }); |
michael@0 | 15 | DebuggerServer.addBrowserActors(); |
michael@0 | 16 | |
michael@0 | 17 | // As seen in EventTracer.cpp |
michael@0 | 18 | let threshold = 20; |
michael@0 | 19 | let interval = 10; |
michael@0 | 20 | |
michael@0 | 21 | |
michael@0 | 22 | let front; |
michael@0 | 23 | let client = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 24 | |
michael@0 | 25 | // Start tracking event loop lags. |
michael@0 | 26 | client.connect(function () { |
michael@0 | 27 | client.listTabs(function(resp) { |
michael@0 | 28 | front = new EventLoopLagFront(client, resp); |
michael@0 | 29 | front.start().then(success => { |
michael@0 | 30 | do_check_true(success); |
michael@0 | 31 | front.once("event-loop-lag", gotLagEvent); |
michael@0 | 32 | do_execute_soon(lag); |
michael@0 | 33 | }); |
michael@0 | 34 | }); |
michael@0 | 35 | }); |
michael@0 | 36 | |
michael@0 | 37 | // Force a lag |
michael@0 | 38 | function lag() { |
michael@0 | 39 | let start = new Date(); |
michael@0 | 40 | let duration = threshold + interval + 1; |
michael@0 | 41 | while (true) { |
michael@0 | 42 | if (((new Date()) - start) > duration) { |
michael@0 | 43 | break; |
michael@0 | 44 | } |
michael@0 | 45 | } |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | // Got a lag event. The test will time out if the actor |
michael@0 | 49 | // fails to detect the lag. |
michael@0 | 50 | function gotLagEvent(time) { |
michael@0 | 51 | do_print("lag: " + time); |
michael@0 | 52 | do_check_true(time >= threshold); |
michael@0 | 53 | front.stop().then(() => { |
michael@0 | 54 | finishClient(client); |
michael@0 | 55 | }); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | do_test_pending(); |
michael@0 | 59 | } |