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: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "jsapi-tests/tests.h" |
michael@0 | 8 | |
michael@0 | 9 | BEGIN_TEST(testContexts_IsRunning) |
michael@0 | 10 | { |
michael@0 | 11 | CHECK(JS_DefineFunction(cx, global, "chk", chk, 0, 0)); |
michael@0 | 12 | EXEC("for (var i = 0; i < 9; i++) chk();"); |
michael@0 | 13 | return true; |
michael@0 | 14 | } |
michael@0 | 15 | |
michael@0 | 16 | static bool chk(JSContext *cx, unsigned argc, jsval *vp) |
michael@0 | 17 | { |
michael@0 | 18 | JSRuntime *rt = JS_GetRuntime(cx); |
michael@0 | 19 | JSContext *acx = JS_NewContext(rt, 8192); |
michael@0 | 20 | if (!acx) { |
michael@0 | 21 | JS_ReportOutOfMemory(cx); |
michael@0 | 22 | return false; |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | // acx should not be running |
michael@0 | 26 | bool ok = !JS_IsRunning(acx); |
michael@0 | 27 | if (!ok) |
michael@0 | 28 | JS_ReportError(cx, "Assertion failed: brand new context claims to be running"); |
michael@0 | 29 | JS_DestroyContext(acx); |
michael@0 | 30 | return ok; |
michael@0 | 31 | } |
michael@0 | 32 | END_TEST(testContexts_IsRunning) |
michael@0 | 33 | |
michael@0 | 34 | BEGIN_TEST(testContexts_bug563735) |
michael@0 | 35 | { |
michael@0 | 36 | JSContext *cx2 = JS_NewContext(rt, 8192); |
michael@0 | 37 | CHECK(cx2); |
michael@0 | 38 | |
michael@0 | 39 | bool ok; |
michael@0 | 40 | { |
michael@0 | 41 | JSAutoRequest req(cx2); |
michael@0 | 42 | JSAutoCompartment ac(cx2, global); |
michael@0 | 43 | JS::RootedValue v(cx2); |
michael@0 | 44 | ok = JS_SetProperty(cx2, global, "x", v); |
michael@0 | 45 | } |
michael@0 | 46 | CHECK(ok); |
michael@0 | 47 | |
michael@0 | 48 | EXEC("(function () { for (var i = 0; i < 9; i++) ; })();"); |
michael@0 | 49 | |
michael@0 | 50 | JS_DestroyContext(cx2); |
michael@0 | 51 | return true; |
michael@0 | 52 | } |
michael@0 | 53 | END_TEST(testContexts_bug563735) |