initial checkin of jsdebugger extension
This commit is contained in:
rginda%netscape.com 2001-04-14 19:15:10 +00:00
Родитель 8358704e96
Коммит 5577187d8b
35 изменённых файлов: 2409 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,45 @@
#
# 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/
#
# 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
# License.
#
# The Original Code is The JavaScript Debugger
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
# Robert Ginda, <rginda@netscape.com>, original author
#
DEPTH = ../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
DIRS = resources src idl
include $(topsrcdir)/config/rules.mk

Просмотреть файл

Просмотреть файл

@ -0,0 +1,130 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#include "nsISupports.idl"
%{ C++
#include "jsdebug.h"
%}
[ptr] native JSDContext(JSDContext);
[ptr] native JSDScript(JSDScript);
[ptr] native JSDThreadState(JSDThreadState);
/*
[scriptable, uuid(e7c8ea2c-1dd1-11b2-9242-f2768e04e92e)]
interface jsdIHandle : nsISupports
{
[noscript] readonly attribute voidPtr data;
};
*/
[scriptable, uuid(a2dd25a4-1dd1-11b2-bda6-ed525acd4c35)]
interface jsdIContext : nsISupports
{
[noscript] readonly attribute JSDContext JSDContext;
};
[scriptable, uuid(d500e8b8-1dd1-11b2-89a1-cdf55d91cbbd)]
interface jsdIObject : nsISupports
{};
[scriptable, uuid(b8816e56-1dd1-11b2-81dc-8ba99a833d9e)]
interface jsdIProperty : nsISupports
{};
[scriptable, uuid(a38f65ca-1dd1-11b2-95d5-ff2947e9c920)]
interface jsdIScript : nsISupports
{
[noscript] readonly attribute JSDScript JSDScript;
readonly attribute boolean isActive;
readonly attribute wstring fileName;
readonly attribute wstring functionName;
readonly attribute unsigned long baseLineNumber;
readonly attribute unsigned long lineExtent;
};
[scriptable, uuid(a47adad2-1dd1-11b2-b9e9-8e67a47beca5)]
interface jsdISourceText : nsISupports
{};
[scriptable, uuid(b6d50784-1dd1-11b2-a932-882246c6fe45)]
interface jsdIStackFrameInfo : nsISupports
{};
[scriptable, uuid(b6d1c006-1dd1-11b2-b9d8-b4d1ccfb74d8)]
interface jsdIThreadState : nsISupports
{
[noscript] readonly attribute JSDThreadState JSDThreadState;
};
[scriptable, uuid(b7964304-1dd1-11b2-ba20-cf4205772e9d)]
interface jsdIValue : nsISupports
{};
[scriptable, uuid(ae89a7e2-1dd1-11b2-8c2f-af82086291a5)]
interface jsdIScriptHook : nsISupports
{
void onScriptHook (in jsdIContext aCx, in jsdIScript aScript,
in boolean aCreating);
};
[scriptable, uuid(9a7b6ad0-1dd1-11b2-a789-fcfae96356a2)]
interface jsdIExecutionHook : nsISupports
{
const unsigned long HOOK_RETURN_HOOK_ERROR = 0;
const unsigned long HOOK_RETURN_CONTINUE = 1;
const unsigned long HOOK_RETURN_ABORT = 2;
const unsigned long HOOK_RETURN_RET_WITH_VAL = 3;
const unsigned long HOOK_RETURN_THROW_WITH_VAL = 4;
const unsigned long HOOK_RETURN_CONTINUE_THROW = 5;
unsigned long onExecutionHook (in jsdIContext aCx,
in jsdIThreadState aThreadState,
in unsigned long aType, out nsISupports rval);
};
[scriptable, uuid(01be7f9a-1dd2-11b2-9d55-aaf919b27c73)]
interface jsdIDebuggerService : nsISupports
{
void init ();
attribute jsdIScriptHook scriptHook;
attribute jsdIExecutionHook interruptHook;
};

Просмотреть файл

Просмотреть файл

@ -0,0 +1,40 @@
#
# 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/
#
# 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
# License.
#
# The Original Code is The JavaScript Debugger
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
# Robert Ginda, <rginda@netscape.com>, original author
#
DEPTH = ..\..
include <$(DEPTH)\config\config.mak>
DIRS = resources src idl
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

@ -0,0 +1,46 @@
#
# 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/
#
# 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
# License.
#
# The Original Code is The JavaScript Debugger
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
# Robert Ginda, <rginda@netscape.com>, original author
#
DEPTH = ../../..
topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
chrome::
@$(REGCHROME) content venkman venkman.jar
@$(REGCHROME) skin modern/venkman venkman.jar
@$(REGCHROME) locale en-US/venkman venkman.jar

Просмотреть файл

@ -0,0 +1,89 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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 License.
*
* The Original Code is JSIRC Library
*
* The Initial Developer of the Original Code is New Dimensions Consulting,
* Inc. Portions created by New Dimensions Consulting, Inc. are
* Copyright (C) 1999 New Dimenstions Consulting, Inc. All
* Rights Reserved.
*
* Contributor(s):
*
*
* Contributor(s):
* Robert Ginda, rginda@ndcico.com, original author
*/
function CCommandManager ()
{
this.commands = new Array();
}
CCommandManager.prototype.add =
function cmgr_add (name, func, usage, help)
{
function compare (a, b)
{
if (a.name == b.name)
return 0;
else
if (a.name > b.name)
return 1;
else
return -1;
}
this.commands.push ({name: name, func: func, usage: usage, help: help});
this.commands = this.commands.sort(compare);
}
CCommandManager.prototype.list =
function cmgr_list (partialName)
{
/* returns array of command objects which look like |partialName|, or
* all commands if |partialName| is not specified */
if ((typeof partialName == "undefined") ||
(String(partialName) == ""))
return this.commands;
var ary = new Array();
for (var i in this.commands)
{
if (this.commands[i].name.indexOf(partialName) == 0)
if (partialName.length == this.commands[i].name.length)
/* exact match */
return [this.commands[i]];
else
ary.push (this.commands[i]);
}
return ary;
}
CCommandManager.prototype.listNames =
function cmgr_listnames (partialName)
{
var cmds = this.list(partialName);
var cmdNames = new Array();
for (var c in cmds)
cmdNames.push (cmds[c].name);
return cmdNames.sort();
}

