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 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | module.metadata = { |
michael@0 | 8 | "stability": "experimental" |
michael@0 | 9 | }; |
michael@0 | 10 | |
michael@0 | 11 | const { get, format } = require("../console/traceback"); |
michael@0 | 12 | const { get: getPref } = require("../preferences/service"); |
michael@0 | 13 | const PREFERENCE = "devtools.errorconsole.deprecation_warnings"; |
michael@0 | 14 | |
michael@0 | 15 | function deprecateUsage(msg) { |
michael@0 | 16 | // Print caller stacktrace in order to help figuring out which code |
michael@0 | 17 | // does use deprecated thing |
michael@0 | 18 | let stack = get().slice(2); |
michael@0 | 19 | |
michael@0 | 20 | if (getPref(PREFERENCE)) |
michael@0 | 21 | console.error("DEPRECATED: " + msg + "\n" + format(stack)); |
michael@0 | 22 | } |
michael@0 | 23 | exports.deprecateUsage = deprecateUsage; |
michael@0 | 24 | |
michael@0 | 25 | function deprecateFunction(fun, msg) { |
michael@0 | 26 | return function deprecated() { |
michael@0 | 27 | deprecateUsage(msg); |
michael@0 | 28 | return fun.apply(this, arguments); |
michael@0 | 29 | }; |
michael@0 | 30 | } |
michael@0 | 31 | exports.deprecateFunction = deprecateFunction; |
michael@0 | 32 | |
michael@0 | 33 | function deprecateEvent(fun, msg, evtTypes) { |
michael@0 | 34 | return function deprecateEvent(evtType) { |
michael@0 | 35 | if (evtTypes.indexOf(evtType) >= 0) |
michael@0 | 36 | deprecateUsage(msg); |
michael@0 | 37 | return fun.apply(this, arguments); |
michael@0 | 38 | }; |
michael@0 | 39 | } |
michael@0 | 40 | exports.deprecateEvent = deprecateEvent; |