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 | var gDebuggee; |
michael@0 | 5 | var gClient; |
michael@0 | 6 | var gThreadClient; |
michael@0 | 7 | |
michael@0 | 8 | // Test that closures can be inspected. |
michael@0 | 9 | |
michael@0 | 10 | function run_test() |
michael@0 | 11 | { |
michael@0 | 12 | initTestDebuggerServer(); |
michael@0 | 13 | gDebuggee = addTestGlobal("test-closures"); |
michael@0 | 14 | |
michael@0 | 15 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 16 | gClient.connect(function() { |
michael@0 | 17 | attachTestTabAndResume(gClient, "test-closures", function(aResponse, aTabClient, aThreadClient) { |
michael@0 | 18 | gThreadClient = aThreadClient; |
michael@0 | 19 | test_object_grip(); |
michael@0 | 20 | }); |
michael@0 | 21 | }); |
michael@0 | 22 | do_test_pending(); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | function test_object_grip() |
michael@0 | 26 | { |
michael@0 | 27 | gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
michael@0 | 28 | let person = aPacket.frame.environment.bindings.variables.person; |
michael@0 | 29 | |
michael@0 | 30 | do_check_eq(person.value.class, "Object"); |
michael@0 | 31 | |
michael@0 | 32 | let personClient = gThreadClient.pauseGrip(person.value); |
michael@0 | 33 | personClient.getPrototypeAndProperties(aResponse => { |
michael@0 | 34 | do_check_eq(aResponse.ownProperties.getName.value.class, "Function"); |
michael@0 | 35 | |
michael@0 | 36 | do_check_eq(aResponse.ownProperties.getAge.value.class, "Function"); |
michael@0 | 37 | |
michael@0 | 38 | do_check_eq(aResponse.ownProperties.getFoo.value.class, "Function"); |
michael@0 | 39 | |
michael@0 | 40 | let getNameClient = gThreadClient.pauseGrip(aResponse.ownProperties.getName.value); |
michael@0 | 41 | let getAgeClient = gThreadClient.pauseGrip(aResponse.ownProperties.getAge.value); |
michael@0 | 42 | let getFooClient = gThreadClient.pauseGrip(aResponse.ownProperties.getFoo.value); |
michael@0 | 43 | getNameClient.getScope(aResponse => { |
michael@0 | 44 | do_check_eq(aResponse.scope.bindings.arguments[0].name.value, "Bob"); |
michael@0 | 45 | |
michael@0 | 46 | getAgeClient.getScope(aResponse => { |
michael@0 | 47 | do_check_eq(aResponse.scope.bindings.arguments[1].age.value, 58); |
michael@0 | 48 | |
michael@0 | 49 | getFooClient.getScope(aResponse => { |
michael@0 | 50 | do_check_eq(aResponse.scope.bindings.variables.foo.value, 10); |
michael@0 | 51 | |
michael@0 | 52 | gThreadClient.resume(() => finishClient(gClient)); |
michael@0 | 53 | }); |
michael@0 | 54 | }); |
michael@0 | 55 | }); |
michael@0 | 56 | }); |
michael@0 | 57 | |
michael@0 | 58 | }); |
michael@0 | 59 | |
michael@0 | 60 | gDebuggee.eval("(" + function() { |
michael@0 | 61 | var PersonFactory = function(name, age) { |
michael@0 | 62 | var foo = 10; |
michael@0 | 63 | return { |
michael@0 | 64 | getName: function() { return name; }, |
michael@0 | 65 | getAge: function() { return age; }, |
michael@0 | 66 | getFoo: function() { foo = Date.now(); return foo; } |
michael@0 | 67 | }; |
michael@0 | 68 | }; |
michael@0 | 69 | var person = new PersonFactory("Bob", 58); |
michael@0 | 70 | debugger; |
michael@0 | 71 | } + ")()"); |
michael@0 | 72 | } |