Просмотреть файл

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:package:root">
<RDF:li resource="urn:mozilla:package:venkman"/>
</RDF:Seq>
<!-- package information -->
<RDF:Description about="urn:mozilla:package:venkman"
chrome:displayName="JavaScript Debugger"
chrome:author="mozilla.org"
chrome:name="venkman">
</RDF:Description>
<!-- overlay information -->
<RDF:Seq about="urn:mozilla:overlays">
<RDF:li resource="chrome://communicator/content/tasksOverlay.xul"/>
</RDF:Seq>
<RDF:Seq about="chrome://communicator/content/tasksOverlay.xul">
<RDF:li>chrome://venkman/content/venkman-overlay.xul</RDF:li>
</RDF:Seq>
</RDF:RDF>

Просмотреть файл

@ -0,0 +1,46 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
const NS_XHTML = "http://www.w3.org/1999/xhtml";
const HTML_BR = "html:br";
const HTML_IMG = "html:img";
const HTML_SPAN = "html:span";
const HTML_TABLE = "html:table";
const HTML_TBODY = "html:tbody";
const HTML_TD = "html:td";
const HTML_TH = "html:th";
const HTML_TR = "html:tr";

Просмотреть файл

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
function initCommands(commandObject)
{
console.commands = new CCommandManager();
function add (name, func, usage, help)
{
console.commands.add (name, func, usage, help);
}
add ("quit", "onInputQuit", "",
"Close this window.");
}

Просмотреть файл

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
var dbg;
const JSD_CTRID = "@mozilla.org/js/jsd/debugger-service;1";
const jsdIDebuggerService = Components.interfaces.jsdIDebuggerService;
const jsdIExecutionHook = Components.interfaces.jsdIExecutionHook;
var scriptHooker = new Object();
scriptHooker.onScriptHook =
function sh_scripthook (cx, script, creating)
{
dd ("onScriptHook (" + cx + ", " + script + " " + creating + ")");
}
var interruptHooker = new Object();
interruptHooker.onExecutionHook =
function ih_exehook (cx, state, type, rv)
{
dd ("onInterruptHook (" + cx + ", " + state + ", " + type + ")");
return jsdIExecutionHook.HOOK_RETURN_CONTINUE;
}
function initDebugger()
{
dbg = Components.classes[JSD_CTRID].getService(jsdIDebuggerService);
dbg.init();
dbg.scriptHook = scriptHooker;
dbg.interruptHook = interruptHooker;
}

Просмотреть файл

@ -0,0 +1,196 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
/* Alphabetical order, please. */
console.onLoad =
function con_load (e)
{
dd ("Application venkman, 'JavaScript Debugger' loaded.");
init();
display ("testing 1 2 3", "TEST");
display ("{ line1\n line2\nline3 }", "TEST");
display ("testing 1 2 3", "TEST");
}
console.onInputCommand =
function con_icommand (e)
{
var ary = console.commands.list (e.command);
switch (ary.length)
{
case 0:
display ("Unknown command ``" + e.command + "''.", "ERROR");
break;
case 1:
if (typeof console[ary[0].func] == "undefined")
display ("Sorry, ``" + ary[0].name +
"'' has not been implemented.", "ERROR");
else
{
e.commandEntry = ary[0];
if (!console[ary[0].func](e))
display ("USAGE" + ary[0].name + " " + ary[0].usage,
"USAGE");
}
break;
default:
display ("Ambiguous command: ``" + e.command + "''", "ERROR");
var str = "";
for (var i in ary)
str += str ? ", " + ary[i].name : ary[i].name;
display (ary.length + " commands match: " + str, "ERROR");
}
}
console.onInputCompleteLine =
function con_icline (e)
{
if (console._inputHistory[0] != e.line)
console._inputHistory.unshift (e.line);
if (console._inputHistory.length > console.prefs["input.history.max"])
console._inputHistory.pop();
console._lastHistoryReferenced = -1;
console._incompleteLine = "";
if (e.line[0] == console.prefs["input.commandchar"])
{ /* starts with a '/', look up the command */
var ary = e.line.substr(1, e.line.length).match (/(\S+)? ?(.*)/);
var command = ary[1];
e.command = command;
e.inputData = ary[2] ? stringTrim(ary[2]) : "";
e.line = e.line;
console.onInputCommand (e);
}
else /* no command character */
{
e.inputData = e.line;
console.onInputEval (e);
}
}
console.onInputEval =
function con_ieval (e)
{
try
{
display (e.inputData, "EVAL-IN");
var rv = String(console.doEval (e.inputData));
display (rv, "EVAL-OUT");
}
catch (ex)
{
var str = "";
if ("name" in ex && "fileName" in ex && "lineNumber" in ex &&
"message" in ex)
/* if it looks like a normal exception, print all the bits */
str = ex.name + ": " + ex.fileName + ", line " + ex.lineNumber +
": " + ex.message;
else
/* otherwise, just convert to a string */
str = String(ex);
display (str, "ERROR");
}
return true;
}
console.onSingleLineKeypress =
function con_slkeypress (e)
{
switch (e.keyCode)
{
case 13:
if (!e.target.value)
return;
ev = new Object();
ev.keyEvent = e;
ev.line = e.target.value;
console.onInputCompleteLine (ev);
e.target.value = "";
break;
case 38: /* up */
if (console._lastHistoryReferenced <
console._inputHistory.length - 1)
e.target.value =
console._inputHistory[++console._lastHistoryReferenced];
break;
case 40: /* down */
if (console._lastHistoryReferenced > 0)
e.target.value =
console._inputHistory[--console._lastHistoryReferenced];
else
{
console._lastHistoryReferenced = -1;
e.target.value = console._incompleteLine;
}
break;
default:
console._incompleteLine = e.target.value;
break;
}
}
console.onUnload =
function con_unload (e)
{
dd ("Application venkman, 'JavaScript Debugger' unloaded.");
}
window.onresize =
function ()
{
console.scrollDown();
}

