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