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 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #include "jsapi-tests/tests.h" |
michael@0 | 6 | |
michael@0 | 7 | /* |
michael@0 | 8 | * Bug 689101 - jsval is technically a non-POD type because it has a private |
michael@0 | 9 | * data member. On gcc, this doesn't seem to matter. On MSVC, this prevents |
michael@0 | 10 | * returning a jsval from a function between C and C++ because it will use a |
michael@0 | 11 | * retparam in C++ and a direct return value in C. |
michael@0 | 12 | * |
michael@0 | 13 | * Bug 712289 - jsval alignment was different on 32-bit platforms between C and |
michael@0 | 14 | * C++ because the default alignments of js::Value and jsval_layout differ. |
michael@0 | 15 | */ |
michael@0 | 16 | |
michael@0 | 17 | extern "C" { |
michael@0 | 18 | |
michael@0 | 19 | extern bool |
michael@0 | 20 | C_ValueToObject(JSContext *cx, jsval v, JSObject **obj); |
michael@0 | 21 | |
michael@0 | 22 | extern jsval |
michael@0 | 23 | C_GetEmptyStringValue(JSContext *cx); |
michael@0 | 24 | |
michael@0 | 25 | extern size_t |
michael@0 | 26 | C_jsvalAlignmentTest(); |
michael@0 | 27 | |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | BEGIN_TEST(testValueABI_retparam) |
michael@0 | 31 | { |
michael@0 | 32 | JS::RootedObject obj(cx, JS::CurrentGlobalOrNull(cx)); |
michael@0 | 33 | jsval v = OBJECT_TO_JSVAL(obj); |
michael@0 | 34 | obj = nullptr; |
michael@0 | 35 | CHECK(C_ValueToObject(cx, v, obj.address())); |
michael@0 | 36 | bool equal; |
michael@0 | 37 | CHECK(JS_StrictlyEqual(cx, v, OBJECT_TO_JSVAL(obj), &equal)); |
michael@0 | 38 | CHECK(equal); |
michael@0 | 39 | |
michael@0 | 40 | v = C_GetEmptyStringValue(cx); |
michael@0 | 41 | CHECK(JSVAL_IS_STRING(v)); |
michael@0 | 42 | |
michael@0 | 43 | return true; |
michael@0 | 44 | } |
michael@0 | 45 | END_TEST(testValueABI_retparam) |
michael@0 | 46 | |
michael@0 | 47 | BEGIN_TEST(testValueABI_alignment) |
michael@0 | 48 | { |
michael@0 | 49 | typedef struct { char c; jsval v; } AlignTest; |
michael@0 | 50 | CHECK(C_jsvalAlignmentTest() == sizeof(AlignTest)); |
michael@0 | 51 | |
michael@0 | 52 | return true; |
michael@0 | 53 | } |
michael@0 | 54 | END_TEST(testValueABI_alignment) |