landing venkman 0.9.44

refactor prefs code, adding pref-manager.js
move CSS rules with english words into locale subdir
add fallback function hook to be called when regexp based name guessing fails
add "hide duplicates" option
add quicksearch-like textbox to the loaded scripts view
This commit is contained in:
rginda%netscape.com 2002-12-18 09:11:49 +00:00
Родитель a7867be738
Коммит 0732eeaf84
20 изменённых файлов: 623 добавлений и 231 удалений

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

@ -0,0 +1,215 @@
/* -*- 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 PrefManager (branchName)
{
var prefManager = this;
function pm_observe (prefService, topic, prefName)
{
prefManager.dirtyPrefs[prefName] = true;
};
const PREF_CTRID = "@mozilla.org/preferences-service;1";
const nsIPrefService = Components.interfaces.nsIPrefService;
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
const nsIPrefBranchInternal = Components.interfaces.nsIPrefBranchInternal;
this.prefService =
Components.classes[PREF_CTRID].getService(nsIPrefService);
this.prefBranch = this.prefService.getBranch(branchName);
this.prefNames = new Array();
this.dirtyPrefs = new Object();
this.prefs = new Object();
this.observer = { observe: pm_observe };
this.prefBranchInternal =
this.prefBranch.QueryInterface(nsIPrefBranchInternal);
this.prefBranchInternal.addObserver("", this.observer, false);
}
PrefManager.prototype.destroy =
function pm_destroy()
{
this.prefBranchInternal.removeObserver("", this.observer);
}
PrefManager.prototype.listPrefs =
function pm_listprefs (prefix)
{
var list = new Array();
var names = this.prefNames;
for (var i = 0; i < names.length; ++i)
{
if (!prefix || names[i].indexOf(prefix) == 0)
list.push (names[i]);
}
return list;
}
PrefManager.prototype.readPrefs =
function pm_readprefs ()
{
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
var list = this.prefBranch.getChildList("", {});
for (var i = 0; i < list.length; ++i)
{
if (!(list[i] in this))
{
var type = this.prefBranch.getPrefType (list[i]);
var defaultValue;
switch (type)
{
case nsIPrefBranch.PREF_INT:
defaultValue = 0;
break;
case nsIPrefBranch.PREF_BOOL:
defaultValue = false;
break;
default:
defaultValue = "";
}
this.addPref(list[i], defaultValue);
}
}
}
PrefManager.prototype.addPrefs =
function pm_addprefs (prefSpecs)
{
for (var i = 0; i < prefSpecs.length; ++i)
this.addPref(prefSpecs[i][0], prefSpecs[i][1]);
}
PrefManager.prototype.addPref =
function pm_addpref (prefName, defaultValue)
{
var realValue;
var prefManager = this;
function prefGetter ()
{
if (typeof realValue == "undefined" ||
prefName in prefManager.dirtyPrefs)
{
try
{
if (typeof defaultValue == "boolean")
{
realValue = prefManager.prefBranch.getBoolPref(prefName);
}
else if (typeof defaultValue == "number")
{
realValue = prefManager.prefBranch.getIntPref(prefName);
}
else if (defaultValue instanceof Array)
{
realValue = prefManager.prefBranch.getCharPref(prefName);
realValue = realValue.split(/s*;\s*/);
for (i = 0; i < realValue.length; ++i)
realValue[i] = unencode(realValue[i]);
}
else if (typeof defaultValue == "string")
{
realValue = prefManager.prefBranch.getCharPref(prefName);
}
else
{
realValue = defaultValue;
}
}
catch (ex)
{
//dd ("caught exception reading pref ``" + prefName + "'' " +
// type + "\n" + ex);
realValue = defaultValue;
}
}
delete prefManager.dirtyPrefs[prefName];
return realValue;
}
function prefSetter (value)
{
try
{
if (typeof defaultValue == "boolean")
{
prefManager.prefBranch.setBoolPref(prefName, value);
}
else if (typeof defaultValue == "number")
{
prefManager.prefBranch.setIntPref(prefName, value);
}
else if (defaultValue instanceof Array)
{
var ary = new Array();
for (i = 0; i < value.length; ++i)
ary[i] = encode(value[i]);
prefManager.prefBranch.setCharPref(prefName, ary.join("; "));
}
else
{
prefManager.prefBranch.setCharPref(prefName, value);
}
prefManager.prefService.savePrefFile(null);
}
catch (ex)
{
dd ("caught exception writing pref ``" + prefName + "''\n" + ex);
}
return value;
}
if (prefName in prefManager)
return;
prefManager.prefNames.push(prefName);
prefManager.prefNames.sort();
prefManager.prefs.__defineGetter__(prefName, prefGetter);
prefManager.prefs.__defineSetter__(prefName, prefSetter);
}

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