Просмотреть файл

@ -0,0 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<LINK REL=StyleSheet HREF='chrome://venkman/skin/venkman-output-default.css'
TYPE='text/css' MEDIA='screen'>
<body class="venkman-body"><table border="0" cellpadding="0" cellspacing="0" id="output-table"><tbody id="output-tbody"></tbody></table></body>
</html>

Просмотреть файл

@ -0,0 +1,40 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
function start_venkman()
{
toOpenWindowByType("mozapp:venkman", "chrome://venkman/content/venkman.xul");
}

Просмотреть файл

@ -0,0 +1,64 @@
<?xml version="1.0"?>
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<!--
This file contains the nodes that will be overlayed on top of
<chrome://communicator/content/tasksOverlay.xul>.
Place JavaScript code that this file needs in venkman-overlay.js.
Declare XMl entites that this file refers to in venkman-overlay.dtd.
-->
<!DOCTYPE window SYSTEM "chrome://venkman/locale/venkman-overlay.dtd" >
<overlay id="venkmanTaskMenuID"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script src="chrome://venkman/content/venkman-overlay.js"/>
<!--
This is the id that the menuitem will be appended to. see tasksOverlay.xul
-->
<menupopup id="taskPopup">
<menuitem position="6"
label="&venkmanCmd.label;"
oncommand="start_venkman()"/>
</menupopup>
</overlay>

Просмотреть файл

@ -0,0 +1,59 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
console.prefs = new Object();
function initPrefs()
{
console.prefs = new Object();
console.addPref ("input.commandchar", "/");
console.addPref ("input.history.max", 20);
console.addPref ("output.wordbreak.length", 40);
}
console.prefs.save =
function pfs_save ()
{
throw new Foo("Not Implemented.");
}
console.addPref =
function con_addpref (prefName, defaultValue)
{
/* XXX convert this to get/set wrappers around mozilla pref api */
console.prefs[prefName] = defaultValue;
}

Просмотреть файл

@ -0,0 +1,164 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
if (DEBUG)
dd = function (msg) { dumpln("-*- venkman: " + msg); }
else
dd = function (){};
var console = new Object();
console._inputHistory = new Array();
console._lastHistoryReferenced = -1;
console._incompleteLine = "";
console._lastTabUp = new Date();
function init()
{
initCommands();
initPrefs();
initDebugger();
console._outputDocument =
document.getElementById ("output-iframe").contentDocument;
console._outputElement =
console._outputDocument.getElementById ("output-tbody");
}
function Foo (msg)
{
dd ("new Foo (" + msg + ") from\n" + getStackTrace());
this.msg = msg;
}
console.inputHistory = new Array();
console.doEval =
function con_eval(__s)
{
return eval(__s);
}
var display = console.display =
function display(message, msgtype)
{
if (typeof message == "undefined")
throw new Foo ("undefined message passed to display()");
function setAttribs (obj, c, attrs)
{
for (var a in attrs)
obj.setAttribute (a, attrs[a]);
obj.setAttribute ("class", c);
obj.setAttribute ("msg-type", msgtype);
}
function stringToMsg (message)
{
var ary = message.split ("\n");
var span = document.createElementNS (NS_XHTML, HTML_SPAN);
for (var l in ary)
{
var wordParts =
splitLongWord (ary[l], console.prefs["output.wordbreak.length"]);
for (var i in wordParts)
{
span.appendChild (document.createTextNode (wordParts[i]));
var img = document.createElementNS (NS_XHTML, HTML_IMG);
span.appendChild (img);
}
span.appendChild (document.createElementNS (NS_XHTML, HTML_BR));
}
return span;
}
var msgRow = document.createElementNS(NS_XHTML, HTML_TR);
setAttribs(msgRow, "msg");
var msgData = document.createElementNS(NS_XHTML, HTML_TD);
setAttribs (msgData, "msg-data");
msgData.appendChild (stringToMsg (message));
msgRow.appendChild (msgData);
console._outputElement.appendChild (msgRow);
console.scrollDown();
}
console.load =
function con_load(url, obj)
{
var rv;
if (!console._loader)
{
const LOADER_CTRID = "@mozilla.org/moz/jssubscript-loader;1";
const mozIJSSubScriptLoader =
Components.interfaces.mozIJSSubScriptLoader;
var cls;
if ((cls = Components.classes[LOADER_CTRID]))
console._loader = cls.createInstance (mozIJSSubScriptLoader);
}
try {
rv = console._loader.loadSubScript (url, obj);
}
catch (ex)
{
var msg = "Error loading subscript: " + ex;
if (ex.fileName)
msg += " file:" + ex.fileName;
if (ex.lineNumber)
msg += " line:" + ex.lineNumber;
display (msg, "ERROR");
}
display ("URL ``" + url + "'' loaded with result ``" + String(rv) + "''.",
"ERROR");
return rv;
}
console.scrollDown =
function con_scrolldn ()
{
window.frames[0].scrollTo(0, window.frames[0].document.height);
}

