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.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 "use strict";
6 module.metadata = {
7 "stability": "stable"
8 };
10 const { CC } = require('chrome');
11 const { id, name, prefixURI, rootURI, metadata,
12 version, loadReason, preferencesBranch } = require('@loader/options');
14 const { readURISync } = require('./net/url');
16 const addonDataURI = prefixURI + name + '/data/';
18 const uri = (path="") =>
19 path.contains(":") ? path : addonDataURI + path;
22 // Some XPCOM APIs require valid URIs as an argument for certain operations
23 // (see `nsILoginManager` for example). This property represents add-on
24 // associated unique URI string that can be used for that.
25 exports.uri = 'addon:' + id;
26 exports.id = id;
27 exports.preferencesBranch = preferencesBranch || id;
28 exports.name = name;
29 exports.loadReason = loadReason;
30 exports.version = version;
31 // If `rootURI` is jar:file://...!/ than add-on is packed.
32 exports.packed = (rootURI || '').indexOf('jar:') === 0;
33 exports.data = Object.freeze({
34 url: uri,
35 load: function read(path) {
36 return readURISync(uri(path));
37 }
38 });
39 exports.isPrivateBrowsingSupported = ((metadata || {}).permissions || {})['private-browsing'] === true;