venkman only, bug 194234, changes from 0.9.46 to 48, a=asa@mozilla.org

fixes ASSERTs about chrome calling window.alert, etc in debug builds
fixes problems setting breakpoints in files loaded by hand
"add watch expression..." added to context menu of Watch view
fixes file:/ urls loaded form the Open Windows view


git-svn-id: svn://10.0.0.236/trunk@138049 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
rginda%netscape.com 2003-02-20 23:06:12 +00:00
parent 71a48f1cdb
commit 4cba297e5a
7 changed files with 137 additions and 21 deletions

View File

@ -1132,7 +1132,7 @@ function cmdOpenDialog (e)
function cmdOpenURL (e)
{
var url = prompt (MSG_OPEN_URL, "http://");
if (url)
if (url && url != "http://")
return dispatch ("find-url", { url: url });
return null;

View File

@ -1833,12 +1833,20 @@ function setFutureBreakpoint (urlPattern, lineNumber)
if (key in console.fbreaks)
return false;
for (var url in console.scriptManagers)
var url;
for (url in console.scriptManagers)
{
if (url == urlPattern)
console.scriptManagers[url].noteFutureBreakpoint(lineNumber, true);
}
for (url in console.files)
{
if (url == urlPattern)
console.files[url].noteFutureBreakpoint(lineNumber, true);
}
var fbreak = new FutureBreakpoint (urlPattern, lineNumber);
console.fbreaks[key] = fbreak;
@ -1863,10 +1871,18 @@ function clearFutureBreakpoint (urlPattern, lineNumber)
for (i in fbreak.childrenBP)
fbreak.childrenBP[i].parentBP = null;
for (var url in console.scriptManagers)
var url;
for (url in console.scriptManagers)
{
if (url.search(urlPattern) != -1)
console.scriptManagers[url].noteFutureBreakpoint(lineNumber, false);
}
for (url in console.files)
{
if (url == urlPattern)
console.files[url].noteFutureBreakpoint(lineNumber, false);
}
dispatch ("hook-fbreak-clear", { fbreak: fbreak });

View File

@ -189,9 +189,10 @@ function WindowRecord (win, baseURL)
else
{
this.baseURL = getPathFromURL(this.url);
if (this.baseURL.indexOf("file:///") == 0)
this.baseURL = "file:/" + this.baseURL.substr(8)
}
this.reserveChildren(true);
this.shortName = getFileFromPath (this.url);
if (console.prefs["enableChromeFilter"] && this.shortName == "navigator.xul")

View File

@ -33,8 +33,8 @@
*
*/
const __vnk_version = "0.9.46";
const __vnk_requiredLocale = "0.9.42+";
const __vnk_version = "0.9.48";
const __vnk_requiredLocale = "0.9.47+";
var __vnk_versionSuffix = "";
const __vnk_counter_url =
@ -944,6 +944,22 @@ function SourceText (scriptInstance)
this.shortName = abbreviateWord(getFileFromPath (this.url), 30);
}
SourceText.prototype.noteFutureBreakpoint =
function st_notefbreak(line, state)
{
if (!ASSERT(!("scriptInstance" in this),
"Don't call noteFutureBreakpoint on a SourceText with a " +
"scriptInstance, use the scriptManager instead."))
{
return;
}
if (state)
arrayOrFlag (this.lineMap, line - 1, LINE_FBREAK);
else
arrayAndFlag (this.lineMap, line - 1, ~LINE_FBREAK);
}
SourceText.prototype.onMarginClick =
function st_marginclick (e, line)
{
@ -951,7 +967,15 @@ function st_marginclick (e, line)
if (!("scriptInstance" in this))
{
dispatch ("fbreak", { url: this.url, line: line });
if (getFutureBreakpoint(this.url, line))
{
clearFutureBreakpoint(this.url, line);
}
else
{
setFutureBreakpoint(this.url, line);
//dispatch ("fbreak", { urlPattern: this.url, lineNumber: line });
}
}
else
{
@ -1053,6 +1077,16 @@ function st_oncomplete (data, url, status)
this.scriptInstance.guessFunctionNames(sourceText);
this.lineMap = this.scriptInstance.lineMap;
}
else
{
this.lineMap = new Array();
for (var fbp in console.fbreaks)
{
var fbreak = console.fbreaks[fbp];
if (fbreak.url == this.url)
arrayOrFlag (this.lineMap, fbreak.lineNumber - 1, LINE_FBREAK);
}
}
this.isLoaded = true;
dispatch ("hook-source-load-complete",

View File

@ -221,6 +221,47 @@ function safeHTML(str)
return String(str).replace(/[<>&]/g, replaceChars);
}
function alert(msg, parent, title)
{
var PROMPT_CTRID = "@mozilla.org/embedcomp/prompt-service;1";
var nsIPromptService = Components.interfaces.nsIPromptService;
var ps = Components.classes[PROMPT_CTRID].createInstance(nsIPromptService);
if (!parent)
parent = window;
if (!title)
title = MSG_ALERT;
ps.alert (parent, title, msg);
}
function confirm(msg, parent, title)
{
var PROMPT_CTRID = "@mozilla.org/embedcomp/prompt-service;1";
var nsIPromptService = Components.interfaces.nsIPromptService;
var ps = Components.classes[PROMPT_CTRID].createInstance(nsIPromptService);
if (!parent)
parent = window;
if (!title)
title = MSG_CONFIRM;
return ps.confirm (parent, title, msg);
}
function prompt(msg, initial, parent, title)
{
var PROMPT_CTRID = "@mozilla.org/embedcomp/prompt-service;1";
var nsIPromptService = Components.interfaces.nsIPromptService;
var ps = Components.classes[PROMPT_CTRID].createInstance(nsIPromptService);
if (!parent)
parent = window;
if (!title)
title = MSG_PROMPT;
rv = { value: initial };
if (!ps.prompt (parent, title, msg, rv, null, {value: null}))
return null;
return rv.value
}
function getChildById (element, id)
{
var nl = element.getElementsByAttribute("id", id);

View File

@ -2325,8 +2325,8 @@ function s2v_getcontext (cx)
cx.lineNumber = parseInt(target.childNodes[1].firstChild.data);
var row = cx.lineNumber - 1;
if (sourceText.lineMap[row] & LINE_BREAKABLE)
if (sourceText.lineMap && sourceText.lineMap[row] & LINE_BREAKABLE)
{
cx.lineIsExecutable = true;
if ("scriptInstance" in sourceText)
@ -2352,7 +2352,7 @@ function s2v_getcontext (cx)
}
}
if (sourceText.lineMap[row] & LINE_BREAK)
if (sourceText.lineMap && sourceText.lineMap[row] & LINE_BREAK)
{
cx.hasBreak = true;
if ("scriptInstance" in sourceText)
@ -2369,7 +2369,7 @@ function s2v_getcontext (cx)
if ("breakWrapper" in cx && cx.breakWrapper.parentBP)
cx.hasFBreak = true;
}
else if (sourceText.lineMap[row] & LINE_FBREAK)
else if (sourceText.lineMap && sourceText.lineMap[row] & LINE_FBREAK)
{
cx.hasFBreak = true;
cx.breakWrapper = getFutureBreakpoint(cx.url, cx.lineNumber);
@ -3832,6 +3832,7 @@ function wv_init()
getContext: this.getContext,
items:
[
["watch-expr"],
["remove-watch"],
["set-eval-obj", {type: "checkbox",
checkedif: "has('jsdValue') && " +
@ -3998,17 +3999,34 @@ function cmdUnwatch (e)
function cmdWatchExpr (e)
{
var watches = console.views.watches;
if (!e.expression)
{
var watches = console.views.watches.childData;
var len = watches.length;
display (getMsg(MSN_WATCH_HEADER, len));
for (var i = 0; i < len; ++i)
if (e.isInteractive)
{
display (getMsg(MSN_FMT_WATCH_ITEM, [i, watches[i].displayName,
watches[i].displayValue]));
var watchData = console.views.watches.childData;
var len = watchData.length;
display (getMsg(MSN_WATCH_HEADER, len));
for (var i = 0; i < len; ++i)
{
display (getMsg(MSN_FMT_WATCH_ITEM,
[i, watchData[i].displayName,
watchData[i].displayValue]));
}
return null;
}
return null;
var parent;
if (watches.currentContent)
parent = watches.currentContent.ownerWindow;
else
parent = window;
e.expression = prompt(MSG_ENTER_WATCH, "", parent);
if (!e.expression)
return null;
}
var refresher;
@ -4051,8 +4069,8 @@ function cmdWatchExpr (e)
var rec = new ValueRecord(console.jsds.wrapValue(null), e.expression, 0);
rec.onPreRefresh = refresher;
rec.refresh();
console.views.watches.childData.appendChild(rec);
console.views.watches.refresh();
watches.childData.appendChild(rec);
watches.refresh();
return rec;
}

View File

@ -53,7 +53,7 @@
# 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.42+
msg.locale.version = 0.9.47+
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/
@ -162,6 +162,10 @@ msn.status.marking = Marking source for ``%1$S''
msn.status.stopped = Stopped in %1$S, %2$S
msn.floater.title = JSD: %1$S
msg.alert = Alert
msg.prompt = Prompt
msg.confirm = Confirm
msg.cant.pprint = Unable to Pretty Print this function.
msg.slash.required = THINGS HAVE CHANGED: By default, all commands now start with a forward-slash ('/') character. Any text that DOES NOT start with a forward-slash will be passed to the ``eval'' command. For example, to execute the ``step'' command, type ``/step''. To evaluate ``1 + 1'', you just need to type ``1 + 1''. If you prefer the previous behavior, type ``/pref sessionView.requireSlash false''.
@ -226,6 +230,7 @@ msg.open.url = Enter a URL to Load...
msg.save.profile = Save Profile Data As...
msg.save.source = Save Source As...
msg.navigator.xul = Navigator Window
msg.enter.watch = Enter expression to watch:
## property value flags ##
msg.vf.enumerable = e
@ -801,6 +806,7 @@ cmd.remove-watch.label = &Remove Watch
cmd.remove-watch.params = <index> [<...>]
cmd.remove-watch.help = Removes the watch(es) at the 0 based index specified by <index>.
cmd.watch-expr.label = Add Watch Expression...
cmd.watch-expr.params = [<expression>]
cmd.watch-expr.help = Evaluates <expression> in the debug target scope and adds the result to the watch window. If <expression> is not provided, all watches are printed to the console.