Просмотреть файл

@ -0,0 +1,411 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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 License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is New Dimensions Consulting,
* Inc. Portions created by New Dimensions Consulting, Inc. are
* Copyright (C) 1999 New Dimensions Consulting, Inc. All Rights Reserved.
*
* Contributor(s):
* Robert Ginda, rginda@ndcico.com, original author
*
*
* JavaScript utility functions.
*/
var dumpln;
var dd;
if (typeof document == "undefined") /* in xpcshell */
dumpln = print;
else
if (typeof dump == "function")
dumpln = function (str) {dump (str + "\n");}
else if (jsenv.HAS_RHINO)
dumpln = function (str) {var out = java.lang.System.out;
out.println(str); out.flush(); }
else
dumpln = function () {} /* no suitable function */
if (DEBUG)
dd = dumpln;
else
dd = function (){};
var jsenv = new Object();
jsenv.HAS_SECURITYMANAGER = ((typeof netscape == "object") &&
(typeof netscape.security == "object"));
jsenv.HAS_XPCOM = ((typeof Components == "function") &&
(typeof Components.classes == "function"));
jsenv.HAS_JAVA = (typeof java == "object");
jsenv.HAS_RHINO = (typeof defineClass == "function");
jsenv.HAS_DOCUMENT = (typeof document == "object");
/* Dumps an object in tree format, recurse specifiec the the number of objects
* to recurse, compress is a boolean that can uncompress (true) the output
* format, and level is the number of levels to intitialy indent (only useful
* internally.) A sample dumpObjectTree (o, 1) is shown below.
*
* + parent (object)
* + users (object)
* | + jsbot (object)
* | + mrjs (object)
* | + nakkezzzz (object)
* | *
* + bans (object)
* | *
* + topic (string) 'ircclient.js:59: nothing is not defined'
* + getUsersLength (function) 9 lines
* *
*/
function dumpObjectTree (o, recurse, compress, level)
{
var s = "";
var pfx = "";
if (typeof recurse == "undefined")
recurse = 0;
if (typeof level == "undefined")
level = 0;
if (typeof compress == "undefined")
compress = true;
for (var i = 0; i < level; i++)
pfx += (compress) ? "| " : "| ";
var tee = (compress) ? "+ " : "+- ";
for (i in o)
{
var t = typeof o[i];
switch (t)
{
case "function":
var sfunc = String(o[i]).split("\n");
if (sfunc[2] == " [native code]")
sfunc = "[native code]";
else
sfunc = sfunc.length + " lines";
s += pfx + tee + i + " (function) " + sfunc + "\n";
break;
case "object":
s += pfx + tee + i + " (object)\n";
if (!compress)
s += pfx + "|\n";
if ((i != "parent") && (recurse))
s += dumpObjectTree (o[i], recurse - 1,
compress, level + 1);
break;
case "string":
if (o[i].length > 200)
s += pfx + tee + i + " (" + t + ") " +
o[i].length + " chars\n";
else
s += pfx + tee + i + " (" + t + ") '" + o[i] + "'\n";
break;
default:
s += pfx + tee + i + " (" + t + ") " + o[i] + "\n";
}
if (!compress)
s += pfx + "|\n";
}
s += pfx + "*\n";
return s;
}
function splitLongWord (str, pos)
{
if (str.length <= pos)
return [str];
var ary = new Array();
var right = str;
while (right.length > pos)
{
/* search for a nice place to break the word, fuzzfactor of +/-5,
* centered around |pos| */
var splitPos =
right.substring(pos - 5, pos + 5).search(/[^A-Za-z0-9]/);
splitPos = (splitPos != -1) ? pos - 4 + splitPos : pos;
ary.push(right.substr (0, splitPos));
right = right.substr (splitPos);
}
ary.push (right);
return ary;
}
/*
* Clones an existing object (Only the enumerable properties
* of course.) use as a function..
* var c = Clone (obj);
* or a constructor...
* var c = new Clone (obj);
*/
function Clone (obj)
{
robj = new Object();
for (var p in obj)
robj[p] = obj[p];
return robj;
}
function renameProperty (obj, oldname, newname)
{
if (oldname == newname)
return;
obj[newname] = obj[oldname];
delete obj[oldname];
}
function newObject(contractID, iface)
{
if (!jsenv.HAS_XPCOM)
return null;
var obj = Components.classes[contractID].createInstance();
var rv;
switch (typeof iface)
{
case "string":
rv = obj.QueryInterface(Components.interfaces[iface]);
break;
case "object":
rv = obj.QueryInterface[iface];
break;
default:
rv = null;
break;
}
return rv;
}
function keys (o)
{
var rv = new Array();
for (var p in o)
rv.push(p);
return rv;
}
function stringTrim (s)
{
if (!s)
return "";
s = s.replace (/^\s+/, "");
return s.replace (/\s+$/, "");
}
function formatDateOffset (seconds, format)
{
seconds = parseInt(seconds);
var minutes = parseInt(seconds / 60);
seconds = seconds % 60;
var hours = parseInt(minutes / 60);
minutes = minutes % 60;
var days = parseInt(hours / 24);
hours = hours % 24;
if (!format)
{
var ary = new Array();
if (days > 0)
ary.push (days + " days");
if (hours > 0)
ary.push (hours + " hours");
if (minutes > 0)
ary.push (minutes + " minutes");
if (seconds > 0)
ary.push (seconds + " seconds");
format = ary.join(", ");
}
else
{
format = format.replace ("%d", days);
format = format.replace ("%h", hours);
format = format.replace ("%m", minutes);
format = format.replace ("%s", seconds);
}
return format;
}
function arraySpeak (ary, single, plural)
{
var rv = "";
switch (ary.length)
{
case 0:
break;
case 1:
rv = ary[0];
if (single)
rv += " " + single;
break;
case 2:
rv = ary[0] + " and " + ary[1];
if (plural)
rv += " " + plural;
break;
default:
for (var i = 0; i < ary.length - 1; ++i)
rv += ary[i] + ", ";
rv += "and " + ary[ary.length - 1];
if (plural)
rv += " " + plural;
break;
}
return rv;
}
function arrayContains (ary, elem)
{
return (arrayIndexOf (ary, elem) != -1);
}
function arrayIndexOf (ary, elem)
{
for (var i in ary)
if (ary[i] == elem)
return i;
return -1;
}
function arrayInsertAt (ary, i, o)
{
ary.splice (i, 0, o);
}
function arrayRemoveAt (ary, i)
{
ary.splice (i, 1);
}
function getRandomElement (ary)
{
var i = parseInt (Math.random() * ary.length)
if (i == ary.length) i = 0;
return ary[i];
}
function roundTo (num, prec)
{
return parseInt ( Math.round(num * Math.pow (10, prec))) /
Math.pow (10, prec);
}
function randomRange (min, max)
{
if (typeof min == "undefined")
min = 0;
if (typeof max == "undefined")
max = 1;
var rv = (parseInt(Math.round((Math.random() * (max - min)) + min )));
return rv;
}
function getStackTrace ()
{
if (!jsenv.HAS_XPCOM)
return "No stack trace available.";
var frame = Components.stack.caller;
var str = "<top>";
while (frame)
{
var name = frame.functionName ? frame.functionName : "[anonymous]";
str += "\n" + name + "@" + frame.lineNumber;
frame = frame.caller;
}
return str;
}
function getInterfaces (cls)
{
if (!jsenv.HAS_XPCOM)
return null;
var rv = new Object();
var e;
for (var i in Components.interfaces)
{
try
{
var ifc = Components.interfaces[i];
cls.QueryInterface(ifc);
rv[i] = ifc;
}
catch (e)
{
/* nada */
}
}
return rv;
}

