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 const { Class } = require('../core/heritage');
7 const { windowNS } = require('./namespace');
8 const { on, off, once } = require('../event/core');
9 const { method } = require('../lang/functional');
10 const { getWindowTitle } = require('./utils');
11 const unload = require('../system/unload');
12 const { isWindowPrivate } = require('../window/utils');
13 const { EventTarget } = require('../event/target');
14 const { getOwnerWindow: getPBOwnerWindow } = require('../private-browsing/window/utils');
15 const { viewFor } = require('../view/core');
16 const { deprecateUsage } = require('../util/deprecate');
18 const ERR_FENNEC_MSG = 'This method is not yet supported by Fennec, consider using require("sdk/tabs") instead';
20 const BrowserWindow = Class({
21 initialize: function initialize(options) {
22 EventTarget.prototype.initialize.call(this, options);
23 windowNS(this).window = options.window;
24 },
25 activate: function activate() {
26 // TODO
27 return null;
28 },
29 close: function() {
30 throw new Error(ERR_FENNEC_MSG);
31 return null;
32 },
33 get title() getWindowTitle(windowNS(this).window),
34 // NOTE: Fennec only has one window, which is assumed below
35 // TODO: remove assumption below
36 // NOTE: tabs requires windows
37 get tabs() require('../tabs'),
38 get activeTab() require('../tabs').activeTab,
39 on: method(on),
40 removeListener: method(off),
41 once: method(once),
42 get isPrivateBrowsing() {
43 deprecateUsage('`browserWindow.isPrivateBrowsing` is deprecated, please ' +
44 'consider using ' +
45 '`require("sdk/private-browsing").isPrivate(browserWindow)` ' +
46 'instead.');
47 return isWindowPrivate(windowNS(this).window);
48 }
49 });
50 exports.BrowserWindow = BrowserWindow;
52 const getWindowView = window => windowNS(window).window;
54 getPBOwnerWindow.define(BrowserWindow, getWindowView);
55 viewFor.define(BrowserWindow, getWindowView);