part of bug 109652, "Venkman needs to profile" r=peterv,a=shaver
add profiling support to debugger front end
This commit is contained in:
rginda%netscape.com 2002-02-27 10:14:32 +00:00
Родитель d9e2263e94
Коммит e9569eb18e
28 изменённых файлов: 1214 добавлений и 1910 удалений

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

@ -219,7 +219,7 @@ function cmgr_showpop (id)
catch (ex)
{
dd ("caught exception evaling '" + node.getAttribute("id") + "'.'" +
attr + "'");
attr + "'\n" + ex);
}
return true;
}
@ -386,6 +386,7 @@ function cmgr_addsmenu (parent, id, label, attribs)
menu.setAttribute ("accesskey", getAccessKey(label));
menu.setAttribute ("label", label.replace("&", ""));
menu.setAttribute ("isSeparator", true);
var menupopup = document.createElement ("menupopup");
menupopup.setAttribute ("id", id + "-popup");
if (typeof attribs == "object")
@ -872,7 +873,7 @@ function parse_number (e, name)
var ary = e.unparsedData.match (/(\d+)(?:\s+(.*))?$/);
if (!ary)
return false;
e[name] = ary[1];
e[name] = Number(ary[1]);
e.unparsedData = (2 in ary) ? ary[2] : "";
return true;
}

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

@ -0,0 +1,295 @@
/* -*- 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
*
*/
/* notice that these valuse are octal. */
const PERM_IRWXU = 00700; /* read, write, execute/search by owner */
const PERM_IRUSR = 00400; /* read permission, owner */
const PERM_IWUSR = 00200; /* write permission, owner */
const PERM_IXUSR = 00100; /* execute/search permission, owner */
const PERM_IRWXG = 00070; /* read, write, execute/search by group */
const PERM_IRGRP = 00040; /* read permission, group */
const PERM_IWGRP = 00020; /* write permission, group */
const PERM_IXGRP = 00010; /* execute/search permission, group */
const PERM_IRWXO = 00007; /* read, write, execute/search by others */
const PERM_IROTH = 00004; /* read permission, others */
const PERM_IWOTH = 00002; /* write permission, others */
const PERM_IXOTH = 00001; /* execute/search permission, others */
const MODE_RDONLY = 0x01;
const MODE_WRONLY = 0x02;
const MODE_RDWR = 0x04;
const MODE_CREATE = 0x08;
const MODE_APPEND = 0x10;
const MODE_TRUNCATE = 0x20;
const MODE_SYNC = 0x40;
const MODE_EXCL = 0x80;
const PICK_OK = Components.interfaces.nsIFilePicker.returnOK;
const PICK_CANCEL = Components.interfaces.nsIFilePicker.returnCancel;
const PICK_REPLACE = Components.interfaces.nsIFilePicker.returnReplace;
const FILTER_ALL = Components.interfaces.nsIFilePicker.filterAll;
const FILTER_HTML = Components.interfaces.nsIFilePicker.filterHTML;
const FILTER_TEXT = Components.interfaces.nsIFilePicker.filterText;
const FILTER_IMAGES = Components.interfaces.nsIFilePicker.filterImages;
const FILTER_XML = Components.interfaces.nsIFilePicker.filterXML;
const FILTER_XUL = Components.interfaces.nsIFilePicker.filterXUL;
// evald f = fopen("/home/rginda/foo.txt", MODE_WRONLY | MODE_CREATE)
// evald f = fopen("/home/rginda/vnk.txt", MODE_RDONLY)
var futils = new Object();
futils.umask = PERM_IWOTH | PERM_IWGRP;
futils.MSG_SAVE_AS = "Save As";
futils.MSG_OPEN = "Open";
futils.getPicker =
function futils_nosepicker(initialPath, typeList, attribs)
{
const classes = Components.classes;
const interfaces = Components.interfaces;
const PICKER_CTRID = "@mozilla.org/filepicker;1";
const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
const nsIFilePicker = interfaces.nsIFilePicker;
const nsILocalFile = interfaces.nsILocalFile;
var picker = classes[PICKER_CTRID].createInstance(nsIFilePicker);
if (typeof attribs == "object")
{
for (var a in attribs)
picker[a] = attribs[a];
}
else
throw "bad type for param |attribs|";
if (initialPath)
{
var localFile;
if (typeof initialPath == "string")
{
localFile =
classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
localFile.initWithUnicodePath(initialPath);
}
else
{
if (!(initialPath instanceof nsILocalFile))
throw "bad type for argument |initialPath|";
localFile = initialPath;
}
picker.displayDirectory = localFile
}
if (typeof typeList == "string")
typeList = typeList.split(" ");
if (typeList instanceof Array)
{
for (var i in typeList)
{
switch (typeList[i])
{
case "$all":
picker.appendFilters(FILTER_ALL);
break;
case "$html":
picker.appendFilters(FILTER_HTML);
break;
case "$text":
picker.appendFilters(FILTER_TEXT);
break;
case "$images":
picker.appendFilters(FILTER_IMAGES);
break;
case "$xml":
picker.appendFilters(FILTER_XML);
break;
case "$xul":
picker.appendFilters(FILTER_XUL);
break;
default:
picker.appendFilter(typeList[i], typeList[i]);
break;
}
}
}
return picker;
}
function pickSaveAs (title, typeList, defaultFile, defaultDir)
{
if (!defaultDir && "lastSaveAsDir" in futils)
defaultDir = futils.lastSaveAsDir;
var picker = futils.getPicker (defaultDir, typeList,
{defaultString: defaultFile});
picker.init (window, title ? title : futils.MSG_SAVE_AS,
Components.interfaces.nsIFilePicker.modeSave);
var rv = picker.show();
if (rv != PICK_CANCEL)
futils.lastSaveAsDir = picker.file.parent;
return {reason: rv, file: picker.file, picker: picker};
}
function pickOpen (title, typeList, defaultFile, defaultDir)
{
if (!defaultDir && "lastOpenDir" in futils)
defaultDir = futils.lastOpenDir;
var picker = futils.getPicker (defaultDir, typeList,
{defaultString: defaultFile});
picker.init (window, title ? title : futils.MSG_OPEN,
Components.interfaces.nsIFilePicker.modeOpen);
var rv = picker.show();
if (rv != PICK_CANCEL)
futils.lastOpenDir = picker.file.parent;
return {reason: rv, file: picker.file, picker: picker};
}
function fopen (path, mode, perms, tmp)
{
return new LocalFile(path, mode, perms, tmp);
}
function LocalFile(file, mode, perms, tmp)
{
const classes = Components.classes;
const interfaces = Components.interfaces;
const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
const FILEIN_CTRID = "@mozilla.org/network/file-input-stream;1";
const FILEOUT_CTRID = "@mozilla.org/network/file-output-stream;1";
const SCRIPTSTREAM_CTRID = "@mozilla.org/scriptableinputstream;1";
const nsIFile = interfaces.nsIFile;
const nsILocalFile = interfaces.nsILocalFile;
const nsIFileOutputStream = interfaces.nsIFileOutputStream;
const nsIFileInputStream = interfaces.nsIFileInputStream;
const nsIScriptableInputStream = interfaces.nsIScriptableInputStream;
if (typeof perms == "undefined")
perms = 0666 & ~futils.umask;
if (typeof file == "string")
{
this.localFile = classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
this.localFile.initWithUnicodePath(file);
}
else if (file instanceof nsILocalFile)
{
this.localFile = file;
}
else
{
throw "bad type for argument |file|.";
}
if (mode & (MODE_WRONLY | MODE_RDWR))
{
this.outputStream =
classes[FILEOUT_CTRID].createInstance(nsIFileOutputStream);
this.outputStream.init(this.localFile, mode, perms);
}
if (mode & (MODE_RDONLY | MODE_RDWR))
{
var is = classes[FILEIN_CTRID].createInstance(nsIFileInputStream);
is.init(this.localFile, mode, perms, tmp);
this.inputStream =
classes[SCRIPTSTREAM_CTRID].createInstance(nsIScriptableInputStream);
this.inputStream.init(is);
}
}
LocalFile.prototype.write =
function fo_write(buf)
{
if (!("outputStream" in this))
throw "file not open for writing.";
return this.outputStream.write(buf, buf.length);
}
LocalFile.prototype.read =
function fo_read(max)
{
if (!("inputStream" in this))
throw "file not open for reading.";
var av = this.inputStream.available();
if (typeof max == "undefined")
max = av;
if (!av)
return null;
var rv = this.inputStream.read(max);
return rv;
}
LocalFile.prototype.close =
function fo_close()
{
if ("outputStream" in this)
this.outputStream.close();
if ("inputStream" in this)
this.inputStream.close();
}
LocalFile.prototype.flush =
function fo_close()
{
return this.outputStream.flush();
}

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