Просмотреть файл

@ -0,0 +1,113 @@
<?xml version="1.0"?>
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<!DOCTYPE window SYSTEM "chrome://venkman/locale/venkman.dtd" >
<?xml-stylesheet href="chrome://venkman/skin/venkman.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
<window id="main-window" align="vertical"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="console.onLoad();" onunload="console.onUnload();"
persist="width height screenX screenY" title="&vkm.MainWindow.title;"
windowtype="mozapp:venkman">
<script>
<![CDATA[
/* set this to false to turn off dd() messages */
var DEBUG = true;
]]>
</script>
<script src="chrome://venkman/content/html-consts.js"/>
<script src="chrome://venkman/content/command-manager.js"/>
<script src="chrome://venkman/content/venkman-utils.js"/>
<script src="chrome://venkman/content/venkman-static.js"/>
<script src="chrome://venkman/content/venkman-handlers.js"/>
<script src="chrome://venkman/content/venkman-debugger.js"/>
<script src="chrome://venkman/content/venkman-commands.js"/>
<script src="chrome://venkman/content/venkman-prefs.js"/>
<commandset id="tasksCommands">
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_quit"/>
</commandset>
<keyset id="tasksKeys">
<key id="key_close"/>
<key id="key_quit"/>
</keyset>
<commandset id="venkmanCommands">
<command id="cmd_reload_ui"
oncommand="if (DEBUG) window.location.href = window.location.href;"/>
</commandset>
<keyset id="venkmanKeys">
<key id="key_reload_ui" observes="cmd_reload_ui"
modifiers="control alt" key="R"/>
</keyset>
<toolbox>
<menubar id="main-menubar" persist="collapsed">
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menuitem id="menu_reload_ui" key="key_reload_ui"
observes="cmd_reload_ui"
label="&vkm.ReloadUI.label;" accesskey="&vkm.ReloadUI.akey;"/>
<menuseperator/>
<menuitem id="menu_close"/>
</menupopup>
</menu>
<menu id="tasksMenu"/>
</menubar>
</toolbox>
<box flex="1" orient="vertical">
<html:iframe id="output-iframe" flex="1"
src="chrome://venkman/content/venkman-output-window.html" type="content"/>
<textbox id="input-single-line" class="input-widget"
onkeypress="console.onSingleLineKeypress(event);"/>
</box>
</window>

Просмотреть файл

@ -0,0 +1,54 @@
// this function verifies disk space in kilobytes
function verifyDiskSpace(dirPath, spaceRequired)
{
var spaceAvailable;
// Get the available disk space on the given path
spaceAvailable = fileGetDiskSpaceAvailable(dirPath);
// Convert the available disk space into kilobytes
spaceAvailable = parseInt(spaceAvailable / 1024);
// do the verification
if(spaceAvailable < spaceRequired)
{
logComment("Insufficient disk space: " + dirPath);
logComment(" required : " + spaceRequired + " K");
logComment(" available: " + spaceAvailable + " K");
return(false);
}
return(true);
}
var srDest = 1;
var err = initInstall("JavaScript Debugger", "venkman",
"prototype_a");
logComment("initInstall: " + err);
if (verifyDiskSpace(getFolder("Program"), srDest))
{
addFile("JavaScript Debugger",
"bin/chrome/venkman.jar", // jar source folder
getFolder("Chrome"), // target folder
""); // target subdir
registerChrome(PACKAGE | DELAYED_CHROME,
getFolder("Chrome","venkman.jar"),
"content/venkman/");
registerChrome(LOCALE | DELAYED_CHROME, getFolder("Chrome",
"venkman.jar"),
"locale/en-US/venkman/");
registerChrome(SKIN | DELAYED_CHROME, getFolder("Chrome",
"venkman.jar"),
"skin/modern/venkman/");
if (err==SUCCESS)
performInstall();
else
cancelInstall(err);
}
else
cancelInstall(INSUFFICIENT_DISK_SPACE);

