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': 'unstable'
8 };
10 const privateNS = require('../../core/namespace').ns();
12 function getOwnerWindow(thing) {
13 try {
14 // check for and return associated window
15 let fn = (privateNS(thing.prototype) || privateNS(thing) || {}).getOwnerWindow;
17 if (fn)
18 return fn.apply(fn, [thing].concat(arguments));
19 }
20 // stuff like numbers and strings throw errors with namespaces
21 catch(e) {}
22 // default
23 return undefined;
24 }
25 getOwnerWindow.define = function(Type, fn) {
26 privateNS(Type.prototype).getOwnerWindow = fn;
27 }
29 getOwnerWindow.implement = function(instance, fn) {
30 privateNS(instance).getOwnerWindow = fn;
31 }
33 exports.getOwnerWindow = getOwnerWindow;