@ -0,0 +1,115 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>JavaScript Profile Data</title>
</head>
<style>
.profile-file-title {
font-size : larger;
font-weight: bold;
}
.label {
font-weight: bold;
color: darkred;
}
.value {
color: grey;
}
.graph-box {
border : 1px grey solid;
margin-top : 5px;
margin-bottom : 5px;
padding-top : 5px;
padding-bottom: 5px;
background : lightgrey;
display : block;
}
.graph-body {
margin-left: 3%;
background : white;
display : block;
width : 94%;
border : 1px black solid;
}
.graph-title {
display : block;
margin-left: 3%;
}
.left-trough,
.below-avg-trough,
.above-avg-trough {
border : 0px black solid;
margin : 0px;
padding: 0px;
height : 20px;
}
.below-avg-trough {
border-right: 1px slategrey solid;
border-left : 1px black solid;
background : darkslategrey;
}
.above-avg-trough {
border-left : 1px slategrey solid;
border-right: 1px black solid;
background : darkslategrey;
}
</style>
<body>
<h1>JavaScript Profile Data</h1>
<span class="label">Collection Date:</span>
<span class="value">$full-date</span><br>
<span class="label">User Agent:</span>
<span class="value">$user-agent</span><br>
<span class="label">JavaScript Debugger Version:</span>
<span class="value">$venkman-agent</span><br>
<a name="section0"></a>
<!--@section-start-->
<hr>
<span class="section-box">
<a name="section$section-number"></a>
<h2 class="section-title">$section-link</h2>
<a name="range$section-number:0"></a>
<!--@range-start-->
<span class="range-box">
<a name="range$section-number:$range-number"></a>
<h3>$range-min - $range-max ms</h3>
[ <a href="#section$section-number-prev">Previous File</a> |
<a href="#section$section-number-next">Next File</a> |
<a href="#range$section-number:$range-number-prev">Previous Range</a> |
<a href="#range$section-number:$range-number-next">Next Range</a> ]
<!--@item-start-->
<span class="graph-box">
<span class="graph-title">
<a name="item$section-number:$range-number-next:$item-number"></a>
<a href="#item$section-number:$range-number-next:$item-number">$item-number</a>
<a class="graph-filename" href="$item-name">$item-name</a><br>
<span class="graph-summary">$item-summary</span>
</span>
<span class="graph-body">
<img class="left-trough"
src="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw"
width="$item-min-pct%"><img class="below-avg-trough"
src="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw"
width="$item-below-pct%"><img class="above-avg-trough"
src="data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAAw"
width="$item-above-pct%">
</span>
</span>
<!--@item-end-->
</span>
<!--@range-end-->
<br>
</span>
<!--@section-end-->
<hr>
<a href="http://www.mozilla.org/projects/venkman/">No job is too big, no fee is too big.</a>
</body>
</html>

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

