2001-06-14 04:46:42 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2004-04-18 22:14:17 +00:00
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
2001-06-14 04:46:42 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
2004-04-18 22:14:17 +00:00
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is The JavaScript Debugger.
|
2001-06-14 04:46:42 +00:00
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
2004-04-18 22:14:17 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2001-06-14 04:46:42 +00:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-18 22:14:17 +00:00
|
|
|
* Robert Ginda, <rginda@netscape.com>, original author
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-06-14 04:46:42 +00:00
|
|
|
*
|
2004-04-18 22:14:17 +00:00
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2001-06-14 04:46:42 +00:00
|
|
|
|
|
|
|
/* components defined in this file */
|
|
|
|
const CLINE_SERVICE_CTRID =
|
|
|
|
"@mozilla.org/commandlinehandler/general-startup;1?type=venkman";
|
|
|
|
const CLINE_SERVICE_CID =
|
2001-06-14 08:07:35 +00:00
|
|
|
Components.ID("{18269616-1dd2-11b2-afa8-b612439bda27}");
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
const JSDPROT_HANDLER_CTRID =
|
|
|
|
"@mozilla.org/network/protocol;1?name=x-jsd";
|
|
|
|
const JSDPROT_HANDLER_CID =
|
|
|
|
Components.ID("{12ec790d-304e-4525-89a9-3e723d489d14}");
|
2003-04-21 23:55:12 +00:00
|
|
|
const JSDCNT_HANDLER_CTRID =
|
|
|
|
"@mozilla.org/uriloader/content-handler;1?type=x-application-jsd";
|
|
|
|
const JSDCNT_HANDLER_CID =
|
|
|
|
Components.ID("{306670f0-47bb-466b-b53b-613235623bbd}");
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
|
|
|
|
/* components used by this file */
|
|
|
|
const CATMAN_CTRID = "@mozilla.org/categorymanager;1";
|
|
|
|
const STRING_STREAM_CTRID = "@mozilla.org/io/string-input-stream;1";
|
|
|
|
const MEDIATOR_CTRID =
|
|
|
|
"@mozilla.org/appshell/window-mediator;1";
|
2003-04-21 23:55:12 +00:00
|
|
|
const ASS_CONTRACTID =
|
|
|
|
"@mozilla.org/appshell/appShellService;1";
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
const SIMPLEURI_CTRID = "@mozilla.org/network/simple-uri;1";
|
|
|
|
|
|
|
|
const nsIWindowMediator = Components.interfaces.nsIWindowMediator;
|
2003-04-21 23:55:12 +00:00
|
|
|
const nsIAppShellService = Components.interfaces.nsIAppShellService;
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
const nsICmdLineHandler = Components.interfaces.nsICmdLineHandler;
|
2006-04-12 23:23:07 +00:00
|
|
|
const nsIComponentRegistrar = Components.interfaces.nsIComponentRegistrar;
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
const nsICategoryManager = Components.interfaces.nsICategoryManager;
|
2003-04-21 23:55:12 +00:00
|
|
|
const nsIContentHandler = Components.interfaces.nsIContentHandler;
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
const nsIProtocolHandler = Components.interfaces.nsIProtocolHandler;
|
|
|
|
const nsIURI = Components.interfaces.nsIURI;
|
|
|
|
const nsIURL = Components.interfaces.nsIURL;
|
|
|
|
const nsIStringInputStream = Components.interfaces.nsIStringInputStream;
|
|
|
|
const nsIChannel = Components.interfaces.nsIChannel;
|
|
|
|
const nsIRequest = Components.interfaces.nsIRequest;
|
|
|
|
const nsIProgressEventSink = Components.interfaces.nsIProgressEventSink;
|
|
|
|
const nsISupports = Components.interfaces.nsISupports;
|
2006-04-12 23:23:07 +00:00
|
|
|
const nsICommandLineHandler = Components.interfaces.nsICommandLineHandler;
|
|
|
|
const nsICommandLine = Components.interfaces.nsICommandLine;
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
|
|
|
|
function findDebuggerWindow ()
|
|
|
|
{
|
|
|
|
var windowManager =
|
|
|
|
Components.classes[MEDIATOR_CTRID].getService(nsIWindowMediator);
|
2006-04-12 23:23:07 +00:00
|
|
|
return windowManager.getMostRecentWindow("mozapp:venkman");
|
|
|
|
}
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
function openDebuggerWindow(args)
|
|
|
|
{
|
|
|
|
var ass = Components.classes[ASS_CONTRACTID].getService(nsIAppShellService);
|
|
|
|
var window = ass.hiddenDOMWindow;
|
|
|
|
window.openDialog("chrome://venkman/content/venkman.xul", "_blank",
|
|
|
|
"chrome,menubar,toolbar,resizable,dialog=no", args);
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
}
|
2001-06-14 04:46:42 +00:00
|
|
|
|
2003-02-05 01:26:20 +00:00
|
|
|
function safeHTML(str)
|
|
|
|
{
|
|
|
|
function replaceChars(ch)
|
|
|
|
{
|
|
|
|
switch (ch)
|
|
|
|
{
|
|
|
|
case "<":
|
|
|
|
return "<";
|
|
|
|
|
|
|
|
case ">":
|
|
|
|
return ">";
|
|
|
|
|
|
|
|
case "&":
|
|
|
|
return "&";
|
2006-05-16 19:28:32 +00:00
|
|
|
|
|
|
|
case "'":
|
|
|
|
return "'";
|
|
|
|
|
|
|
|
case '"':
|
|
|
|
return """;
|
2003-02-05 01:26:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return "?";
|
|
|
|
};
|
|
|
|
|
2006-05-16 19:28:32 +00:00
|
|
|
return String(str).replace(/[<>&"']/g, replaceChars);
|
2003-02-05 01:26:20 +00:00
|
|
|
}
|
|
|
|
|
2001-06-14 04:46:42 +00:00
|
|
|
/* Command Line handler service */
|
|
|
|
function CLineService()
|
|
|
|
{}
|
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
/* nsISupports */
|
|
|
|
CLineService.prototype.QueryInterface =
|
|
|
|
function handler_QI(iid)
|
|
|
|
{
|
|
|
|
if (iid.equals(nsISupports) ||
|
|
|
|
(nsICommandLineHandler && iid.equals(nsICommandLineHandler)) ||
|
|
|
|
(nsICmdLineHandler && iid.equals(nsICmdLineHandler)))
|
|
|
|
{
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nsICmdLineHandler */
|
2001-06-14 04:46:42 +00:00
|
|
|
CLineService.prototype.commandLineArgument = "-venkman";
|
|
|
|
CLineService.prototype.prefNameForStartup = "general.startup.venkman";
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
CLineService.prototype.chromeUrlForTask = "chrome://venkman/content";
|
2006-04-12 23:23:07 +00:00
|
|
|
CLineService.prototype.helpText = "Start with JavaScript Debugger (Venkman).";
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
CLineService.prototype.handlesArgs = false;
|
|
|
|
CLineService.prototype.defaultArgs = "";
|
|
|
|
CLineService.prototype.openWindowWithArgs = false;
|
2001-06-14 04:46:42 +00:00
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
/* nsICommandLineHandler */
|
|
|
|
|
|
|
|
CLineService.prototype.handle =
|
|
|
|
function handler_handle(cmdLine)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (cmdLine.handleFlag("venkman", false))
|
|
|
|
openDebuggerWindow(null);
|
|
|
|
}
|
|
|
|
catch (e)
|
|
|
|
{
|
|
|
|
debug(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
CLineService.prototype.helpInfo =
|
|
|
|
" -venkman Start with JavaScript debugger (Venkman).\n"
|
|
|
|
|
2001-06-14 04:46:42 +00:00
|
|
|
/* factory for command line handler service (CLineService) */
|
|
|
|
var CLineFactory = new Object();
|
|
|
|
|
|
|
|
CLineFactory.createInstance =
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
function clf_create (outer, iid) {
|
2001-06-14 04:46:42 +00:00
|
|
|
if (outer != null)
|
|
|
|
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
return new CLineService().QueryInterface(iid);
|
2001-06-14 04:46:42 +00:00
|
|
|
}
|
|
|
|
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
/* x-jsd: protocol handler */
|
|
|
|
|
|
|
|
const JSD_DEFAULT_PORT = 2206; /* Dana's apartment number. */
|
|
|
|
|
|
|
|
/* protocol handler factory object */
|
|
|
|
var JSDProtocolHandlerFactory = new Object();
|
|
|
|
|
|
|
|
JSDProtocolHandlerFactory.createInstance =
|
|
|
|
function jsdhf_create (outer, iid) {
|
|
|
|
if (outer != null)
|
|
|
|
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
if (!iid.equals(nsIProtocolHandler) && !iid.equals(nsISupports))
|
|
|
|
throw Components.results.NS_ERROR_INVALID_ARG;
|
|
|
|
|
|
|
|
return new JSDProtocolHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
function JSDURI (spec, charset)
|
|
|
|
{
|
|
|
|
this.spec = this.prePath = spec;
|
|
|
|
this.charset = this.originCharset = charset;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.QueryInterface =
|
|
|
|
function jsdch_qi (iid)
|
|
|
|
{
|
|
|
|
if (!iid.equals(nsIURI) && !iid.equals(nsIURL) &&
|
|
|
|
!iid.equals(nsISupports))
|
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.scheme = "x-jsd";
|
|
|
|
|
|
|
|
JSDURI.prototype.fileBaseName =
|
|
|
|
JSDURI.prototype.fileExtension =
|
|
|
|
JSDURI.prototype.filePath =
|
|
|
|
JSDURI.prototype.param =
|
|
|
|
JSDURI.prototype.query =
|
|
|
|
JSDURI.prototype.ref =
|
|
|
|
JSDURI.prototype.directory =
|
|
|
|
JSDURI.prototype.fileName =
|
|
|
|
JSDURI.prototype.username =
|
|
|
|
JSDURI.prototype.password =
|
|
|
|
JSDURI.prototype.hostPort =
|
|
|
|
JSDURI.prototype.path =
|
|
|
|
JSDURI.prototype.asciiHost =
|
|
|
|
JSDURI.prototype.userPass = "";
|
|
|
|
|
|
|
|
JSDURI.prototype.port = JSD_DEFAULT_PORT;
|
|
|
|
|
|
|
|
JSDURI.prototype.schemeIs =
|
|
|
|
function jsduri_schemeis (scheme)
|
|
|
|
{
|
|
|
|
return scheme.toLowerCase() == "x-jsd";
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.getCommonBaseSpec =
|
|
|
|
function jsduri_commonbase (uri)
|
|
|
|
{
|
|
|
|
return "x-jsd:";
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.getRelativeSpec =
|
|
|
|
function jsduri_commonbase (uri)
|
|
|
|
{
|
|
|
|
return uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.equals =
|
|
|
|
function jsduri_equals (uri)
|
|
|
|
{
|
|
|
|
return uri.spec == this.spec;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.clone =
|
|
|
|
function jsduri_clone ()
|
|
|
|
{
|
|
|
|
return new JSDURI (this.spec);
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDURI.prototype.resolve =
|
|
|
|
function jsduri_resolve(path)
|
|
|
|
{
|
|
|
|
//dump ("resolve " + path + " from " + this.spec + "\n");
|
|
|
|
if (path[0] == "#")
|
|
|
|
return this.spec + path;
|
|
|
|
|
|
|
|
return path;
|
|
|
|
}
|
|
|
|
|
|
|
|
function JSDProtocolHandler()
|
|
|
|
{
|
|
|
|
/* nothing here */
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDProtocolHandler.prototype.scheme = "x-jsd";
|
|
|
|
JSDProtocolHandler.prototype.defaultPort = JSD_DEFAULT_PORT;
|
2003-02-05 01:26:20 +00:00
|
|
|
JSDProtocolHandler.prototype.protocolFlags = nsIProtocolHandler.URI_NORELATIVE ||
|
|
|
|
nsIProtocolHandler.URI_NOAUTH;
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
|
|
|
|
JSDProtocolHandler.prototype.allowPort =
|
|
|
|
function jsdph_allowport (aPort, aScheme)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDProtocolHandler.prototype.newURI =
|
|
|
|
function jsdph_newuri (spec, charset, baseURI)
|
|
|
|
{
|
|
|
|
var clazz = Components.classes[SIMPLEURI_CTRID];
|
|
|
|
var uri = clazz.createInstance(nsIURI);
|
|
|
|
uri.spec = spec;
|
|
|
|
return uri;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDProtocolHandler.prototype.newChannel =
|
|
|
|
function jsdph_newchannel (uri)
|
|
|
|
{
|
|
|
|
return new JSDChannel (uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
function JSDChannel (uri)
|
|
|
|
{
|
|
|
|
this.URI = uri;
|
|
|
|
this.originalURI = uri;
|
2006-01-25 16:37:13 +00:00
|
|
|
this._isPending = false;
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
var clazz = Components.classes[STRING_STREAM_CTRID];
|
|
|
|
this.stringStream = clazz.createInstance(nsIStringInputStream);
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDChannel.prototype.QueryInterface =
|
|
|
|
function jsdch_qi (iid)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!iid.equals(nsIChannel) && !iid.equals(nsIRequest) &&
|
|
|
|
!iid.equals(nsISupports))
|
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nsIChannel */
|
|
|
|
JSDChannel.prototype.loadAttributes = null;
|
|
|
|
JSDChannel.prototype.contentType = "text/html";
|
|
|
|
JSDChannel.prototype.contentLength = -1;
|
|
|
|
JSDChannel.prototype.owner = null;
|
|
|
|
JSDChannel.prototype.loadGroup = null;
|
|
|
|
JSDChannel.prototype.notificationCallbacks = null;
|
|
|
|
JSDChannel.prototype.securityInfo = null;
|
|
|
|
|
|
|
|
JSDChannel.prototype.open =
|
|
|
|
function jsdch_open()
|
|
|
|
{
|
|
|
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDChannel.prototype.asyncOpen =
|
|
|
|
function jsdch_aopen (streamListener, context)
|
|
|
|
{
|
|
|
|
this.streamListener = streamListener;
|
|
|
|
this.context = context;
|
2006-01-25 16:37:13 +00:00
|
|
|
this._isPending = true;
|
2003-04-21 23:55:12 +00:00
|
|
|
|
|
|
|
if (!window && this.URI.spec == "x-jsd:debugger")
|
|
|
|
{
|
|
|
|
this.contentType = "x-application-jsd";
|
|
|
|
this.contentLength = 0;
|
|
|
|
streamListener.onStartRequest(this, context);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
var window = findDebuggerWindow();
|
|
|
|
var ary = this.URI.spec.match (/x-jsd:([^:]+)/);
|
|
|
|
var exception;
|
2003-04-21 23:55:12 +00:00
|
|
|
|
|
|
|
if (this.loadGroup)
|
|
|
|
this.loadGroup.addRequest (this, null);
|
|
|
|
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
if (window && "console" in window && ary)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
window.asyncOpenJSDURL (this, streamListener, context);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
exception = ex;
|
|
|
|
}
|
|
|
|
}
|
2003-04-21 23:55:12 +00:00
|
|
|
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
var str =
|
|
|
|
"<html><head><title>Error</title></head><body>Could not load <<b>" +
|
2003-02-05 01:26:20 +00:00
|
|
|
safeHTML(this.URI.spec) + "</b>><br>";
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
|
|
|
|
if (!ary)
|
|
|
|
{
|
|
|
|
str += "<b>Error parsing uri.</b>";
|
|
|
|
}
|
|
|
|
else if (exception)
|
|
|
|
{
|
2003-02-05 01:26:20 +00:00
|
|
|
str += "<b>Internal error: " + safeHTML(exception) + "</b><br><pre>" +
|
|
|
|
safeHTML(exception.stack);
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
str += "<b>Debugger is not running.</b>";
|
|
|
|
}
|
|
|
|
|
|
|
|
str += "</body></html>";
|
|
|
|
|
|
|
|
this.respond (str);
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDChannel.prototype.respond =
|
|
|
|
function jsdch_respond (str)
|
|
|
|
{
|
|
|
|
this.streamListener.onStartRequest (this, this.context);
|
|
|
|
|
|
|
|
var len = str.length;
|
|
|
|
this.stringStream.setData (str, len);
|
|
|
|
this.streamListener.onDataAvailable (this, this.context,
|
|
|
|
this.stringStream, 0, len);
|
|
|
|
this.streamListener.onStopRequest (this, this.context,
|
|
|
|
Components.results.NS_OK);
|
|
|
|
if (this.loadGroup)
|
|
|
|
this.loadGroup.removeRequest (this, null, Components.results.NS_OK);
|
|
|
|
this._isPending = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* nsIRequest */
|
|
|
|
JSDChannel.prototype.isPending =
|
|
|
|
function jsdch_ispending ()
|
|
|
|
{
|
|
|
|
return this._isPending;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDChannel.prototype.status = Components.results.NS_OK;
|
|
|
|
|
|
|
|
JSDChannel.prototype.cancel =
|
|
|
|
function jsdch_cancel (status)
|
|
|
|
{
|
|
|
|
if (this._isPending)
|
|
|
|
{
|
|
|
|
this._isPending = false;
|
|
|
|
this.streamListener.onStopRequest (this, this.context, status);
|
|
|
|
if (this.loadGroup)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
this.loadGroup.removeRequest (this, null, status);
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
debug ("we're not in the load group?\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
this.status = status;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDChannel.prototype.suspend =
|
|
|
|
JSDChannel.prototype.resume =
|
|
|
|
function jsdch_notimpl ()
|
|
|
|
{
|
|
|
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2003-04-21 23:55:12 +00:00
|
|
|
/* x-application-jsd content handler */
|
|
|
|
function JSDContentHandler ()
|
|
|
|
{}
|
|
|
|
|
|
|
|
JSDContentHandler.prototype.QueryInterface =
|
|
|
|
function jsdh_qi(iid)
|
|
|
|
{
|
|
|
|
if (!iid.equals(nsIContentHandler) && !iid.equals(nsISupports))
|
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
|
|
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSDContentHandler.prototype.handleContent =
|
2004-04-16 21:06:07 +00:00
|
|
|
function jsdh_handle(contentType, windowTarget, request)
|
2003-04-21 23:55:12 +00:00
|
|
|
{
|
|
|
|
var e;
|
|
|
|
var channel = request.QueryInterface(nsIChannel);
|
|
|
|
|
|
|
|
// prevent someone from invoking the debugger remotely by serving
|
|
|
|
// up any old file with the x-application-jsd content type.
|
|
|
|
if (channel.URI.spec != "x-jsd:debugger")
|
|
|
|
{
|
|
|
|
debug ("Not handling content from unknown location ``" +
|
|
|
|
channel.URI.spec + "''");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
var window = findDebuggerWindow()
|
|
|
|
|
|
|
|
if (window)
|
|
|
|
{
|
|
|
|
window.focus();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var ass =
|
|
|
|
Components.classes[ASS_CONTRACTID].getService(nsIAppShellService);
|
|
|
|
window = ass.hiddenDOMWindow;
|
|
|
|
|
|
|
|
var args = new Object();
|
|
|
|
args.url = channel.URI.spec;
|
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
openDebuggerWindow(args);
|
|
|
|
}
|
2003-04-21 23:55:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
|
|
/* content handler factory object (IRCContentHandler) */
|
|
|
|
var JSDContentHandlerFactory = new Object();
|
|
|
|
|
|
|
|
JSDContentHandlerFactory.createInstance =
|
|
|
|
function jsdhf_create(outer, iid)
|
|
|
|
{
|
|
|
|
if (outer != null)
|
|
|
|
throw Components.results.NS_ERROR_NO_AGGREGATION;
|
|
|
|
|
|
|
|
if (!iid.equals(nsIContentHandler) && !iid.equals(nsISupports))
|
|
|
|
throw Components.results.NS_ERROR_INVALID_ARG;
|
|
|
|
|
|
|
|
return new JSDContentHandler();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
2001-06-14 04:46:42 +00:00
|
|
|
var Module = new Object();
|
|
|
|
|
|
|
|
Module.registerSelf =
|
|
|
|
function (compMgr, fileSpec, location, type)
|
|
|
|
{
|
2002-04-23 07:30:11 +00:00
|
|
|
debug("*** Registering -venkman handler.\n");
|
2001-12-19 00:12:41 +00:00
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
2001-12-19 00:12:41 +00:00
|
|
|
|
2002-01-29 21:22:13 +00:00
|
|
|
compMgr.registerFactoryLocation(CLINE_SERVICE_CID,
|
|
|
|
"Venkman CommandLine Service",
|
|
|
|
CLINE_SERVICE_CTRID,
|
|
|
|
fileSpec,
|
|
|
|
location,
|
|
|
|
type);
|
2001-06-14 04:46:42 +00:00
|
|
|
|
2006-04-12 23:23:07 +00:00
|
|
|
catman = Components.classes[CATMAN_CTRID].getService(nsICategoryManager);
|
|
|
|
catman.addCategoryEntry("command-line-argument-handlers",
|
|
|
|
"venkman command line handler",
|
|
|
|
CLINE_SERVICE_CTRID, true, true);
|
|
|
|
|
|
|
|
catman.addCategoryEntry("command-line-handler",
|
2001-06-14 04:46:42 +00:00
|
|
|
"venkman command line handler",
|
|
|
|
CLINE_SERVICE_CTRID, true, true);
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
|
|
|
|
debug("*** Registering x-jsd protocol handler.\n");
|
|
|
|
compMgr.registerFactoryLocation(JSDPROT_HANDLER_CID,
|
|
|
|
"x-jsd protocol handler",
|
|
|
|
JSDPROT_HANDLER_CTRID,
|
|
|
|
fileSpec,
|
|
|
|
location,
|
|
|
|
type);
|
2003-04-21 23:55:12 +00:00
|
|
|
|
|
|
|
debug("*** Registering x-application-jsd content handler.\n");
|
|
|
|
compMgr.registerFactoryLocation(JSDCNT_HANDLER_CID,
|
|
|
|
"x-application-jsd content handler",
|
|
|
|
JSDCNT_HANDLER_CTRID,
|
|
|
|
fileSpec,
|
|
|
|
location,
|
|
|
|
type);
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
const JSD_CTRID = "@mozilla.org/js/jsd/debugger-service;1";
|
|
|
|
const jsdIDebuggerService = Components.interfaces.jsdIDebuggerService;
|
|
|
|
var jsds = Components.classes[JSD_CTRID].getService(jsdIDebuggerService);
|
|
|
|
jsds.initAtStartup = true;
|
|
|
|
}
|
|
|
|
catch (ex)
|
|
|
|
{
|
|
|
|
debug ("*** ERROR initializing debugger service");
|
|
|
|
debug (ex);
|
|
|
|
}
|
2001-06-14 04:46:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Module.unregisterSelf =
|
|
|
|
function(compMgr, fileSpec, location)
|
|
|
|
{
|
2006-04-12 23:23:07 +00:00
|
|
|
compMgr = compMgr.QueryInterface(nsIComponentRegistrar);
|
2001-12-19 00:12:41 +00:00
|
|
|
|
2002-01-29 21:22:13 +00:00
|
|
|
compMgr.unregisterFactoryLocation(CLINE_SERVICE_CID, fileSpec);
|
2006-04-12 23:23:07 +00:00
|
|
|
catman = Components.classes[CATMAN_CTRID].getService(nsICategoryManager);
|
|
|
|
catman.deleteCategoryEntry("command-line-argument-handlers",
|
|
|
|
CLINE_SERVICE_CTRID, true);
|
|
|
|
catman.deleteCategoryEntry("command-line-handler",
|
2001-06-14 04:46:42 +00:00
|
|
|
CLINE_SERVICE_CTRID, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
Module.getClassObject =
|
|
|
|
function (compMgr, cid, iid) {
|
|
|
|
if (cid.equals(CLINE_SERVICE_CID))
|
|
|
|
return CLineFactory;
|
|
|
|
|
- venkman only -
bug 157638, "Land VENKMAN_FLOATS_MY_BOAT branch", a=scc
Landing the 3 month old branch, which fixes the following bugs...
121409, 103898, 116102, 116099, 127750, 127099, 121501, 127102, 127737, 127733, 150481, 156776, 156769, 153381, 153066, 152946, 127752, 116286, 143682, 130398, 129692, 156111, 127736, 130050, 139565, 128604, 127751, 127732, 127727, 103425, 85634, 139557, 125394
2002-07-18 00:54:32 +00:00
|
|
|
if (cid.equals(JSDPROT_HANDLER_CID))
|
|
|
|
return JSDProtocolHandlerFactory;
|
2003-04-21 23:55:12 +00:00
|
|
|
|
|
|
|
if (cid.equals(JSDCNT_HANDLER_CID))
|
|
|
|
return JSDContentHandlerFactory;
|
2001-06-14 04:46:42 +00:00
|
|
|
|
|
|
|
if (!iid.equals(Components.interfaces.nsIFactory))
|
|
|
|
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
|
|
|
|
throw Components.results.NS_ERROR_NO_INTERFACE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Module.canUnload =
|
|
|
|
function(compMgr)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* entrypoint */
|
|
|
|
function NSGetModule(compMgr, fileSpec) {
|
|
|
|
return Module;
|
|
|
|
}
|