Просмотреть файл

@ -0,0 +1,21 @@
venkman.jar:
content/venkman/contents.rdf (content/contents.rdf)
locale/en-US/venkman/contents.rdf (locale/en-US/contents.rdf)
skin/modern/venkman/contents.rdf (skin/contents.rdf)
content/venkman/venkman.xul (content/venkman.xul)
content/venkman/venkman-utils.js (content/venkman-utils.js)
content/venkman/venkman-handlers.js (content/venkman-handlers.js)
content/venkman/venkman-static.js (content/venkman-static.js)
content/venkman/venkman-debugger.js (content/venkman-debugger.js)
content/venkman/venkman-commands.js (content/venkman-commands.js)
content/venkman/venkman-prefs.js (content/venkman-prefs.js)
content/venkman/venkman-output-window.html (content/venkman-output-window.html)
content/venkman/html-consts.js (content/html-consts.js)
content/venkman/command-manager.js (content/command-manager.js)
content/venkman/venkman-overlay.xul (content/venkman-overlay.xul)
content/venkman/venkman-overlay.js (content/venkman-overlay.js)
skin/modern/venkman/venkman.css (skin/venkman.css)
skin/modern/venkman/venkman-output-default.css (skin/venkman-output-default.css)
locale/en-US/venkman/venkman-overlay.dtd (locale/en-US/venkman-overlay.dtd)
locale/en-US/venkman/venkman.dtd (locale/en-US/venkman.dtd)
locale/en-US/venkman/venkman.properties (locale/en-US/venkman.properties)

Просмотреть файл

@ -0,0 +1,59 @@
<?xml version="1.0"?>
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<!-- list all the packages being supplied by this jar -->
<RDF:Seq about="urn:mozilla:locale:root">
<RDF:li resource="urn:mozilla:locale:en-US"/>
</RDF:Seq>
<!-- locale information -->
<RDF:Description about="urn:mozilla:locale:en-US"
chrome:displayName="English(US)"
chrome:author="app_author"
chrome:name="en-US"
chrome:previewURL="http://www.mozilla.org/locales/en-US.gif">
<chrome:packages>
<RDF:Seq about="urn:mozilla:locale:en-US:packages">
<RDF:li resource="urn:mozilla:locale:en-US:venkman"/>
</RDF:Seq>
</chrome:packages>
</RDF:Description>
</RDF:RDF>

Просмотреть файл

@ -0,0 +1,37 @@
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<!ENTITY venkmanCmd.label "JavaScript Debugger">

Просмотреть файл

@ -0,0 +1,44 @@
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<!ENTITY app.name.short "venkman">
<!ENTITY app.name.long "JavaScript Debugger">
<!ENTITY app.version "prototype_a">
<!ENTITY app.author "mozilla.org">
<!ENTITY vkm.MainWindow.title "JavaScript Console Debugger">
<!ENTITY vkm.ReloadUI.label "Reload UI">
<!ENTITY vkm.ReloadUI.akey "R">

Просмотреть файл

@ -0,0 +1,2 @@
msgtypeINFO=INFO
msgtype

Просмотреть файл

@ -0,0 +1,43 @@
#
# 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/
#
# 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
# License.
#
# The Original Code is The JavaScript Debugger
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation
# Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation.
#
# Alternatively, the contents of this file may be used under the
# terms of the GNU Public License (the "GPL"), in which case the
# provisions of the GPL are applicable instead of those above.
# If you wish to allow use of your version of this file only
# under the terms of the GPL and not to allow others to use your
# version of this file under the MPL, indicate your decision by
# deleting the provisions above and replace them with the notice
# and other provisions required by the GPL. If you do not delete
# the provisions above, a recipient may use your version of this
# file under either the MPL or the GPL.
#
# Contributor(s):
# Robert Ginda, <rginda@netscape.com>, original author
#
DEPTH = ..\..\..
include <$(DEPTH)\config\config.mak>
include <$(DEPTH)\config\rules.mak>
chrome::
$(REGCHROME) content venkman venkman.jar
$(REGCHROME) skin modern/venkman venkman.jar
$(REGCHROME) locale en-US/venkman venkman.jar

Просмотреть файл

@ -0,0 +1,57 @@
<?xml version="1.0"?>
<!--
-
- 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/
-
- 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
- License.
-
- The Original Code is The JavaScript Debugger
-
- The Initial Developer of the Original Code is
- Netscape Communications Corporation
- Portions created by Netscape are
- Copyright (C) 1998 Netscape Communications Corporation.
- All Rights Reserved.
-
- Alternatively, the contents of this file may be used under the
- terms of the GNU Public License (the "GPL"), in which case the
- provisions of the GPL are applicable instead of those above.
- If you wish to allow use of your version of this file only
- under the terms of the GPL and not to allow others to use your
- version of this file under the MPL, indicate your decision by
- deleting the provisions above and replace them with the notice
- and other provisions required by the GPL. If you do not delete
- the provisions above, a recipient may use your version of this
- file under either the MPL or the GPL.
-
- Contributor(s):
- Robert Ginda, <rginda@netscape.com>, original author
-
-->
<RDF:RDF xmlns:RDF="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:chrome="http://www.mozilla.org/rdf/chrome#">
<RDF:Seq about="urn:mozilla:skin:root">
<RDF:li resource="urn:mozilla:skin:modern/1.0" />
</RDF:Seq>
<!-- skin information -->
<RDF:Description about="urn:mozilla:skin:modern/1.0"
chrome:displayName="modern"
chrome:author="app_author}"
chrome:name="modern/1.0">
<chrome:packages>
<RDF:Seq about="urn:mozilla:skin:modern/1.0:packages">
<RDF:li resource="urn:mozilla:skin:modern/1.0:venkman"/>
</RDF:Seq>
</chrome:packages>
</RDF:Description>
</RDF:RDF>