@ -51,7 +51,9 @@ function initCommands(commandObject)
["chrome-filter", cmdChromeFilter, CMD_CONSOLE],
["clear", cmdClear, CMD_CONSOLE],
["clear-all", cmdClearAll, CMD_CONSOLE],
["clear-profile", cmdClearProfile, CMD_CONSOLE],
["clear-script", cmdClearScript, 0],
["close", cmdClose, CMD_CONSOLE],
["commands", cmdCommands, CMD_CONSOLE],
["cont", cmdCont, CMD_CONSOLE | CMD_NEED_STACK],
["emode", cmdEMode, CMD_CONSOLE],
@ -61,6 +63,7 @@ function initCommands(commandObject)
["find-bp", cmdFindBp, 0],
["find-creator", cmdFindCreatorOrCtor, 0],
["find-ctor", cmdFindCreatorOrCtor, 0],
["find-file", cmdFindFile, CMD_CONSOLE],
["find-frame", cmdFindFrame, CMD_NEED_STACK],
["find-url", cmdFindURL, CMD_CONSOLE],
["find-url-soft", cmdFindURL, 0],
@ -72,12 +75,16 @@ function initCommands(commandObject)
["loadd", cmdLoadd, CMD_CONSOLE],
["next", cmdNext, CMD_CONSOLE | CMD_NEED_STACK],
["open-dialog", cmdOpenDialog, CMD_CONSOLE],
["open-url", cmdOpenURL, 0],
["pprint", cmdPPrint, CMD_CONSOLE],
["pref", cmdPref, CMD_CONSOLE],
["profile", cmdProfile, CMD_CONSOLE],
["props", cmdProps, CMD_CONSOLE | CMD_NEED_STACK],
["propsd", cmdPropsd, CMD_CONSOLE],
["quit", cmdQuit, CMD_CONSOLE],
["reload", cmdReload, CMD_CONSOLE],
["save-source", cmdSaveSource, CMD_CONSOLE],
["save-profile", cmdSaveProfile, CMD_CONSOLE],
["scope", cmdScope, CMD_CONSOLE | CMD_NEED_STACK],
["startup-init", cmdStartupInit, CMD_CONSOLE],
["step", cmdStep, CMD_CONSOLE | CMD_NEED_STACK],
@ -87,17 +94,19 @@ function initCommands(commandObject)
["where", cmdWhere, CMD_CONSOLE | CMD_NEED_STACK],
/* aliases */
["this", "props this", CMD_CONSOLE],
["toggle-chrome", "chrome-filter toggle", 0],
["toggle-ias", "startup-init toggle", 0],
["em-cycle", "emode cycle", 0],
["em-ignore", "emode ignore", 0],
["em-trace", "emode trace", 0],
["em-break", "emode break", 0],
["tm-cycle", "tmode cycle", 0],
["tm-ignore", "tmode ignore", 0],
["tm-trace", "tmode trace", 0],
["tm-break", "tmode break", 0]
["profile-tb", "profile toggle", CMD_CONSOLE],
["this", "props this", CMD_CONSOLE],
["toggle-chrome", "chrome-filter toggle", 0],
["toggle-ias", "startup-init toggle", 0],
["toggle-profile", "profile toggle", 0],
["em-cycle", "emode cycle", 0],
["em-ignore", "emode ignore", 0],
["em-trace", "emode trace", 0],
["em-break", "emode break", 0],
["tm-cycle", "tmode cycle", 0],
["tm-ignore", "tmode ignore", 0],
["tm-trace", "tmode trace", 0],
["tm-break", "tmode break", 0]
];
defineVenkmanCommands (cmdary);
@ -105,7 +114,8 @@ function initCommands(commandObject)
console.commandManager.argTypes.__aliasTypes__ (["index", "breakpointIndex",
"lineNumber"], "int");
console.commandManager.argTypes.__aliasTypes__ (["scriptText", "windowFlags",
"expression"], "rest");
"expression", "prefValue"],
"rest");
}
/**
@ -175,8 +185,10 @@ function getCommandContext (id, cx)
default:
dd ("getCommandContext: unknown id '" + id + "'");
case "mainmenu:debug-popup":
case "mainmenu:file-popup":
case "mainmenu:view-popup":
case "mainmenu:debug-popup":
case "mainmenu:profile-popup":
case "popup:console":
cx = {
commandManager: console.commandManager,
@ -190,7 +202,7 @@ function getCommandContext (id, cx)
cx.commandManager = console.commandManager;
if (!("contextSource" in cx))
cx.contextSource = id;
if (console.dbgContexts)
if ("dbgContexts" in console && console.dbgContexts)
dd ("context '" + id + "'\n" + dumpObjectTree(cx));
}
@ -355,6 +367,25 @@ function cmdClearAll(e)
clearBreakpointByNumber (i);
}
function cmdClearProfile(e)
{
if ("scriptRecList" in e)
{
for (var i = 0; i < e.scriptRecList.length; ++i)
e.scriptRecList[i].script.clearProfileData();
}
else if ("scriptRec" in e)
{
e.scriptRec.script.clearProfileData();
}
else
{
console.jsds.clearProfileData();
}
feedback (e, MSG_PROFILE_CLEARED);
}
function cmdClearScript (e)
{
var i;
@ -371,15 +402,17 @@ function cmdClearScript (e)
{
var bpr = console.breakpoints.childData[i];
if (bpr.hasScriptRecord(e.scriptRec))
{
dd ("found one");
clearBreakpointByNumber (i);
}
}
return true;
}
function cmdClose()
{
window.close();
}
function cmdCommands (e)
{
display (MSG_TIP_HELP);
@ -528,11 +561,10 @@ function cmdFinish (e)
}
function cmdFindBp (e)
{
cmdFindURL ({url: e.breakpointRec.fileName,
rangeStart: e.breakpointRec.line,
rangeEnd: e.breakpointRec.line});
return true;
{
return dispatch ("find-url", {url: e.breakpointRec.fileName,
rangeStart: e.breakpointRec.line,
rangeEnd: e.breakpointRec.line});
}
function cmdFindCreatorOrCtor (e)
@ -558,7 +590,8 @@ function cmdFindCreatorOrCtor (e)
line = objVal.constructorLine;
}
return cmdFindURL ({url: url, rangeStart: line - 1, rangeEnd: line - 1});
return dispatch ("find-url",
{url: url, rangeStart: line - 1, rangeEnd: line - 1});
}
function cmdFindURL (e)
@ -566,11 +599,23 @@ function cmdFindURL (e)
if (!e.url)
{
console.sourceView.displaySourceText(null);
return true;
return null;
}
var sourceText;
if (e.url.indexOf("x-jsd:") == 0)
{
if (e.url == "x-jsd:help")
{
dispatch ("help");
return e.url;
}
display (getMsg(MSN_ERR_INVALID_PARAM, ["url", e.url]), MT_ERROR);
return null;
}
if (e.url in console.scripts)
sourceText = console.scripts[e.url].sourceText;
else if (e.url in console.files)
@ -602,7 +647,20 @@ function cmdFindURL (e)
console.sourceView.softScrollTo (line);
else
console.sourceView.scrollTo (line - 2, -1);
return true;
return e.url;
}
function cmdFindFile (e)
{
if (!e.fileName || e.fileName == "?")
{
var rv = pickOpen(MSG_OPEN_FILE, "$all");
if (rv.reason == PICK_CANCEL)
return null;
e.fileName = rv.file;
}
return dispatch ("find-url", {url: getURLSpecFromFile (e.fileName)});
}
function cmdFindFrame (e)
@ -633,25 +691,27 @@ function cmdFindFrame (e)
function cmdFindScript (e)
{
var rv;
if (console.sourceView.prettyPrint)
{
delete console.highlightFile;
delete console.highlightStart;
delete console.highlightEnd;
console.sourceView.displaySourceText(e.scriptRec.sourceText);
rv = e.scriptRec.script.fileName;
}
else
{
cmdFindURL({url: e.scriptRec.parentRecord.fileName,
rangeStart: e.scriptRec.baseLineNumber,
rangeEnd: e.scriptRec.baseLineNumber +
e.scriptRec.lineExtent - 1
});
rv = dispatch("find-url", {url: e.scriptRec.parentRecord.fileName,
rangeStart: e.scriptRec.baseLineNumber,
rangeEnd: e.scriptRec.baseLineNumber +
e.scriptRec.lineExtent - 1});
}
console.sourceView.details = e.scriptRec;
return true;
return rv;
}
function cmdFocusInput (e)
@ -746,11 +806,18 @@ function cmdOpenDialog (e)
return openDialog (e.url, e.windowName, e.windowFlags);
}
function cmdOpenURL (e)
{
var url = prompt (MSG_OPEN_URL);
if (url)
return dispatch ("find-url",{url: url});
return null;
}
function cmdPPrint (e)
{
console.sourceView.prettyPrint = !console.sourceView.prettyPrint;
if (console.sourceView.details)
cmdFindScript({scriptRec: console.sourceView.details});
setPrettyPrintState(!console.sourceView.prettyPrint);
return true;
}
@ -758,6 +825,12 @@ function cmdPref (e)
{
if (e.prefName)
{
if (e.prefName[0] == "-")
{
console.prefs.prefBranch.clearUserPref(e.prefName.substr(1));
return true;
}
if (!(e.prefName in console.prefs))
{
display (getMsg(MSN_ERR_INVALID_PARAM, ["prefName", e.prefName]),
@ -783,7 +856,21 @@ function cmdPref (e)
return true;
}
function cmdProfile(e)
{
if (e.toggle && e.toggle == "toggle")
e.toggle = !(console.jsds.flags & COLLECT_PROFILE_DATA);
if (e.toggle != null)
setProfileState(e.toggle);
else
e.toggle = console.jsds.flags & COLLECT_PROFILE_DATA;
feedback (e, getMsg(MSN_PROFILE_STATE,
[e.toggle ? MSG_VAL_ON : MSG_VAL_OFF]));
}
function cmdProps (e, forceDebuggerScope)
{
var v;
@ -812,10 +899,9 @@ function cmdPropsd (e)
return cmdProps (e, true);
}
function cmdQuit ()
function cmdQuit()
{
window.close();
return true;
goQuitApplication();
}
function cmdReload ()
@ -827,6 +913,125 @@ function cmdReload ()
return true;
}
function cmdSaveSource (e)
{
if (!e.targetFile || e.targetFile == "?")
{
var fileName = console.sourceView.childData.fileName;
if (fileName.search(/^\w+:/) < 0)
{
var shortName = getFileFromPath(fileName);
if (fileName != shortName)
fileName = shortName;
else
fileName = "";
}
else
fileName = "";
var rv = pickSaveAs(MSG_SAVE_SOURCE, "$all $text *.js", fileName);
if (rv.reason == PICK_CANCEL)
return null;
e.targetFile = rv.file;
}
var file = fopen (e.targetFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE);
var lines = console.sourceView.childData.lines;
for (var i = 0; i < lines.length; ++i)
file.write(lines[i] + "\n");
file.close();
return file.localFile.path;
}
function cmdSaveProfile (e)
{
function writeHeaderCSV(file)
{
file.write ("# path, file, function, start-line, end-line, " +
"call-count, recurse-depth, total-time, min-time, " +
"max-time, avg-time\n");
};
function writeSummaryCSV(file, summary)
{
for (var i = 0; i < summary.length; ++i)
{
var r = summary[i];
file.write (r.path + ", " + r.file + ", " + r.fun + ", " + r.base +
", " + r.end + ", " + r.ccount + ", " + r.recurse +
", " + r.total + ", " + r.min + ", " + r.max +
", " + r.avg +"\n");
}
};
function writeSummaryText(file, summary, fileName)
{
file.write ((fileName ? fileName : "** all files **") + "\n");
for (var i = 0; i < summary.length; ++i)
file.write ("\t" + summary[i].str + "\n");
};
if (!e.targetFile || e.targetFile == "?")
{
var rv = pickSaveAs(MSG_SAVE_PROFILE, "$html *.csv $text $all");
if (rv.reason == PICK_CANCEL)
return null;
e.targetFile = rv.file;
}
var file = fopen (e.targetFile, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE);
var ary = file.localFile.path.match(/(csv|html?)$/i);
var writeHeader = null;
var writeSummary = writeSummaryText;
var writeFooter = null;
if (ary)
{
var ext = ary[1].toLowerCase();
if (ext == "csv")
{
writeHeader = writeHeaderCSV;
writeSummary = writeSummaryCSV;
}
else
{
writeHeader = writeHeaderHTML;
writeSummary = writeSummaryHTML;
writeFooter = writeFooterHTML;
}
}
if (writeHeader)
writeHeader(file);
var i;
if ("urlList" in e && e.urlList.length > 0 ||
"url" in e && e.url && (e.urlList = [e.url]))
{
for (i = 0; i < e.urlList.length; ++i)
writeSummary(file, console.getProfileSummary(e.urlList[i]),
e.urlList[i]);
}
else
{
var scriptURLs = keys(console.scripts).sort();
for (i = 0; i < scriptURLs.length; ++i)
{
var fileName = console.scripts[scriptURLs[i]].fileName;
writeSummary(file, console.getProfileSummary(fileName), fileName);
}
}
if (writeFooter)
writeFooter(file);
display (getMsg(MSN_PROFILE_SAVED, getURLSpecFromFile(file.localFile)));
file.close();
return file.localFile;
}
function cmdScope ()
{
if (getCurrentFrame().scope.propertyCount == 0)

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

@ -44,6 +44,8 @@ const jsdIScript = Components.interfaces.jsdIScript;
const jsdIStackFrame = Components.interfaces.jsdIStackFrame;
const jsdIFilter = Components.interfaces.jsdIFilter;
const COLLECT_PROFILE_DATA = jsdIDebuggerService.COLLECT_PROFILE_DATA;
const PCMAP_SOURCETEXT = jsdIScript.PCMAP_SOURCETEXT;
const PCMAP_PRETTYPRINT = jsdIScript.PCMAP_PRETTYPRINT;
@ -308,10 +310,10 @@ function realizeScript(script)
container.reserveChildren();
if (!isURLFiltered(script.fileName))
console.scriptsView.childData.appendChild(container);
}
}
var scriptRec = new ScriptRecord (script);
if ("dbgRealize" in console)
if ("dbgRealize" in console && console.dbgRealize)
{
dd ("new scriptrecord: " + formatScript(script) + "\n" +
script.functionSource);
@ -350,7 +352,7 @@ function unrealizeScript(script)
return;
}
if ("dbgRealize" in console)
if ("dbgRealize" in console && console.dbgRealize)
dd ("remove scriptrecord: " + formatScript(script));
var scriptRec = container.locateChildByScript (script);

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

@ -38,6 +38,7 @@ function initDev()
var cmdary =
[["dumpcontexts", cmdDumpContexts, CMD_CONSOLE | CMD_NO_HELP],
["dumpfilters", cmdDumpFilters, CMD_CONSOLE | CMD_NO_HELP],
["dumpprofile", cmdDumpProfile, CMD_CONSOLE | CMD_NO_HELP],
["dumptree", cmdDumpTree, CMD_CONSOLE | CMD_NO_HELP],
["dumpscripts", cmdDumpScripts, CMD_CONSOLE | CMD_NO_HELP],
["reloadui", cmdReloadUI, CMD_CONSOLE | CMD_NO_HELP],
@ -52,9 +53,15 @@ function initDev()
defineVenkmanCommands (cmdary);
console.addPref ("dbgContexts", false);
console.addPref ("dbgDispatch", false);
console.addPref ("dbgRealize", false);
if (!("devState" in console.pluginState))
{
console.addPref ("dbgContexts", false);
console.addPref ("dbgDispatch", false);
console.addPref ("dbgRealize", false);
}
console.pluginState.devState = true;
dispatch ("sync-debug");
return "Venkman development functions loaded OK.";
@ -114,6 +121,13 @@ function cmdDumpFilters()
console.jsds.enumerateFilters (enumer);
}
function cmdDumpProfile(e)
{
var list = console.getProfileSummary();
for (var i = 0; i < list.length; ++i)
dd(list[i].str);
}
function cmdDumpTree(e)
{
if (!e.depth)
@ -150,17 +164,17 @@ function cmdReloadUI()
function cmdSyncDebug()
{
if (console.prefs["dbgContexts"])
if (eval(console.prefs["dbgContexts"]))
console.dbgContexts = true;
else
delete console.dbgContexts;
if (console.prefs["dbgDispatch"])
if (eval(console.prefs["dbgDispatch"]))
console.dbgDispatch = true;
else
delete console.dbgDispatch;
if (console.prefs["dbgRealize"])
if (eval(console.prefs["dbgRealize"]))
console.dbgRealize = true;
else
delete console.dbgRealize;

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

@ -46,7 +46,7 @@ function con_eval(__s)
{
dd ("doEval caught: " + __ex);
if (__ex && __ex.fileName &&
if (__ex && typeof ex == "object" && "fileName" in __ex &&
__ex.fileName.search (/venkman-eval.js$/) != -1)
{
__ex.fileName = MSG_VAL_CONSOLE;

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

@ -46,20 +46,36 @@ function initHandlers()
console.wwObserver = {observe: wwObserve};
console.windowWatcher.registerNotification (console.wwObserver);
console.windows.hookedWindows = new Array();
var enumerator = console.windowWatcher.getWindowEnumerator();
while (enumerator.hasMoreElements())
{
var win = enumerator.getNext();
if (win.location.href != "chrome://venkman/content/venkman.xul")
{
console.onWindowOpen(win);
console.onWindowLoad();
}
}
}
function destroyHandlers()
{
const WW_CTRID = "@mozilla.org/embedcomp/window-watcher;1";
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
var ww = Components.classes[WW_CTRID].getService(nsIWindowWatcher);
ww.unregisterNotification (console.wwObserver);
console.windowWatcher.unregisterNotification (console.wwObserver);
while (console.windows.hookedWindows.length)
{
var win = console.windows.hookedWindows.pop();
win.removeEventListener ("load", console.onWindowLoad, false);
win.removeEventListener ("unload", console.onWindowUnload, false);
}
}
console.onWindowOpen =
function con_winopen (win)
{
if (win.location.href == "about:blank" || win.location.href == "")
if ("ChromeWindow" in win && win instanceof win.ChromeWindow &&
(win.location.href == "about:blank" || win.location.href == ""))
{
//dd ("not loaded yet?");
setTimeout (con_winopen, 100, win);
@ -67,7 +83,8 @@ function con_winopen (win)
}
//dd ("window opened: " + win); // + ", " + getInterfaces(win));
console.windows.appendChild (new WindowRecord(win));
console.windows.appendChild (new WindowRecord(win, ""));
console.windows.hookedWindows.push(win);
win.addEventListener ("load", console.onWindowLoad, false);
win.addEventListener ("unload", console.onWindowUnload, false);
console.scriptsView.freeze();
@ -89,10 +106,16 @@ console.onWindowClose =
function con_winunload (win)
{
//dd ("window closed: " + win);
var winRecord = console.windows.locateChildByWindow(win);
if (!ASSERT(winRecord, "onWindowClose: Can't find window record."))
return;
console.windows.removeChildAtIndex(winRecord.childIndex);
if (win.location.href != "chrome://venkman/content/venkman.xul")
{
var winRecord = console.windows.locateChildByWindow(win);
if (!ASSERT(winRecord, "onWindowClose: Can't find window record."))
return;
console.windows.removeChildAtIndex(winRecord.childIndex);
var idx = arrayIndexOf(console.windows.hookedWindows, win);
if (idx != -1)
arrayRemoveAt(console.windows.hookedWindows, idx);
}
console.scriptsView.freeze();
}

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

@ -65,7 +65,21 @@ function initMenus()
t("maintoolbar", "next");
t("maintoolbar", "step");
t("maintoolbar", "finish");
t("maintoolbar", "-");
t("maintoolbar", "profile-tb");
t("maintoolbar", "pprint");
M("mainmenu", "file");
m("open-url");
m("find-file");
m("-");
m("close");
m("save-source");
m("save-profile");
m("-");
m("quit");
/* View menu */
M("mainmenu", "view");
m("reload");
@ -77,7 +91,8 @@ function initMenus()
/* Debug menu */
M("mainmenu", "debug");
m("stop");
m("stop", {type: "checkbox",
checkedif: "console.jsds.interruptHook"});
m("cont");
m("next");
m("step");
@ -97,12 +112,21 @@ function initMenus()
m("tm-break", {type: "radio", name: "tm",
checkedif: "console.throwMode == TMODE_BREAK"});
m("-");
m("toggle-ias", {type: "checkbox",
checkedif: "console.jsds.initAtStartup"});
m("toggle-ias",
{type: "checkbox",
checkedif: "console.jsds.initAtStartup"});
M("mainmenu", "profile");
m("toggle-profile", {type: "checkbox",
checkedif:
"console.jsds.flags & COLLECT_PROFILE_DATA"});
m("clear-profile");
m("save-profile");
/* Context menu for console view */
C("output-iframe", "console");
m("stop");
m("stop", {type: "checkbox",
checkedif: "console.jsds.interruptHook"});
m("cont");
m("next");
m("step");
@ -130,11 +154,13 @@ function initMenus()
"cx.target instanceof BPRecord || " +
"(has('breakpointLabel') && cx.target.childData.length)"});
m("clear");
//m("-");
//m("bp-props");
m("-");
m("save-profile", {enabledif: "has('url')"});
/* Context menu for source view */
C("source-outliner", "source");
m("save-source");
m("-");
m("break", {enabledif: "cx.lineIsExecutable && !has('breakpointRec')"});
m("fbreak", {enabledif: "!cx.lineIsExecutable && !has('breakpointRec')"});
m("clear");
@ -149,13 +175,13 @@ function initMenus()
/* Context menu for script view */
C("script-list-outliner", "script");
m("find-url", {enabledif:
"cx.target instanceof ScriptContainerRecord"});
m("find-script", {enabledif:
"cx.target instanceof ScriptRecord"});
m("clear-script", {enabledif:
"cx.target.bpcount"});
m("find-url");
m("find-script");
m("clear-script", {enabledif: "cx.target.bpcount"});
m("-");
m("save-profile");
m("clear-profile");
/* Context menu for stack view */
C("stack-outliner", "stack");
m("frame", {enabledif: "cx.target instanceof FrameRecord"});

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