@ -697,12 +697,14 @@ function xtvr_remchild (index)
//for (var i = index + 1; i < this.childData.length; ++i)
// --this.childData[i].childIndex;
var fpDelta = -this.childData[index].visualFootprint;
var changeStart = this.childData[index].calculateVisualRow();
var orphan = this.childData[index];
var fpDelta = -orphan.visualFootprint;
var changeStart = orphan.calculateVisualRow();
//this.childData[index].childIndex = -1;
delete this.childData[index].parentRecord;
delete orphan.parentRecord;
arrayRemoveAt (this.childData, index);
if ("isContainerOpen" in this && this.isContainerOpen)
if (!orphan.isHidden && "isContainerOpen" in this && this.isContainerOpen)
{
//XXX why would we need to resort on a remove?
//if (this.calculateVisualRow() >= 0)
@ -745,7 +747,8 @@ function xtvr_uhide ()
this.isHidden = false;
this.invalidateCache();
var row = this.calculateVisualRow();
this.parentRecord.onVisualFootprintChanged (row, this.visualFootprint);
if (this.parentRecord)
this.parentRecord.onVisualFootprintChanged (row, this.visualFootprint);
}
/*

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

@ -59,10 +59,10 @@ function initCommands()
["commands", cmdCommands, CMD_CONSOLE],
["cont", cmdCont, CMD_CONSOLE | CMD_NEED_STACK],
["debug-script", cmdSetScriptFlag, 0],
["debug-instance-on", cmdToggleSomething, 0],
["debug-instance-on", cmdToggleSomething, 0],
["debug-instance-off", cmdToggleSomething, 0],
["debug-instance", cmdSetScriptFlag, 0],
["debug-transient", cmdSetTransientFlag, 0],
["debug-instance", cmdSetScriptFlag, 0],
["debug-transient", cmdSetTransientFlag, 0],
["emode", cmdEMode, CMD_CONSOLE],
["eval", cmdEval, CMD_CONSOLE],
["evald", cmdEvald, CMD_CONSOLE],
@ -76,10 +76,10 @@ function initCommands()
["find-ctor", cmdFindCreatorOrCtor, 0],
["find-file", cmdFindFile, CMD_CONSOLE],
["find-frame", cmdFindFrame, CMD_NEED_STACK],
["find-sourcetext", cmdFindSourceText, 0],
["find-sourcetext", cmdFindSourceText, 0],
["find-sourcetext-soft", cmdFindSourceText, 0],
["find-script", cmdFindScript, 0],
["find-scriptinstance", cmdFindScriptInstance, 0],
["find-script", cmdFindScript, 0],
["find-scriptinstance", cmdFindScriptInstance, 0],
["find-url", cmdFindURL, CMD_CONSOLE],
["find-url-soft", cmdFindURL, 0],
["finish", cmdFinish, CMD_CONSOLE | CMD_NEED_STACK],
@ -1201,7 +1201,7 @@ function cmdPref (e)
}
else
{
var ary = console.listPrefs(e.prefName);
var ary = console.prefManager.listPrefs(e.prefName);
if (ary.length == 0)
{
display (getMsg(MSN_ERR_UNKNOWN_PREF, [e.prefName]),
@ -1289,7 +1289,7 @@ function cmdRestoreLayout (e)
{
if (!e.name)
{
var list = console.listPrefs("layoutState.");
var list = console.prefManager.listPrefs("layoutState.");
for (var i = 0; i < list.length; ++i)
list[i] = list[i].substr(12);
list.push("factory");
@ -1341,7 +1341,7 @@ function cmdSaveLayout (e)
{
if (!e.name)
{
var list = console.listPrefs("layoutState.");
var list = console.prefManager.listPrefs("layoutState.");
for (var i = 0; i < list.length; ++i)
list[i] = list[i].substr(12);
list.push("factory");
@ -1358,7 +1358,7 @@ function cmdSaveLayout (e)
var ary = console.viewManager.getLayoutState ();
var prefName = "layoutState." + e.name;
console.addPref(prefName);
console.commandManager.addPref(prefName, "");
console.prefs[prefName] = ary.join ("; ");
}
@ -1378,7 +1378,7 @@ function cmdSaveProfile (e)
if (!e.targetFile || e.targetFile == "?")
{
var list = console.listPrefs(templatePfx);
var list = console.prefManager.listPrefs(templatePfx);
var extList = "";
for (i = 0; i < list.length; ++i)
{

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

@ -111,10 +111,6 @@ function initDebugger()
console.errorHook = { onError: jsdErrorHook };
console.callHook = { onCall: jsdCallHook };
console.jsds.breakpointHook = console.executionHook;
console.jsds.debuggerHook = console.executionHook;
console.jsds.debugHook = console.executionHook;
console.jsds.errorHook = console.errorHook;
console.jsds.flags = jsdIDebuggerService.ENABLE_NATIVE_FRAMES;
console.jsdConsole = console.jsds.wrapValue(console);
@ -126,6 +122,11 @@ function initDebugger()
console.jsds.scriptHook = console.scriptHook;
console.jsds.enumerateScripts(enumer);
console.jsds.breakpointHook = console.executionHook;
console.jsds.debuggerHook = console.executionHook;
console.jsds.debugHook = console.executionHook;
console.jsds.errorHook = console.errorHook;
dd ("} initDebugger");
}
@ -222,6 +223,10 @@ function jsdExecutionHook (frame, type, rv)
{
var hookReturn = jsdIExecutionHook.RETURN_CONTINUE;
if (!console.initialized)
return hookReturn;
if (!ASSERT(!("frames" in console), "Execution hook called while stopped") ||
frame.isNative ||
!ASSERT(frame.script, "Execution hook called with no script") ||
@ -299,6 +304,9 @@ function jsdExecutionHook (frame, type, rv)
function jsdCallHook (frame, type)
{
if (!console.initialized)
return;
if (type == jsdICallHook.TYPE_FUNCTION_CALL)
{
setStopState(false);
@ -318,7 +326,7 @@ function jsdCallHook (frame, type)
function jsdErrorHook (message, fileName, line, pos, flags, exception)
{
if (isURLFiltered (fileName))
if (!console.initialized || isURLFiltered (fileName))
return true;
try
@ -899,12 +907,18 @@ function si_guessnames ()
ary[1] = toUnicode(ary[1], this._sourceText.charset);
scriptWrapper.functionName = getMsg(MSN_FMT_GUESSEDNAME, ary[1]);
this.isGuessedName = true;
}
else
{
dd ("unable to guess function name based on text ``" +
scanText + "''");
if ("guessFallback" in console)
{
var name = console.guessFallback(scriptWrapper, scanText);
if (name)
{
scriptWrapper.functionName = getMsg(MSN_FMT_GUESSEDNAME,
name);
}
}
}
}

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

@ -33,6 +33,13 @@
*
*/
console.guessFallback =
function (scriptWrapper, sourceContext)
{
dd ("guess fallback");
return "foo";
}
function initDev()
{
var cmdary =
@ -55,9 +62,9 @@ function initDev()
if (!("devState" in console.pluginState))
{
console.addPref ("dbgContexts", false);
console.addPref ("dbgDispatch", false);
console.addPref ("dbgRealize", false);
console.prefManager.addPref ("dbgContexts", false);
console.prefManager.addPref ("dbgDispatch", false);
console.prefManager.addPref ("dbgRealize", false);
}
console.pluginState.devState = true;

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

@ -44,14 +44,16 @@ const JSD_SERVICE_PPBUFFER = "ppbuffer";
function initJSDURL()
{
console.addPref ("services.help.css",
"chrome://venkman/skin/venkman-help.css");
console.addPref ("services.help.template",
"chrome://venkman/locale/venkman-help.tpl");
console.addPref ("services.source.css",
"chrome://venkman/skin/venkman-source.css");
console.addPref ("services.source.colorize", true);
console.addPref ("services.source.colorizeLimit", 1500);
var prefs =
[
["services.help.css", "chrome://venkman/skin/venkman-help.css"],
["services.help.template", "chrome://venkman/locale/venkman-help.tpl"],
["services.source.css", "chrome://venkman/skin/venkman-source.css"],
["services.source.colorize", true],
["services.source.colorizeLimit", 1500]
];
console.prefManager.addPrefs(prefs);
}
/*
@ -308,10 +310,13 @@ function svc_help (response, parsedURL)
htmlDesc = htmlDesc.replace (/\*([^\*]+)\*/g, replaceBold);
htmlDesc = htmlDesc.replace (/\|([^\|]+)\|/g, replaceCommand);
// remove trailing access key (non en-US locales) and ...
var trimmedLabel =
command.labelstr.replace(/(\([a-zA-Z]\))?(\.\.\.)?$/, "");
vars = {
"\\$command-name": command.name,
"\\$ui-label-safe": escape(fromUnicode(command.labelstr,
MSG_REPORT_CHARSET)),
"\\$ui-label-safe": encodeURIComponent(trimmedLabel),
"\\$ui-label": fromUnicode(command.labelstr,
MSG_REPORT_CHARSET),
"\\$params": fromUnicode(htmlUsage, MSG_REPORT_CHARSET),

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

@ -33,6 +33,8 @@
*
*/
@import url(chrome://venkman/locale/venkman-output-locale.css);
a.venkman-link {
text-decoration: none;
}
@ -72,10 +74,6 @@ a.venkman-link:hover {
font-weight: bold;
}
.msg-data[msg-type="LOG"]:before {
content: "LOG:";
}
.msg-data[msg-type="ERROR"]:before {
content: "!!";
}
@ -85,17 +83,8 @@ a.venkman-link:hover {
content: "*";
}
.msg-data[msg-type="ETRACE"]:before {
content: "X";
}
.msg-data[msg-type="HELP"]:before {
content: "Help:";
}
.msg-data[msg-type="USAGE"]:before {
font-style: normal;
content: "Usage:";
}
.msg-data[msg-type="SOURCE"]:before {

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

@ -33,141 +33,33 @@
*
*/
console.prefs = new Object();
const PREF_CTRID = "@mozilla.org/preferences-service;1";
const nsIPrefService = Components.interfaces.nsIPrefService;
const nsIPrefBranch = Components.interfaces.nsIPrefBranch;
function initPrefs()
{
console.prefs = new Object();
console.prefs.prefService =
Components.classes[PREF_CTRID].getService(nsIPrefService);
console.prefs.prefBranch =
console.prefs.prefService.getBranch("extensions.venkman.");
console.prefs.prefNames = new Array();
console.prefs.prefNameMap = new Object();
console.prefManager = new PrefManager("extensions.venkman.");
console.prefs = console.prefManager.prefs;
// console.addPref ("input.commandchar", "/");
console.addPref ("maxStringLength", 100);
console.addPref ("startupCount", 0);
console.addPref ("enableChromeFilter", true);
console.addPref ("tabWidth", 4);
console.addPref ("initialScripts", "");
console.addPref ("prettyprint", false);
console.addPref ("guessContext", 5);
console.addPref ("guessPattern", "(\\w+)\\s*[:=]\\s*$");
console.addPref ("permitStartupHit", true);
console.addPref ("statusDuration", 5 * 1000);
console.addPref ("menubarInFloaters",
navigator.platform.indexOf ("Mac") != -1);
console.addPref ("lastErrorMode", "ignore");
console.addPref ("lastThrowMode", "ignore");
var list = console.prefs.prefBranch.getChildList("", {});
for (var p in list)
{
if (!(list[p] in console.prefs))
{
console.addPref(list[p]);
}
}
var prefs =
[
["maxStringLength", 100],
["startupCount", 0],
["enableChromeFilter", true],
["tabWidth", 4],
["initialScripts", ""],
["prettyprint", false],
["guessContext", 5],
["guessPattern", "(\\w+)\\s*[:=]\\s*$"],
["permitStartupHit", true],
["statusDuration", 5 * 1000],
["menubarInFloaters", navigator.platform.indexOf ("Mac") != -1],
["lastErrorMode", "ignore"],
["lastThrowMode", "ignore"]
];
console.prefManager.addPrefs(prefs);
}
console.listPrefs =
function con_listprefs (prefix)
function destroyPrefs()
{
var list = new Array();
var names = console.prefs.prefNames;
for (var i = 0; i < names.length; ++i)
{
if (!prefix || names[i].indexOf(prefix) == 0)
list.push (names[i]);
}
return list;
}
console.addPref =
function con_addpref (prefName, defaultValue)
{
var realValue;
function prefGetter ()
{
if (typeof realValue == "undefined")
{
var type = this.prefBranch.getPrefType (prefName);
try
{
switch (type)
{
case nsIPrefBranch.PREF_STRING:
realValue = this.prefBranch.getCharPref (prefName);
break;
case nsIPrefBranch.PREF_INT:
realValue = this.prefBranch.getIntPref (prefName);
break;
case nsIPrefBranch.PREF_BOOL:
realValue = this.prefBranch.getBoolPref (prefName);
break;
default:
realValue = defaultValue;
}
}
catch (ex)
{
//dd ("caught exception reading pref ``" + prefName + "'' " +
// type + "\n" + ex);
realValue = defaultValue;
}
}
return realValue;
}
function prefSetter (value)
{
try
{
switch (typeof value)
{
case "int":
realValue = value;
this.prefBranch.setIntPref (prefName, value);
break;
case "boolean":
realValue = value;
this.prefBranch.setBoolPref (prefName, value);
break;
default:
realValue = value;
this.prefBranch.setCharPref (prefName, value);
break;
}
this.prefService.savePrefFile(null);
}
catch (ex)
{
dd ("caught exception writing pref ``" + prefName + "''\n" + ex);
}
return value;
}
if (prefName in console.prefs)
return;
console.prefs.prefNames.push(prefName);
console.prefs.prefNames.sort();
console.prefs.__defineGetter__(prefName, prefGetter);
console.prefs.__defineSetter__(prefName, prefSetter);
console.prefManager.destroy();
}

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

@ -35,17 +35,17 @@
function initProfiler ()
{
console.addPref ("profile.template.xml",
"chrome://venkman/locale/profile.xml.tpl");
console.addPref ("profile.template.html",
"chrome://venkman/locale/profile.html.tpl");
console.addPref ("profile.template.csv",
"chrome://venkman/locale/profile.csv.tpl");
console.addPref ("profile.template.txt",
"chrome://venkman/locale/profile.txt.tpl");
console.addPref ("profile.ranges.default",
"1000000, 5000, 2500, 1000, 750, 500, 250, 100, 75, 50, " +
"25, 10, 7.5, 5, 2.5, 1, 0.75, 0.5, 0.25");
var prefs =
[
["profile.template.xml", "chrome://venkman/locale/profile.xml.tpl"],
["profile.template.html", "chrome://venkman/locale/profile.html.tpl"],
["profile.template.csv", "chrome://venkman/locale/profile.csv.tpl"],
["profile.template.txt", "chrome://venkman/locale/profile.txt.tpl"],
["profile.ranges.default", "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.prefManager.addPrefs(prefs);
}
function ProfileReport (reportTemplate, file, rangeList, scriptInstanceList)

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

@ -58,10 +58,15 @@ function initRecords()
FrameRecord.prototype.property = atomsvc.getAtom("item-frame");
FrameRecord.prototype.atomCurrent = atomsvc.getAtom("current-frame-flag");
var prefs =
[
["valueRecord.showFunctions", false],
["valueRecord.showECMAProps", false],
["valueRecord.brokenObjects", "^JavaPackage$"]
];
console.addPref ("valueRecord.showFunctions", false);
console.addPref ("valueRecord.showECMAProps", false);
console.addPref ("valueRecord.brokenObjects", "^JavaPackage$");
console.prefManager.addPrefs(prefs);
try
{
ValueRecord.prototype.brokenObjects =

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

@ -58,6 +58,7 @@
<script src="chrome://communicator/content/findUtils.js"/>
<script src="chrome://global/content/strres.js"/>
<script src="chrome://venkman/content/pref-manager.js"/>
<script src="chrome://venkman/content/command-manager.js"/>
<script src="chrome://venkman/content/menu-manager.js"/>
<script src="chrome://venkman/content/view-manager.js"/>

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

@ -33,8 +33,8 @@
*
*/
const __vnk_version = "0.9.40";
const __vnk_requiredLocale = "0.9.x";
const __vnk_version = "0.9.44";
const __vnk_requiredLocale = "0.9.42+";
var __vnk_versionSuffix = "";
const __vnk_counter_url =
@ -71,6 +71,8 @@ const LINE_FBREAK = 0x04;
var console = new Object();
console.initialized = false;
/* |this|less functions */
function setStopState(state)
@ -229,7 +231,7 @@ function dispatch (text, e, flags)
MT_ERROR);
display (formatException(ex), MT_ERROR);
dd (formatException(ex), MT_ERROR);
if ("stack" in ex)
if (typeof ex == "object" && "stack" in ex)
dd (ex.stack);
}
break;
@ -529,10 +531,13 @@ function init()
};
disableDebugCommands();
initDebugger();
initProfiler();
// read prefs that have not been explicitly created, such as the layout prefs
console.prefManager.readPrefs();
fetchLaunchCount();
console.sourceText = new HelpText();
@ -585,6 +590,7 @@ function destroy ()
destroyViews();
destroyHandlers();
destroyPrefs();
detachDebugger();
}

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

@ -48,8 +48,13 @@ const DEFAULT_VURLS =
function initViews()
{
console.addPref ("layoutState.default", DEFAULT_VURLS);
console.addPref ("saveLayoutOnExit", true);
var prefs =
[
["layoutState.default", DEFAULT_VURLS],
["saveLayoutOnExit", true]
];
console.prefManager.addPrefs (prefs);
const ATOM_CTRID = "@mozilla.org/atom-service;1";
const nsIAtomService = Components.interfaces.nsIAtomService;
@ -445,11 +450,13 @@ console.views.locals.viewId = VIEW_LOCALS;
console.views.locals.init =
function lv_init ()
{
/* max number of properties the "scope" or "this" object can have before
* we stop auto-opening the tree node. */
console.addPref("localsView.autoOpenMax", 25);
/* max number of functions to keep open/close states for. */
console.addPref("localsView.savedStatesMax", 20);
var prefs =
[
["localsView.autoOpenMax", 25],
["localsView.savedStatesMax", 20]
];
console.prefManager.addPrefs(prefs);
console.menuSpecs["context:locals"] = {
getContext: this.getContext,
@ -749,7 +756,22 @@ function scv_init ()
var transientIf = "'scriptInstance' in cx && " +
"cx.scriptInstance.scriptManager.disableTransients";
console.addPref ("scriptsView.groupFiles", true);
var prefs =
[
["scriptsView.groupFiles", true],
["scriptsView.showMostRecent", true]
];
console.prefManager.addPrefs(prefs);
this.cmdary =
[
["show-most-recent", cmdShowMostRecent, CMD_CONSOLE],
["search-scripts", cmdSearchScripts, CMD_CONSOLE],
["toggle-scripts-search-box", cmdToggleScriptsSearchBox, CMD_CONSOLE],
["toggle-show-most-recent", "show-most-recent toggle", 0]
];
console.menuSpecs["context:scripts"] = {
getContext: this.getContext,
@ -766,7 +788,14 @@ function scv_init ()
[">scripts:wrapper-flags", {enabledif: "has('scriptWrapper')"}],
["-"],
["save-profile"],
["clear-profile"]
["clear-profile"],
["-"],
["toggle-show-most-recent",
{type: "checkbox",
checkedif: "console.prefs['scriptsView.showMostRecent']"}],
["toggle-chrome",
{type: "checkbox",
checkedif: "console.prefs['enableChromeFilter']"}]
]
};
@ -811,6 +840,98 @@ function scv_init ()
this.atomFunction = atomsvc.getAtom("file-function");
}
function cmdSearchScripts (e)
{
var scriptsView = console.views.scripts;
var rootNode = scriptsView.childData;
var i;
for (i = 0; i < rootNode.childData.length; ++i)
{
var scriptInstanceRecord = rootNode.childData[i];
if (e.pattern && (!scriptInstanceRecord.url ||
scriptInstanceRecord.url.indexOf(e.pattern) == -1))
{
scriptInstanceRecord.searchExclude = true;
if (!scriptInstanceRecord.isHidden)
scriptInstanceRecord.hide();
}
else
{
delete scriptInstanceRecord.searchExclude;
if (!("recentExclude" in scriptInstanceRecord) &&
scriptInstanceRecord.isHidden)
{
scriptInstanceRecord.unHide();
}
}
}
if (scriptsView.currentContent)
{
var textbox = getChildById(scriptsView.currentContent, "scripts-search");
textbox.value = e.pattern;
}
}
function cmdShowMostRecent (e)
{
e.toggle = getToggle (e.toggle, console.prefs["scriptsView.showMostRecent"]);
console.prefs["scriptsView.showMostRecent"] = e.toggle;
var rootNode = console.views.scripts.childData;
var i;
var scriptInstanceRecord;
if (e.toggle)
{
/* want to hide duplicate script instances */
for (i = 0; i < rootNode.childData.length; ++i)
{
scriptInstanceRecord = rootNode.childData[i];
var scriptInstance = scriptInstanceRecord.scriptInstance;
var instances = scriptInstance.scriptManager.instances;
var length = instances.length;
if (scriptInstance != instances[length - 1])
{
scriptInstanceRecord.recentExclude = true;
if (!scriptInstanceRecord.isHidden)
scriptInstanceRecord.hide();
}
}
}
else
{
/* show all script instances */
for (i = 0; i < rootNode.childData.length; ++i)
{
scriptInstanceRecord = rootNode.childData[i];
delete scriptInstanceRecord.recentExclude;
if (scriptInstanceRecord.isHidden &&
!("searchExclude" in scriptInstanceRecord))
{
scriptInstanceRecord.unHide();
}
}
}
}
function cmdToggleScriptsSearchBox(e)
{
var scriptsView = console.views.scripts;
if (scriptsView.currentContent)
{
var box = getChildById(scriptsView.currentContent, "scripts-search-box");
if (box.hasAttribute("hidden"))
box.removeAttribute("hidden");
else
box.setAttribute("hidden", "true");
}
}
console.views.scripts.hooks = new Object();
console.views.scripts.hooks["chrome-filter"] =
@ -921,6 +1042,20 @@ function scv_hookScriptInstanceSealed (e)
}
console.views.scripts.childData.appendChild(scr);
var length = e.scriptInstance.scriptManager.instances.length;
if (console.prefs["scriptsView.showMostRecent"] && length > 1)
{
var previous = e.scriptInstance.scriptManager.instances[length - 2];
if ("scriptInstanceRecord" in previous)
{
var record = previous.scriptInstanceRecord;
record.recentExclude = true;
if (!record.isHidden)
record.hide();
}
}
}
console.views.scripts.hooks["hook-script-instance-destroyed"] =
@ -932,6 +1067,19 @@ function scv_hookScriptInstanceDestroyed (e)
var rec = e.scriptInstance.scriptInstanceRecord;
if ("parentRecord" in rec)
console.views.scripts.childData.removeChildAtIndex(rec.childIndex);
var instances = e.scriptInstance.scriptManager.instances;
if (instances.length)
{
var previous = instances[instances.length - 1];
if ("scriptInstanceRecord" in previous)
{
var record = previous.scriptInstanceRecord;
if (!("searchExclude" in record))
record.unHide();
delete record.recentExclude;
}
}
}
console.views.scripts.hooks["hook-window-opened"] =
@ -946,6 +1094,29 @@ function scv_hookWindowOpen (e)
//console.views.scripts.thaw();
}
console.views.scripts.onSearchInput =
function scv_oninput (event)
{
var scriptsView = this;
function onTimeout ()
{
var textbox = getChildById(scriptsView.currentContent, "scripts-search");
dispatch ("search-scripts", { pattern: textbox.value });
};
if ("searchTimeout" in this)
clearTimeout(this.searchTimeout);
this.searchTimeout = setTimeout (onTimeout, 500);
}
console.views.scripts.onSearchClear =
function scv_onclear (event)
{
dispatch ("search-scripts");
}
console.views.scripts.onShow =
function scv_show ()
{
@ -1155,21 +1326,25 @@ function ss_init ()
return "console.prefs['sessionView.currentCSS'] == " + css;
};
console.addPref ("sessionView.requireSlash", true);
console.addPref ("sessionView.commandHistory", 20);
console.addPref ("sessionView.dtabTime", 500);
console.addPref ("sessionView.maxHistory", 500);
console.addPref ("sessionView.outputWindow",
"chrome://venkman/content/venkman-output-window.html?$css");
console.addPref ("sessionView.currentCSS",
"chrome://venkman/skin/venkman-output-default.css");
console.addPref ("sessionView.defaultCSS",
"chrome://venkman/skin/venkman-output-default.css");
console.addPref ("sessionView.darkCSS",
"chrome://venkman/skin/venkman-output-dark.css");
console.addPref ("sessionView.lightCSS",
"chrome://venkman/skin/venkman-output-light.css");
var prefs =
[
["sessionView.requireSlash", true],
["sessionView.commandHistory", 20],
["sessionView.dtabTime", 500],
["sessionView.maxHistory", 500],
["sessionView.outputWindow",
"chrome://venkman/content/venkman-output-window.html?$css"],
["sessionView.currentCSS",
"chrome://venkman/skin/venkman-output-default.css"],
["sessionView.defaultCSS",
"chrome://venkman/skin/venkman-output-default.css"],
["sessionView.darkCSS",
"chrome://venkman/skin/venkman-output-dark.css"],
["sessionView.lightCSS",
"chrome://venkman/skin/venkman-output-light.css"]
];
console.prefManager.addPrefs(prefs);
console.menuSpecs["context:session"] = {
items:
@ -1921,7 +2096,7 @@ console.views.source2.viewId = VIEW_SOURCE2;
console.views.source2.init =
function ss_init ()
{
console.addPref ("source2View.maxTabs", 5);
console.prefManager.addPref ("source2View.maxTabs", 5);
this.cmdary =
[

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

@ -111,6 +111,13 @@
<floatingview id="scripts" title="&Scripts.label;" flex="1">
<vbox id="scripts-view-content" flex="1">
<hbox id="scripts-search-box" align="baseline" persist="hidden">
<label id="scripts-search-label" value="&ScriptsSearch.label;"
onclick="console.views.scripts.onSearchClear(event);"
tooltiptext="&ScriptsSearch.tooltip;"/>
<textbox id="scripts-search" flex="1"
oninput="console.views.scripts.onSearchInput(event);"/>
</hbox>
<tree flex="1" id="scripts-tree" persist="height"
ondblclick="console.views.scripts.onDblClick(event);"
context="context:scripts">

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

@ -30,6 +30,7 @@ venkman.jar:
content/venkman/tree-utils.js (content/tree-utils.js)
content/venkman/file-utils.js (content/file-utils.js)
content/venkman/html-consts.js (content/html-consts.js)
content/venkman/pref-manager.js (content/pref-manager.js)
content/venkman/command-manager.js (content/command-manager.js)
content/venkman/menu-manager.js (content/menu-manager.js)
content/venkman/view-manager.js (content/view-manager.js)
@ -40,7 +41,8 @@ venkman.jar:
content/venkman/venkman-overlay.js (content/venkman-overlay.js)
skin/modern/venkman/venkman.css (skin/venkman.css)
locale/en-US/venkman/venkman.dtd (locale/en-US/venkman.dtd)
locale/en-US/venkman/venkman.properties (locale/en-US/venkman.properties)
locale/en-US/venkman/venkman.properties (locale/en-US/venkman.properties)
locale/en-US/venkman/venkman-output-locale.css (locale/en-US/venkman-output-locale.css)
locale/en-US/venkman/venkman-overlay.dtd (locale/en-US/venkman-overlay.dtd)
locale/en-US/venkman/venkman-help.tpl (locale/en-US/venkman-help.tpl)
locale/en-US/venkman/profile.csv.tpl (locale/en-US/profile.csv.tpl)

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

@ -18,7 +18,7 @@
if ("search" in result)
{
document.getElementById("search").value =
unescape(result.search);
decodeURIComponent(result.search);
}
if ("within" in result)

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

@ -0,0 +1,55 @@
/* -*- 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
*
*/
/*
* Note to translators: Only localize the text after "content:", don't touch
* the [msg-type="FOO"] selectors.
*/
.msg-data[msg-type="HELP"]:before {
content: "Help:";
}
.msg-data[msg-type="USAGE"]:before {
content: "Usage:";
}
.msg-data[msg-type="LOG"]:before {
content: "LOG:";
}
.msg-data[msg-type="ETRACE"]:before {
content: "X"; /* X is a mnemonic for eXception */
}

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

@ -70,10 +70,12 @@
<!ENTITY Session.label "Interactive Session">
<!-- script view -->
<!ENTITY Scripts.label "Loaded Scripts">
<!ENTITY ScriptsCol0.header "Name">
<!ENTITY ScriptsCol1.header "Line">
<!ENTITY ScriptsCol2.header "Length">
<!ENTITY Scripts.label "Loaded Scripts">
<!ENTITY ScriptsSearch.label "Search">
<!ENTITY ScriptsSearch.tooltip "Click here to clear the search field">
<!ENTITY ScriptsCol0.header "Name">
<!ENTITY ScriptsCol1.header "Line">
<!ENTITY ScriptsCol2.header "Length">
<!-- source view -->
<!ENTITY Source.label "Source Code">

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

@ -53,8 +53,8 @@
# character set to convert unicode messages to before writing them to a
# profile report, or generated help text.
msg.report.charset = utf-8
msg.locale.version = 0.9.x
msg.bad.locale = This version of Venkman is meant to work with a ``%1$S'' locale, but you are currently using a locale marked ``%2$S''. Chances are, you're going to have problems. Please change to the default locale, or upgrade your language pack.
msg.locale.version = 0.9.42+
msn.bad.locale = This version of Venkman is meant to work with a ``%1$S'' locale, but you are currently using a locale marked ``%2$S''. Chances are, you're going to have problems. Please change to the default locale, or upgrade your language pack.
msg.release.url = http://www.mozilla.org/releases/
@ -697,6 +697,9 @@ 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.search-scripts.params = [<pattern>]
cmd.search-scripts.help = Removes any scripts with URLs that do not match <pattern> from the Loaded Scripts view. If <pattern> is not provided, all scripts will be displayed.
cmd.session-css.params = [<css>]
cmd.session-css.help = Sets the current CSS file used to style the Interactive Session. The value of <css> can be the text "default", "dark", or "light" OR a url to the CSS file to use. The "default" css uses your browser defaults as foreground and background colors, "dark" is dark background in light text, and "light" is light background with dark text. If <css> is not provided, the current value is printed.
@ -724,6 +727,11 @@ cmd.toggle-ecmas.label = &Include ECMA Properties
cmd.show-ecmas.params = [<toggle>]
cmd.show-ecmas.help = Controls whether or not the ECMA [[Parent]] and [[Prototype]] properties will be displayed in the Local Varables and Watch views. After changing this value, you will need to close and open affected nodes in order to see the change. The value of <toggle> can be |true|, |on|, |yes|, or |1| to turn the flag on; |false|, |off|, |no|, or |0| to turn it off; or |toggle| to invert the current state. If <toggle> is not provided, the current state will be displayed.
cmd.toggle-show-most-recent.label = E&xclude Duplicates
cmd.show-most-recent.params = [<toggle>]
cmd.show-most-recent.help = Controls whether the Loaded Scripts view should show only the most recent script from a given URL, or all of them. With this off, you may notice duplicate entries in the Loaded Scripts view. The value of <toggle> can be |true|, |on|, |yes|, or |1| to turn the flag on; |false|, |off|, |no|, or |0| to turn it off; or |toggle| to invert the current state. If <toggle> is not provided, the current state will be displayed.
cmd.startup-init.label = Initialize at &Startup
cmd.startup-init.params = [<toggle>]
cmd.startup-init.help = Sets the state of the "Initialize at Startup" feature. With this feature enabled, the debugger will begin tracking scripts when the browser is first started, instead of waiting until the user interface is launched. This will allow the script list to display files that were loaded before you started the debugger user interface. This feature incurs a *slight* performance hit. The value of <toggle> can be |true|, |on|, |yes|, or |1| to turn the flag on; |false|, |off|, |no|, or |0| to turn it off; or |toggle| to invert the current state. If <toggle> is not provided, the current state will be displayed.
@ -758,6 +766,8 @@ cmd.tm-cycle.key = accel T
cmd.tm-ignore.label = I&gnore Exceptions
cmd.tm-trace.label = T&race Exceptions
cmd.toggle-scripts-search-box.help = Toggles the visibility of the search controls in the Loaded Scripts view.
cmd.toggle-float.params = <view-id>
cmd.toggle-float.help = If the view specified by <view-id> is currently displayed in the main window, or is not visible, it will be placed in a new floating window. If <view-id> is already in a floating window, it will be placed back in the main window.

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

@ -214,6 +214,10 @@ browser {
list-style-image: url("chrome://venkman/skin/images/prettyprint-act.png");
}
.scripts-search-label:hover {
color: blue;
}
.view-container {
-moz-box-orient: horizontal;
/*