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 | const { Cc, Ci, Cu } = require("chrome"); |
michael@0 | 8 | const gcli = require("gcli/index"); |
michael@0 | 9 | const Services = require("Services"); |
michael@0 | 10 | |
michael@0 | 11 | const BRAND_SHORT_NAME = Cc["@mozilla.org/intl/stringbundle;1"] |
michael@0 | 12 | .getService(Ci.nsIStringBundleService) |
michael@0 | 13 | .createBundle("chrome://branding/locale/brand.properties") |
michael@0 | 14 | .GetStringFromName("brandShortName"); |
michael@0 | 15 | |
michael@0 | 16 | /** |
michael@0 | 17 | * Restart command |
michael@0 | 18 | * |
michael@0 | 19 | * @param boolean nocache |
michael@0 | 20 | * Disables loading content from cache upon restart. |
michael@0 | 21 | * |
michael@0 | 22 | * Examples : |
michael@0 | 23 | * >> restart |
michael@0 | 24 | * - restarts browser immediately |
michael@0 | 25 | * >> restart --nocache |
michael@0 | 26 | * - restarts immediately and starts Firefox without using cache |
michael@0 | 27 | */ |
michael@0 | 28 | exports.items = [ |
michael@0 | 29 | { |
michael@0 | 30 | name: "restart", |
michael@0 | 31 | description: gcli.lookupFormat("restartBrowserDesc", [ BRAND_SHORT_NAME ]), |
michael@0 | 32 | params: [ |
michael@0 | 33 | { |
michael@0 | 34 | name: "nocache", |
michael@0 | 35 | type: "boolean", |
michael@0 | 36 | description: gcli.lookup("restartBrowserNocacheDesc") |
michael@0 | 37 | } |
michael@0 | 38 | ], |
michael@0 | 39 | returnType: "string", |
michael@0 | 40 | exec: function Restart(args, context) { |
michael@0 | 41 | let canceled = Cc["@mozilla.org/supports-PRBool;1"] |
michael@0 | 42 | .createInstance(Ci.nsISupportsPRBool); |
michael@0 | 43 | Services.obs.notifyObservers(canceled, "quit-application-requested", "restart"); |
michael@0 | 44 | if (canceled.data) { |
michael@0 | 45 | return gcli.lookup("restartBrowserRequestCancelled"); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | // disable loading content from cache. |
michael@0 | 49 | if (args.nocache) { |
michael@0 | 50 | Services.appinfo.invalidateCachesOnRestart(); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | // restart |
michael@0 | 54 | Cc["@mozilla.org/toolkit/app-startup;1"] |
michael@0 | 55 | .getService(Ci.nsIAppStartup) |
michael@0 | 56 | .quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart); |
michael@0 | 57 | return gcli.lookupFormat("restartBrowserRestarting", [ BRAND_SHORT_NAME ]); |
michael@0 | 58 | } |
michael@0 | 59 | } |
michael@0 | 60 | ]; |