@ -50,9 +50,6 @@
<!-- Commands -->
<commandset id="venkmanCommands">
<!-- File commands -->
<command id="cmd_close" oncommand="window.close();"/>
<command id="cmd_quit"/>
<!-- Edit commands -->
<commandset id="selectEditMenuItems"/>
@ -77,9 +74,6 @@
<key id="key:reloadui" modifiers="accel alt" key="R"
oncommand="if (typeof cmdReloadUI =='function') cmdReloadUI(); else window.location.href = window.location.href;"/>
<!-- File keys -->
<key id="key_close"/>
<!-- Edit keys -->
<key id="key_undo"/>
<key id="key_redo"/>
@ -98,12 +92,8 @@
<menubar id="mainmenu" persist="collapsed"
grippytooltiptext="&MenuBar.tooltip;">
<!-- File menu -->
<menu id="menu_File">
<menupopup id="menu_FilePopup">
<menuitem id="menu_close"/>
</menupopup>
</menu>
<!-- File menu placeholder, see venkman-menus.js -->
<menu id="mainmenu:file"/>
<!-- Edit menu -->
<menu id="menu_Edit">
@ -129,6 +119,9 @@
<!-- Debug menu placeholder, see venkman-menus.js -->
<menu id="mainmenu:debug"/>
<!-- Profile menu placeholder, see venkman-menus.js -->
<menu id="mainmenu:profile"/>
<!-- Tasks menu -->
<menu id="tasksMenu"/>
</menubar>

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

