toolkit/components/console/jsconsole-clhandler.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* vim:sw=4:sr:sta:et:sts: */
michael@0 3
michael@0 4 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 5 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 7
michael@0 8 const Cc = Components.classes;
michael@0 9 const Ci = Components.interfaces;
michael@0 10 Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
michael@0 11
michael@0 12 function jsConsoleHandler() {}
michael@0 13 jsConsoleHandler.prototype = {
michael@0 14 handle: function clh_handle(cmdLine) {
michael@0 15 if (!cmdLine.handleFlag("jsconsole", false))
michael@0 16 return;
michael@0 17
michael@0 18 var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
michael@0 19 getService(Ci.nsIWindowMediator);
michael@0 20 var console = wm.getMostRecentWindow("global:console");
michael@0 21 if (!console) {
michael@0 22 var wwatch = Cc["@mozilla.org/embedcomp/window-watcher;1"].
michael@0 23 getService(Ci.nsIWindowWatcher);
michael@0 24 wwatch.openWindow(null, "chrome://global/content/console.xul", "_blank",
michael@0 25 "chrome,dialog=no,all", cmdLine);
michael@0 26 } else {
michael@0 27 console.focus(); // the Error console was already open
michael@0 28 }
michael@0 29
michael@0 30 if (cmdLine.state == Ci.nsICommandLine.STATE_REMOTE_AUTO)
michael@0 31 cmdLine.preventDefault = true;
michael@0 32 },
michael@0 33
michael@0 34 helpInfo : " -jsconsole Open the Error console.\n",
michael@0 35
michael@0 36 classID: Components.ID("{2cd0c310-e127-44d0-88fc-4435c9ab4d4b}"),
michael@0 37 QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
michael@0 38 };
michael@0 39
michael@0 40 this.NSGetFactory = XPCOMUtils.generateNSGetFactory([jsConsoleHandler]);

mercurial