Просмотреть файл

@ -0,0 +1,30 @@
body.venkman-body {
background: black;
color: lightgrey;
}
#output-table {
margin-top: 100%;
width: 100%;
}
.msg { /* .msg = a single message in the */
width: 100%; /* output window */
font-size: 10pt;
font-family: sans-serif;
white-space: -moz-pre-wrap;
}
.msg-data:before {
content: "+";
color: yellow;
margin-right: 5px;
}
.msg-data[msg-type="EVAL-IN"]:before {
content: "<";
}
.msg-data[msg-type="EVAL-OUT"]:before {
content: ">";
}

Просмотреть файл

@ -0,0 +1,41 @@
/* -*- tab-width: 4; indent-tabs-mode: nil -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is The JavaScript Debugger
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
* Robert Ginda, <rginda@netscape.com>, original author
*
*/
@import url(chrome://communicator/skin/);
#output-iframe {
margin: 5px 5px 0px 5px;
border: thin silver inset;
}

Просмотреть файл

Просмотреть файл

@ -0,0 +1,167 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#include "jsdebug.h"
#include "prmem.h"
#include "jsdDebuggerService.h"
#include "jsdHandles.h"
#include "nsIGenericFactory.h"
#include "nsIServiceManager.h"
#include "nsIXPConnect.h"
#define JSDS_HANDLE_HASH_BUCKETS 4096
const char jsdServiceContractID[] = "@mozilla.org/js/jsd/debugger-service;1";
NS_IMPL_THREADSAFE_ISUPPORTS1(jsdService, jsdIDebuggerService);
void
jsds_SetContextProc (JSDContext* jsdc, void* user)
{
printf ("jsds_SetContextProc: called.\n");
}
static PRUint32
jsds_InterruptHookProc (JSDContext* jsdc, JSDThreadState* jsdthreadstate,
uintN type, void* callerdata, jsval* rval)
{
if (!callerdata)
return JSD_HOOK_RETURN_CONTINUE;
jsdIExecutionHook *hook = NS_STATIC_CAST(jsdIExecutionHook *, callerdata);
nsISupports *is_rv = 0;
PRUint32 hook_rv = JSD_HOOK_RETURN_CONTINUE;
hook->OnExecutionHook (jsdContext::FromPtr(jsdc),
jsdThreadState::FromPtr(jsdthreadstate),
type, &is_rv, &hook_rv);
return hook_rv;
}
static void
jsds_ScriptHookProc (JSDContext* jsdc, JSDScript* jsdscript, JSBool creating,
void* callerdata)
{
if (!callerdata)
return;
jsdIScriptHook *hook = NS_STATIC_CAST(jsdIScriptHook *, callerdata);
hook->OnScriptHook (jsdContext::FromPtr(jsdc),
jsdScript::FromPtr(jsdc, jsdscript),
creating ? PR_TRUE : PR_FALSE);
}
NS_IMETHODIMP
jsdService::Init (void)
{
nsresult rv;
/* get JS things from the CallContext */
nsCOMPtr<nsIXPConnect> xpc = do_GetService(nsIXPConnect::GetCID());
if (!xpc) return NS_ERROR_FAILURE;
nsCOMPtr<nsIXPCNativeCallContext> cc;
rv = xpc->GetCurrentNativeCallContext(getter_AddRefs(cc));
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
JSContext *cx;
rv = cc->GetJSContext (&cx);
if (NS_FAILED(rv)) return NS_ERROR_FAILURE;
mJSrt = JS_GetRuntime (cx);
JSD_UserCallbacks jsd_uc;
jsd_uc.size = sizeof(JSD_UserCallbacks);
jsd_uc.setContext = jsds_SetContextProc;
mJSDcx = JSD_DebuggerOnForUser (mJSrt, &jsd_uc, NULL);
JSD_SetInterruptHook (mJSDcx, jsds_InterruptHookProc,
NS_STATIC_CAST(void *, 0 /*aHook*/));
JSD_SetScriptHook (mJSDcx, jsds_ScriptHookProc,
NS_STATIC_CAST(void *, 0 /*aHook*/));
return NS_OK;
}
NS_IMETHODIMP
jsdService::SetInterruptHook (jsdIExecutionHook *aHook)
{
mInterruptHook = aHook;
JSD_SetInterruptHook (mJSDcx, jsds_InterruptHookProc,
NS_STATIC_CAST(void *, aHook));
return NS_OK;
}
NS_IMETHODIMP
jsdService::GetInterruptHook (jsdIExecutionHook **aHook)
{
if (!aHook)
return NS_ERROR_NULL_POINTER;
NS_IF_ADDREF(mInterruptHook);
*aHook = mInterruptHook;
return NS_OK;
}
NS_IMETHODIMP
jsdService::SetScriptHook (jsdIScriptHook *aHook)
{
mScriptHook = aHook;
return NS_OK;
}
NS_IMETHODIMP
jsdService::GetScriptHook (jsdIScriptHook **aHook)
{
if (!aHook)
return NS_ERROR_NULL_POINTER;
NS_IF_ADDREF(mScriptHook);
*aHook = mScriptHook;
return NS_OK;
}
NS_GENERIC_FACTORY_CONSTRUCTOR(jsdService);
static nsModuleComponentInfo components[] = {
{ "JSDService", JSDSERVICE_CID,
jsdServiceContractID,
jsdServiceConstructor},
};
NS_IMPL_NSGETMODULE("JavaScript Debugger", components);

