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 | /* -*- Mode: javascript; js-indent-level: 2; -*- */ |
michael@0 | 2 | /* Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ */ |
michael@0 | 4 | |
michael@0 | 5 | var gDebuggee; |
michael@0 | 6 | var gClient; |
michael@0 | 7 | var gThreadClient; |
michael@0 | 8 | |
michael@0 | 9 | // This test ensures that we can create SourceActors and SourceClients properly, |
michael@0 | 10 | // and that they can communicate over the protocol to fetch the source text for |
michael@0 | 11 | // a given script. |
michael@0 | 12 | |
michael@0 | 13 | function run_test() |
michael@0 | 14 | { |
michael@0 | 15 | initTestDebuggerServer(); |
michael@0 | 16 | gDebuggee = addTestGlobal("test-grips"); |
michael@0 | 17 | Cu.evalInSandbox( |
michael@0 | 18 | "" + function stopMe(arg1) { |
michael@0 | 19 | debugger; |
michael@0 | 20 | }, |
michael@0 | 21 | gDebuggee, |
michael@0 | 22 | "1.8", |
michael@0 | 23 | getFileUrl("test_source-01.js") |
michael@0 | 24 | ); |
michael@0 | 25 | |
michael@0 | 26 | gClient = new DebuggerClient(DebuggerServer.connectPipe()); |
michael@0 | 27 | gClient.connect(function() { |
michael@0 | 28 | attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { |
michael@0 | 29 | gThreadClient = aThreadClient; |
michael@0 | 30 | test_source(); |
michael@0 | 31 | }); |
michael@0 | 32 | }); |
michael@0 | 33 | do_test_pending(); |
michael@0 | 34 | } |
michael@0 | 35 | |
michael@0 | 36 | const SOURCE_URL = "http://example.com/foobar.js"; |
michael@0 | 37 | const SOURCE_CONTENT = "stopMe()"; |
michael@0 | 38 | |
michael@0 | 39 | function test_source() |
michael@0 | 40 | { |
michael@0 | 41 | DebuggerServer.LONG_STRING_LENGTH = 200; |
michael@0 | 42 | |
michael@0 | 43 | gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { |
michael@0 | 44 | gThreadClient.getSources(function (aResponse) { |
michael@0 | 45 | do_check_true(!!aResponse); |
michael@0 | 46 | do_check_true(!!aResponse.sources); |
michael@0 | 47 | |
michael@0 | 48 | let source = aResponse.sources.filter(function (s) { |
michael@0 | 49 | return s.url === SOURCE_URL; |
michael@0 | 50 | })[0]; |
michael@0 | 51 | |
michael@0 | 52 | do_check_true(!!source); |
michael@0 | 53 | |
michael@0 | 54 | let sourceClient = gThreadClient.source(source); |
michael@0 | 55 | sourceClient.source(function (aResponse) { |
michael@0 | 56 | do_check_true(!!aResponse); |
michael@0 | 57 | do_check_true(!aResponse.error); |
michael@0 | 58 | do_check_true(!!aResponse.contentType); |
michael@0 | 59 | do_check_true(aResponse.contentType.contains("javascript")); |
michael@0 | 60 | |
michael@0 | 61 | do_check_true(!!aResponse.source); |
michael@0 | 62 | do_check_eq(SOURCE_CONTENT, |
michael@0 | 63 | aResponse.source); |
michael@0 | 64 | |
michael@0 | 65 | gThreadClient.resume(function () { |
michael@0 | 66 | finishClient(gClient); |
michael@0 | 67 | }); |
michael@0 | 68 | }); |
michael@0 | 69 | }); |
michael@0 | 70 | }); |
michael@0 | 71 | |
michael@0 | 72 | Cu.evalInSandbox( |
michael@0 | 73 | SOURCE_CONTENT, |
michael@0 | 74 | gDebuggee, |
michael@0 | 75 | "1.8", |
michael@0 | 76 | SOURCE_URL |
michael@0 | 77 | ); |
michael@0 | 78 | } |