@ -179,7 +179,12 @@ const MSG_NOTE_NEEDSTACK = getMsg("msg.note.needstack");
const MSG_NOTE_NOSTACK = getMsg("msg.note.nostack");
const MSG_DOC_NOTES = getMsg("msg.doc.notes");
const MSG_DOC_DESCRIPTION = getMsg("msg.doc.description");
const MSG_HELP_TITLE = getMsg("msg.help.title");
const MSG_PROFILE_CLEARED = getMsg("msg.profile.cleared");
const MSG_OPEN_FILE = getMsg("msg.open.file");
const MSG_OPEN_URL = getMsg("msg.open.url");
const MSG_SAVE_PROFILE = getMsg("msg.save.profile");
const MSG_SAVE_SOURCE = getMsg("msg.save.source");
/* message names for parameterized messages */
const MSN_ERR_INTERNAL_DISPATCH = "msg.err.internal.dispatch";
@ -241,6 +246,9 @@ const MSN_SOURCE_LINE = "msg.source.line";
const MSN_EXCP_TRACE = "msg.exception.trace";
const MSN_ERPT_ERROR = "msg.erpt.error";
const MSN_ERPT_WARN = "msg.erpt.warn";
const MSN_PROFILE_LOST = "msg.profile.lost";
const MSN_PROFILE_STATE = "msg.profile.state";
const MSN_PROFILE_SAVED = "msg.profile.saved";
const MSN_VERSION = "msg.version";
const MSN_DEFAULT_ALIAS_HELP = "msg.default.alias.help";

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -51,6 +51,11 @@ function initPrefs()
// console.addPref ("input.commandchar", "/");
console.addPref ("enableChromeFilter", false);
console.addPref ("profile.template.html",
"chrome://venkman/content/profile.html.tpl");
console.addPref ("profile.ranges",
"1000000, 5000, 2500, 1000, 750, 500, 250, 100, 75, 50, " +
"25, 10, 7.5, 5, 2.5, 1, 0.75, 0.5, 0.25");
console.addPref ("sourcetext.tab.width", 4);
console.addPref ("input.history.max", 20);
console.addPref ("input.dtab.time", 500);
@ -97,8 +102,8 @@ function con_addpref (prefName, defaultValue)
}
catch (ex)
{
dd ("caught exception reading pref ``" + prefName + "'' " +
type + "\n" + ex);
//dd ("caught exception reading pref ``" + prefName + "'' " +
// type + "\n" + ex);
realValue = defaultValue;
}
}

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

@ -58,6 +58,7 @@
<script src="chrome://global/content/strres.js"/>
<script src="chrome://venkman/content/outliner-utils.js"/>
<script src="chrome://venkman/content/file-utils.js"/>
<script src="chrome://venkman/content/html-consts.js"/>
<script src="chrome://venkman/content/command-manager.js"/>

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

