1 # -*- Mode
: C
++; tab
-width
: 8; indent
-tabs
-mode
: nil
; c
-basic
-offset
: 4 -*-
2 # vim
:sw
=4:sr
:sta
:et
:sts
:
3 # ***** BEGIN LICENSE BLOCK
*****
4 # Version
: MPL
1.1/GPL 2.0/LGPL
2.1
6 # The contents
of this file are subject to the Mozilla Public License Version
7 # 1.1 (the
"License"); you may not
use this file except
in compliance
with
8 # the License
. You may obtain a copy
of the License at
9 # http
://www.mozilla.org/MPL/
11 # Software distributed under the License is distributed on an
"AS IS" basis
,
12 # WITHOUT WARRANTY OF ANY KIND
, either express or implied
. See the License
13 # for the specific language governing rights and limitations under the
16 # The Original Code is mozilla
.org code
.
18 # The Initial Developer
of the Original Code is
19 # Netscape Communications Corporation
.
20 # Portions created by the Initial Developer are
Copyright (C
) 1999
21 # the Initial Developer
. All Rights Reserved
.
24 # Martijn Pieters
<mj
@digicool
.com
>
25 # Benjamin Smedberg
<benjamin
@smedbergs
.us
>
26 # Simon B
ΓΌnzli
<zeniko
@gmail
.com
>
28 # Alternatively
, the contents
of this file may be used under the terms
of
29 # either the GNU General Public License Version
2 or
later (the
"GPL"), or
30 # the GNU Lesser General Public License Version
2.1 or
later (the
"LGPL"),
31 # in which
case the provisions
of the GPL or the LGPL are applicable instead
32 # of those above
. If you wish to allow
use of your version
of this file only
33 # under the terms
of either the GPL or the LGPL
, and not to allow others to
34 # use your version
of this file under the terms
of the MPL
, indicate your
35 # decision by deleting the provisions above and replace them
with the notice
36 # and other provisions required by the GPL or the LGPL
. If you
do not
delete
37 # the provisions above
, a recipient may
use your version
of this file under
38 # the terms
of any one
of the MPL
, the GPL or the LGPL
.
40 # ***** END LICENSE BLOCK
*****
41 const Cc
= Components
.classes
;
42 const Ci
= Components
.interfaces
;
43 Components
.utils
.import("resource://gre/modules/XPCOMUtils.jsm");
45 function jsConsoleHandler() {}
46 jsConsoleHandler
.prototype = {
47 handle
: function clh_handle(cmdLine
) {
48 if (!cmdLine
.handleFlag("jsconsole", false))
51 var wm
= Cc
["@mozilla.org/appshell/window-mediator;1"].
52 getService(Ci
.nsIWindowMediator
);
53 var console
= wm
.getMostRecentWindow("global:console");
55 var wwatch
= Cc
["@mozilla.org/embedcomp/window-watcher;1"].
56 getService(Ci
.nsIWindowWatcher
);
57 wwatch
.openWindow(null, "chrome://global/content/console.xul", "_blank",
58 "chrome,dialog=no,all", cmdLine
);
60 console
.focus(); // the Error console was already open
63 if (cmdLine
.state
== Ci
.nsICommandLine
.STATE_REMOTE_AUTO
)
64 cmdLine
.preventDefault
= true;
67 helpInfo
: " -jsconsole Open the Error console.\n",
69 classDescription
: "jsConsoleHandler",
70 classID
: Components
.ID("{2cd0c310-e127-44d0-88fc-4435c9ab4d4b}"),
71 contractID
: "@mozilla.org/toolkit/console-clh;1",
72 QueryInterface
: XPCOMUtils
.generateQI([Ci
.nsICommandLineHandler
]),
73 _xpcom_categories
: [{category
: "command-line-handler", entry
: "b-jsconsole"}]
76 function NSGetModule(compMgr
, fileSpec
)
77 XPCOMUtils
.generateModule([jsConsoleHandler
]);