Просмотреть файл

@ -0,0 +1,71 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#ifndef JSDSERVICE_H___
#define JSDSERVICE_H___
#include "jsdIDebuggerService.h"
#include "jsdebug.h"
#include "nsCOMPtr.h"
#define JSDSERVICE_CID \
{ /* f1299dc2-1dd1-11b2-a347-ee6b7660e048 */ \
0xf1299dc2, \
0x1dd1, \
0x11b2, \
{0xa3, 0x47, 0xee, 0x6b, 0x76, 0x60, 0xe0, 0x48} \
}
class jsdService : public jsdIDebuggerService
{
public:
NS_DECL_ISUPPORTS;
NS_DECL_JSDIDEBUGGERSERVICE;
jsdService() : mJSrt(0), mJSDcx(0), mScriptHook(0), mInterruptHook(0)
{
NS_INIT_ISUPPORTS();
}
virtual ~jsdService() { }
private:
JSRuntime *mJSrt;
JSDContext *mJSDcx;
nsCOMPtr<jsdIScriptHook> mScriptHook;
nsCOMPtr<jsdIExecutionHook> mInterruptHook;
};
#endif /* JSDSERVICE_H___ */

Просмотреть файл

Просмотреть файл

@ -0,0 +1,159 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* 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/
*
* 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
* License.
*
* The Original Code is mozilla.org code
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation
* Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation.
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU Public License (the "GPL"), in which case the
* provisions of the GPL are applicable instead of those above.
* If you wish to allow use of your version of this file only
* under the terms of the GPL and not to allow others to use your
* version of this file under the MPL, indicate your decision by
* deleting the provisions above and replace them with the notice
* and other provisions required by the GPL. If you do not delete
* the provisions above, a recipient may use your version of this
* file under either the MPL or the GPL.
*
* Contributor(s):
*
*
*/
#ifndef JSDHANDLES_H___
#define JSDHANDLES_H___
#include "jsdIDebuggerService.h"
#include "jsdebug.h"
class jsdThreadState : public jsdIThreadState
{
public:
NS_DECL_ISUPPORTS;
NS_DECL_JSDITHREADSTATE;
/* you'll normally use use FromPtr() instead of directly constructing one */
jsdThreadState (JSDThreadState *aThreadState) : mThreadState(aThreadState)
{
NS_INIT_ISUPPORTS();
}
/* XXX keep track of these somehow, so we don't create new wrappers for
* every script */
static jsdIThreadState *FromPtr (JSDThreadState *aThreadState)
{
jsdIThreadState *rv = new jsdThreadState (aThreadState);
NS_IF_ADDREF(rv);
return rv;
}
private:
jsdThreadState(); /* no implementation */
jsdThreadState(const jsdThreadState&); /* no implementation */
JSDThreadState *mThreadState;
};
class jsdContext : public jsdIContext
{
public:
NS_DECL_ISUPPORTS;
NS_DECL_JSDICONTEXT;
/* you'll normally use use FromPtr() instead of directly constructing one */
jsdContext (JSDContext *aCx) : mCx(aCx)
{
NS_INIT_ISUPPORTS();
printf ("++++++ jsdContext: %i\n", mRefCnt);
}
/* XXX keep track of these somehow, so we don't create new wrappers for
* every script */
static jsdIContext *FromPtr (JSDContext *aCx)
{
jsdIContext *rv = new jsdContext (aCx);
NS_IF_ADDREF(rv);
return rv;
}
virtual ~jsdContext() { printf ("------ ~jsdContext: %i\n", mRefCnt); }
private:
jsdContext(); /* no implementation */
jsdContext(const jsdContext&); /* no implementation */
JSDContext *mCx;
};
class jsdScript : public jsdIScript
{
public:
NS_DECL_ISUPPORTS;
NS_DECL_JSDISCRIPT;
/* you'll normally use use FromPtr() instead of directly constructing one */
jsdScript (JSDContext *aCx, JSDScript *aScript) : mCx(aCx), mScript(aScript)
{
NS_INIT_ISUPPORTS();
}
/* XXX keep track of these somehow, so we don't create new wrappers for
* every script */
static jsdIScript *FromPtr (JSDContext *aCx, JSDScript *aScript)
{
jsdIScript *rv = new jsdScript (aCx, aScript);
NS_IF_ADDREF(rv);
return rv;
}
private:
jsdScript(); /* no implementation */
jsdScript (const jsdScript&); /* no implementation */
JSDContext *mCx;
JSDScript *mScript;
};
#endif /* JSDHANDLES_H___ */
#if 0
#define DECL_HANDLE(type,type_uc,jsd_type) \
class jsd##type : public jsdI##type \
{ \
public: \
NS_DECL_ISUPPORTS; \
NS_DECL_JSDIHANDLE; \
NS_DECL_JSDI##type_uc; \
static jsd##type *FromPtr (jsd_type *aData) \
{ return new jsd##type (aData); } \
private: \
jsd_type *mData; \
jsdHandle (jsd_type *aData) : mData(aData) \
{ \
NS_INIT_ISUPPORTS(); \
} \
}
DECL_HANDLE(Handle, HANDLE, void *);
DECL_HANDLE(Script, SCRIPT, JSDScript);
#undef DECL_HANDLE
#endif

Просмотреть файл