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: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | #include <stdio.h> |
michael@0 | 6 | #include "plstr.h" |
michael@0 | 7 | #include "nsID.h" |
michael@0 | 8 | |
michael@0 | 9 | static const char* const ids[] = { |
michael@0 | 10 | "5C347B10-D55C-11D1-89B7-006008911B81", |
michael@0 | 11 | "{5C347B10-D55C-11D1-89B7-006008911B81}", |
michael@0 | 12 | "5c347b10-d55c-11d1-89b7-006008911b81", |
michael@0 | 13 | "{5c347b10-d55c-11d1-89b7-006008911b81}", |
michael@0 | 14 | |
michael@0 | 15 | "FC347B10-D55C-F1D1-F9B7-006008911B81", |
michael@0 | 16 | "{FC347B10-D55C-F1D1-F9B7-006008911B81}", |
michael@0 | 17 | "fc347b10-d55c-f1d1-f9b7-006008911b81", |
michael@0 | 18 | "{fc347b10-d55c-f1d1-f9b7-006008911b81}", |
michael@0 | 19 | }; |
michael@0 | 20 | #define NUM_IDS ((int) (sizeof(ids) / sizeof(ids[0]))) |
michael@0 | 21 | |
michael@0 | 22 | int main(int argc, char** argv) |
michael@0 | 23 | { |
michael@0 | 24 | nsID id; |
michael@0 | 25 | for (int i = 0; i < NUM_IDS; i++) { |
michael@0 | 26 | const char* idstr = ids[i]; |
michael@0 | 27 | if (!id.Parse(idstr)) { |
michael@0 | 28 | fprintf(stderr, "TestID: Parse failed on test #%d\n", i); |
michael@0 | 29 | return -1; |
michael@0 | 30 | } |
michael@0 | 31 | char* cp = id.ToString(); |
michael@0 | 32 | if (nullptr == cp) { |
michael@0 | 33 | fprintf(stderr, "TestID: ToString failed on test #%d\n", i); |
michael@0 | 34 | return -1; |
michael@0 | 35 | } |
michael@0 | 36 | if (0 != PL_strcmp(cp, ids[4*(i/4) + 3])) { |
michael@0 | 37 | fprintf(stderr, "TestID: compare of ToString failed on test #%d\n", i); |
michael@0 | 38 | return -1; |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | return 0; |
michael@0 | 43 | } |