@ -63,7 +63,7 @@ const MAX_WORD_LEN = 20; /* number of characters to display before forcing a
var console = new Object();
console.version = "0.6.1";
console.version = "0.8.5";
/* |this|less functions */
@ -82,6 +82,40 @@ function setStopState(state)
}
}
function setProfileState(state)
{
var tb = document.getElementById("maintoolbar-profile-tb");
if (state)
{
console.jsds.flags |= COLLECT_PROFILE_DATA;
tb.setAttribute("profile", "true");
}
else
{
console.jsds.flags &= ~COLLECT_PROFILE_DATA;
tb.removeAttribute("profile");
}
}
function setPrettyPrintState(state)
{
var tb = document.getElementById("maintoolbar-pprint");
if (state)
{
console.sourceView.prettyPrint = true;
tb.setAttribute("state", "true");
}
else
{
console.sourceView.prettyPrint = false;
tb.removeAttribute("state");
}
if (console.sourceView.details)
dispatch("find-script", {scriptRec: console.sourceView.details});
}
function enableReloadCommand()
{
console.commandManager.commands["reload"].enabled = true;
@ -217,7 +251,7 @@ function dispatchCommand (command, e, flags)
}
else
{
if ("dbgDispatch" in console)
if ("dbgDispatch" in console && console.dbgDispatch)
{
dd ("dispatching command ``" + e.command.name+ "''\n" +
dumpObjectTree(e));
@ -409,6 +443,18 @@ function htmlVA (attribs, href, contents)
function init()
{
var ary = navigator.userAgent.match (/;\s*([^;\s]+\s*)\).*\/(\d+)/);
if (ary)
{
console.userAgent = "Venkman " + console.version + " [Mozilla " +
ary[1] + "/" + ary[2] + "]";
}
else
{
console.userAgent = "Venkman " + console.version + " [" +
navigator.userAgent + "]";
}
const WW_CTRID = "@mozilla.org/embedcomp/window-watcher;1";
const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher;
console.windowWatcher =
@ -450,7 +496,7 @@ function init()
console.ui["status-text"] = document.getElementById ("status-text");
console.ui["sl-input"] = document.getElementById ("input-single-line");
console._statusStack = new Array();
console.pluginState = new Object();
dispatch("version");
var ary = console.prefs["initialScripts"].split();
@ -633,6 +679,251 @@ function con_getppline ()
return this._pp_stopLine;
}
console.getProfileSummary =
function con_getProfileSummary (fileName, key)
{
if (typeof key == "undefined")
key = "max";
function compare (a, b)
{
if (a.key > b.key)
return 1;
if (a.key < b.key)
return -1;
return 0;
};
function addScriptRec(s)
{
var ex;
try
{
var ccount = s.script.callCount;
var tot_ms = roundTo(s.script.totalExecutionTime, 2);
var min_ms = roundTo(s.script.minExecutionTime, 2);
var max_ms = roundTo(s.script.maxExecutionTime, 2);
var avg_ms = roundTo(s.script.totalExecutionTime / ccount, 2);
var recurse = s.script.maxRecurseDepth;
var obj = new Object();
obj.total = tot_ms;
obj.ccount = ccount;
obj.avg = avg_ms;
obj.min = min_ms;
obj.max = max_ms;
obj.recurse = recurse;
obj.path = s.script.fileName;
obj.file = getFileFromPath(obj.path);
obj.base = s.script.baseLineNumber;
obj.end = obj.base + s.script.lineExtent;
obj.fun = s.functionName;
obj.str = obj.fun + ":" + obj.base + "-" + obj.end +
", calls " + ccount +
(obj.recurse ? " (depth " + recurse +")" : "") +
", total " + tot_ms +
"ms, min " + min_ms +
"ms, max " + max_ms +
"ms, avg " + avg_ms + "ms.";
obj.key = obj[key];
list.push (obj);
}
catch (ex)
{
/* This function is called under duress, and the script representd
* by |s| may get collected at any point. When that happens,
* attempting to access to the profile data will throw this
* exception.
*/
if (ex == Components.results.NS_ERROR_NOT_AVAILABLE)
{
display (getMsg(MSG_PROFILE_LOST, formatScript(s)), MT_WARN);
}
else
{
throw ex;
}
}
};
function addScriptContainer (container)
{
for (var i = 0; i < container.childData.length; ++i)
{
if (container.childData[i].script.callCount)
addScriptRec(container.childData[i]);
}
};
var list = new Array();
list.key = key;
if (!fileName)
{
for (var c in console.scripts)
addScriptContainer (console.scripts[c]);
} else {
if (!(fileName in console.scripts))
return null;
addScriptContainer (console.scripts[fileName]);
}
list.sort(compare);
return list;
}
function loadTemplate(url)
{
var lines = loadURLNow(url);
if (!lines)
return null;
var obj = new Object();
var i;
var sections =
{"fileHeader" : /^<!--@section-start-->/m,
"sectionHeader" : /^<!--@range-start-->/m,
"rangeHeader" : /^<!--@item-start-->/m,
"itemBody" : /^<!--@item-end-->/m,
"rangeFooter" : /^<!--@range-end-->/m,
"sectionFooter" : /^<!--@section-end-->/m,
"fileFooter" : 0
};
for (var s in sections)
{
if (sections[s])
{
i = lines.search(sections[s]);
if (i == -1)
throw "Cant match " + String(sections[s]);
obj[s] = lines.substr(0, i - 1);
i = lines.indexOf("\n", i);
lines = lines.substr(i);
}
else
{
obj[s] = lines;
lines = "";
}
}
return obj;
}
function writeHeaderHTML(file, tpl)
{
file.tpl = loadTemplate(console.prefs["profile.template.html"]);
file.fileData = {
"\\$full-date" : String(Date()),
"\\$user-agent" : navigator.userAgent,
"\\$venkman-agent": console.userAgent
};
file.write(replaceStrings(file.tpl.fileHeader, file.fileData));
};
function writeSummaryHTML(file, summary, fileName)
{
function scale(x) { return roundTo(K * x, 2); };
function writeSummaryEntry()
{
var entryData = {
"\\$item-number-next": summary.length - i + 1,
"\\$item-number-prev": summary.length - i - 1,
"\\$item-number" : summary.length - i,
"\\$item-name" : r.path,
"\\$item-summary" : r.str,
"\\$item-min-pct" : scale(r.min),
"\\$item-below-pct" : scale(r.avg - r.min),
"\\$item-above-pct" : scale(r.max - r.avg),
"\\$time-max" : r.max,
"\\$time-min" : r.min,
"\\$time-avg" : r.avg,
"\\$time-tot" : r.total,
"\\$call-count" : r.ccount,
"\\$funcion-name" : r.fun,
"\\$file-name" : r.file,
"\\$full-url" : r.path,
"\\$line-start" : r.base,
"\\$line-end" : r.end,
"__proto__": rangeData
};
file.write(replaceStrings(file.tpl.itemBody, entryData));
};
if (!summary || summary.length < 1)
return;
if ("sumNo" in file)
++file.sumNo;
else
file.sumNo = 1;
var headerData = {
"\\$section-number-prev": file.sumNo - 1,
"\\$section-number-next": file.sumNo + 1,
"\\$section-number" : file.sumNo,
"\\$section-link" : fileName ? "<a class='section-link' href='" +
fileName + "'>" + fileName + "</a>" :
"** All Files **",
"__proto__" : file.fileData
};
file.write(replaceStrings(file.tpl.sectionHeader, headerData));
const MAX_WIDTH = 90;
var ranges = console.prefs["profile.ranges"].split(",");
if (!ranges.length)
throw "Bad value for pref profile.ranges";
for (i = 0; i < ranges.length; ++i)
ranges[i] = Number(ranges[i]);
ranges.push(0); // push two 0's to the end of the list so the user doesn't
ranges.push(0); // have to.
var rangeIndex = 1;
var lastRangeIndex = 0;
var K = 1;
var rangeIter = 0;
for (var i = summary.length - 1; i >= 0; --i)
{
var r = summary[i];
while (r.key && r.key <= ranges[rangeIndex])
++rangeIndex;
if (lastRangeIndex != rangeIndex)
{
++rangeIter;
K = MAX_WIDTH / ranges[rangeIndex - 1];
var rangeData = {
"\\$range-min" : ranges[rangeIndex],
"\\$range-max" : ranges[rangeIndex - 1],
"\\$range-number-prev": rangeIter - 1,
"\\$range-number-next": rangeIter,
"\\$range-number" : rangeIter,
"__proto__" : headerData
};
if (rangeIndex > 0)
file.write(replaceStrings(file.tpl.rangeFooter, rangeData));
file.write(replaceStrings(file.tpl.rangeHeader, rangeData));
lastRangeIndex = rangeIndex;
}
writeSummaryEntry();
}
file.write(replaceStrings(file.tpl.rangeFooter, rangeData));
file.write(replaceStrings(file.tpl.sectionFooter, headerData));
}
function writeFooterHTML(file)
{
file.write(replaceStrings(file.tpl.fileFooter, file.fileData));
}
console.pushStatus =
function con_pushstatus (msg)
{
@ -911,7 +1202,7 @@ function st_invalidate ()
function HelpText ()
{
this.tabWidth = console.prefs["sourcetext.tab.width"];
this.fileName = MSG_HELP_TITLE;
this.fileName = "x-jsd:help";
this.reloadSource();
}

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

@ -151,14 +151,7 @@ function initOutliners()
FileContainerRecord.prototype.property = console.projectView.atomFiles;
FileRecord.prototype.property = console.projectView.atomFile;
BPRecord.prototype.property = console.projectView.atomBreakpoint;
BLRecord.prototype.property = console.projectView.atomBLItem;
var enumerator = console.windowWatcher.getWindowEnumerator();
while (enumerator.hasMoreElements())
{
var win = enumerator.getNext();
console.windows.appendChild (new WindowRecord(win));
}
BLRecord.prototype.property = console.projectView.atomBLItem;
}
function destroyOutliners()
@ -827,7 +820,6 @@ function scv_getcx(cx)
}
else if (rec instanceof ScriptRecord)
{
cx.url = cx.fileName = rec.script.fileName;
cx.scriptRec = rec;
cx.lineNumber = rec.script.baseLineNumber;
cx.rangeStart = cx.lineNumber;
@ -842,7 +834,7 @@ function scv_getcx(cx)
if (rangeCount > 0)
{
cx.fileNameList = new Array();
cx.urlList = cx.fileNameList = new Array();
if (firstRec instanceof ScriptRecord)
cx.scriptRecList = new Array();
cx.lineNumberList = new Array();
@ -867,7 +859,7 @@ function scv_getcx(cx)
}
else if (rec instanceof ScriptRecord)
{
cx.fileNameList.push (rec.script.fileName);
//cx.fileNameList.push (rec.script.fileName);
if (firstRec instanceof ScriptRecord)
cx.scriptRecList.push (rec);
cx.lineNumberList.push (rec.script.baseLineNumber);

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

@ -260,7 +260,7 @@ function wordCap (str)
*/
function Clone (obj)
{
robj = new Object();
var robj = new Object();
for (var p in obj)
robj[p] = obj[p];
@ -308,6 +308,29 @@ function getFileFromPath (path)
return path;
}
function getURLSpecFromFile (file)
{
if (!file)
return null;
const IOS_CTRID = "@mozilla.org/network/io-service;1";
const LOCALFILE_CTRID = "@mozilla.org/file/local;1";
const nsIIOService = Components.interfaces.nsIIOService;
const nsILocalFile = Components.interfaces.nsILocalFile;
if (typeof file == "string")
{
var fileObj =
Components.classes[LOCALFILE_CTRID].createInstance(nsILocalFile);
fileObj.initWithUnicodePath(file);
file = fileObj;
}
var service = Components.classes[IOS_CTRID].getService(nsIIOService);
return service.getURLSpecFromFile(file);
}
function getCommonPfx (list)
{
var pfx = list[0];
@ -373,6 +396,16 @@ function keys (o)
}
function replaceStrings (str, obj)
{
if (!str)
return str;
for (var p in obj)
str = str.replace(RegExp(p, "g"), obj[p]);
return str;
}
function stringTrim (s)
{
if (!s)
@ -459,6 +492,9 @@ function arrayContains (ary, elem)
function arrayIndexOf (ary, elem)
{
if (!ary)
return -1;
for (var i in ary)
if (ary[i] == elem)
return i;
@ -511,10 +547,7 @@ function leftPadString (str, num, ch)
function roundTo (num, prec)
{
return parseInt ( Math.round(num * Math.pow (10, prec))) /
Math.pow (10, prec);
return Math.round(num * Math.pow (10, prec)) / Math.pow (10, prec);
}
function randomRange (min, max)

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

@ -19,6 +19,7 @@ venkman.jar:
content/venkman/venkman-munger.js (content/venkman-munger.js)
content/venkman/venkman-outliners.js (content/venkman-outliners.js)
content/venkman/outliner-utils.js (content/outliner-utils.js)
content/venkman/file-utils.js (content/file-utils.js)
content/venkman/html-consts.js (content/html-consts.js)
content/venkman/command-manager.js (content/command-manager.js)
content/venkman/tests/testpage.html (content/tests/testpage.html)
@ -31,12 +32,23 @@ venkman.jar:
locale/en-US/venkman/venkman.properties (locale/en-US/venkman.properties)
locale/en-US/venkman/venkman-overlay.dtd (locale/en-US/venkman-overlay.dtd)
content/venkman/venkman-output-window.html (content/venkman-output-window.html)
content/venkman/profile.html.tpl (content/profile.html.tpl)
skin/modern/venkman/images/stop.png (skin/images/stop.png)
skin/modern/venkman/images/stop-checked.png (skin/images/stop-checked.png)
skin/modern/venkman/images/stop-checked-hov.png (skin/images/stop-checked-hov.png)
skin/modern/venkman/images/stop-hov.png (skin/images/stop-hov.png)
skin/modern/venkman/images/stop-act.png (skin/images/stop-act.png)
skin/modern/venkman/images/stop-dis.png (skin/images/stop-dis.png)
skin/modern/venkman/images/profile.png (skin/images/profile.png)
skin/modern/venkman/images/profile-act.png (skin/images/profile.png)
skin/modern/venkman/images/profile-checked.png (skin/images/profile-checked.png)
skin/modern/venkman/images/profile-hov.png (skin/images/profile-hov.png)
skin/modern/venkman/images/profile-checked-hov.png (skin/images/profile-checked-hov.png)
skin/modern/venkman/images/prettyprint.png (skin/images/prettyprint.png)
skin/modern/venkman/images/prettyprint-act.png (skin/images/prettyprint.png)
skin/modern/venkman/images/prettyprint-checked.png (skin/images/prettyprint-checked.png)
skin/modern/venkman/images/prettyprint-hov.png (skin/images/prettyprint-hov.png)
skin/modern/venkman/images/prettyprint-checked-hov.png (skin/images/prettyprint-checked-hov.png)
skin/modern/venkman/images/cont.png (skin/images/cont.png)
skin/modern/venkman/images/cont-hov.png (skin/images/cont-hov.png)
skin/modern/venkman/images/cont-act.png (skin/images/cont-act.png)

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

@ -174,6 +174,14 @@ msg.exception.trace = Exception %1$S thrown from %2$S.
# 1 message, 2 flags, 3 file, 4 line, 5 pos
msg.erpt.error = Error ``%1$S'' [%2$S] in file ``%3$S'', line %4$S, character %5$S.
msg.erpt.warn = Warning ``%1$S'' [%2$S] in file ``%3$S'', line %4$S, character %5$S.
msg.profile.lost = Lost profile data for script %1$S.
msg.profile.state = Profile data collection is now %1$S.
msg.profile.saved = Profile data saved to <%1$S>.
msg.profile.cleared = Profile data cleared.
msg.open.file = Open File...
msg.open.url = Enter a URL to Load...
msg.save.profile = Save Profile Data As...
msg.save.source = Save Source As...
## property value flags ##
vf.enumerable = e
@ -218,7 +226,9 @@ fmt.guessedname = [%1$S]
fmt.prefvalue = Preference ``%1$S'' is ``%2$S''
## menu headings ##
mnu.file = &File
mnu.debug = &Debug
mnu.profile = &Profile
mnu.view = &View
popup.project = Project View Context Menu
popup.source = Source View Context Menu
@ -227,7 +237,6 @@ popup.stack = Stack View Context Menu
popup.console = Console View Context Menu
msg.default.alias.help = This command is an alias for ``%1$S''.
msg.help.title = -- Help --
msg.no.help = Help not available.
msg.extra.params = Extra parameters ``%1$S'' ignored.
#msg.doc.consolehdr = Console Commands
@ -269,10 +278,17 @@ cmd.clear.help = Clears breakpoint at index <breakpoint-index>. See also: bre
cmd.clear-all.label = &Clear All Breakpoints
cmd.clear-all.help = Clears every breakpoint currently defined.
cmd.clear-profile.label = C&lear Profile Data
cmd.clear-profile.help = Zeros out any existing profile data.
cmd.clear-script.label = &Clear Script Breakpoints
cmd.clear-script.params = <script-rec> [<...>]
cmd.clear-script.help = Clear all breakpoints in <script-rec>.
cmd.close.label = &Close
cmd.close.key = accel W
cmd.close.help = Close the debugger.
cmd.commands.params = [<pattern>]
cmd.commands.help = Lists all command names matching <pattern>, or all command names if pattern is not specified.
@ -280,6 +296,9 @@ cmd.cont.label = &Continue
cmd.cont.key = VK_F5
cmd.cont.help = Continue execution of the debug target.
cmd.dumpprofile.label = Dump Profile Data
cmd.dumpprofile.params = [<file-name>]
cmd.dumptree.params = <tree> [<depth>]
cmd.emode.params = [<mode>]
@ -313,10 +332,19 @@ cmd.find-ctor.label = Find C&onstructor
cmd.find-ctor.params = <jsd-value>
cmd.find-ctor.help = Focus the constructor of the object referenced by the jsdIValue <jsd-value>.
cmd.find-file.label = &Open File...
cmd.find-file.key = accel O
cmd.find-file.params = [<file-name>]
cmd.find-file.help = Displays the contents of the file located at <file-name> in the script view, where <file-name> is an operating system specific path string. If <file-name> is not provided, or is the character '?', a file chooser widget will be displayed.
cmd.find-url-soft.label = &Soft Focus URL
cmd.find-url-soft.params = <url> <line-number>
cmd.find-url-soft.help = Displays the contents of the URL <url> in the source view. If <line-number> is not already in the center two thirds of the source view, the view is not scrolled, otherwise, the view is scrolled so that <line-number> is two lines from the top of the view.
cmd.open-url.help = Prompts the user for a url to load in the source view.
cmd.open-url.label = Open Web &Location...
cmd.open-url.key = accel shift L
cmd.find-url.label = Find &URL
cmd.find-url.params = <url> [<range-start> [<range-end>]]
cmd.find-url.help = Displays the contents of the URL <url> in the source view. If <range-start> is provided, the source will be scrolled to that line. If <range-end> is also provided, all of the text between <range-start> and <range-end> will be highlighted.
@ -361,18 +389,37 @@ cmd.pprint.help = Toggle Pretty Print mode.
cmd.pref.params = [<pref-name> [<pref-value>]]
cmd.pref.help = Sets the value of the preference named <pref-name> to the value of <pref-value>. If <pref-value> is not provided, the current value of <pref-name> will be displayed. If both <pref-name> and <pref-value> are omitted, all preferences will be displayed.
cmd.profile.params = [<toggle>]
cmd.profile.help = Enables or disables the collection of profile data. If <toggle> is not provided, the current state is displayed.
cmd.toggle-profile.label = &Collect Profile Data
cmd.profile-tb.label = Profile
cmd.props.params = <script-text>
cmd.props.help = Lists the properties of the value returned by <script-text>. The expression is evaluated in the scope of the debug target's current frame. See also: where, frame, eval, and propsd.
cmd.propsd.params = <script-text>
cmd.propsd.help = Lists the properties of the value returned by <script-text>. The expression is evaluated in the debugger's scope. See also: props.
cmd.quit.label = &Quit
cmd.quit.key = accel Q
cmd.quit.help = Quit Mozilla.
cmd.reload.label = &Reload Source
cmd.reload.key = accel R
cmd.reload.help = Reload the currently dsplayed source.
cmd.reloadui.key = accel alt R
cmd.save-source.label = &Save Source View As...
cmd.save-source.params = [<target-file>]
cmd.save-source.key = accel S
cmd.save-source.help = Saves the contents of the source view to a file on the local system. If <target-file> is not provided, or is the character '?', a file chooser widget will be displayed. <target-file> is an operating system specific path string.
cmd.save-profile.label = Save P&rofile Data As...
cmd.save-profile.params = [<target-file> [<url> [<...>]]
cmd.save-profile.help = Saves the profile data collected for one or more source files specified by <url> into the file at <target-file>. If <target-file> is not provided, or is the character '?', a file chooser widget will be displayed. If <url> is not provided, all profile data is saved. <target-file> is an operating system specific path string, <url> is a complete url.
cmd.scope.help = Lists the properties of the topmost object in the scope chain for the current frame.
cmd.startup-init.label = Initialize at &Startup
@ -405,5 +452,3 @@ cmd.tm-trace.label = T&race Exceptions
cmd.version.help = Display version information.
cmd.where.help = Displays a summarized list of stack frames in the current call chain.
cmd.quit.help = Close this window.

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Двоичные данные
extensions/venkman/resources/skin/images/prettyprint-checked.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.8 KiB

Двоичные данные
extensions/venkman/resources/skin/images/prettyprint-hov.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичные данные
extensions/venkman/resources/skin/images/prettyprint.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.4 KiB

Двоичные данные
extensions/venkman/resources/skin/images/profile-checked-hov.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 2.3 KiB

Двоичные данные
extensions/venkman/resources/skin/images/profile-checked.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.7 KiB

Двоичные данные
extensions/venkman/resources/skin/images/profile-hov.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.9 KiB

Двоичные данные
extensions/venkman/resources/skin/images/profile.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 1.2 KiB

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

@ -151,6 +151,47 @@ outliner {
list-style-image: url("chrome://venkman/skin/images/step-out-act.png");
}
#maintoolbar-profile-tb {
list-style-image: url("chrome://venkman/skin/images/profile.png");
}
#maintoolbar-profile-tb[profile="true"] {
list-style-image: url("chrome://venkman/skin/images/profile-checked.png");
}
#maintoolbar-profile-tb[profile="true"]:hover {
list-style-image: url("chrome://venkman/skin/images/profile-checked-hov.png");
}
#maintoolbar-profile-tb:hover {
list-style-image: url("chrome://venkman/skin/images/profile-hov.png");
}
#maintoolbar-profile-tb:active {
list-style-image: url("chrome://venkman/skin/images/profile-act.png");
}
#maintoolbar-pprint {
list-style-image: url("chrome://venkman/skin/images/prettyprint.png");
}
#maintoolbar-pprint[state="true"] {
list-style-image: url("chrome://venkman/skin/images/prettyprint-checked.png");
}
#maintoolbar-pprint[state="true"]:hover {
list-style-image: url("chrome://venkman/skin/images/prettyprint-checked-hov.png");
}
#maintoolbar-pprint:hover {
list-style-image: url("chrome://venkman/skin/images/prettyprint-hov.png");
}
#maintoolbar-pprint:active {
list-style-image: url("chrome://venkman/skin/images/prettyprint-act.png");
}
outlinerchildren:-moz-outliner-cell(breakpoint-col) {
background: #CCCCCC;
border-right: 1px grey solid;