toolkit/components/console/jsconsole-clhandler.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial