From ba85c932f458d7bac70168a68fd3cc1fd4ea7ae6 Mon Sep 17 00:00:00 2001 From: "rginda%netscape.com" Date: Wed, 10 Oct 2001 06:38:25 +0000 Subject: [PATCH] bug 103804, "Venkman doesn't like stopping in timeouts", r=jband, sr=shaver move from setTimeout to the new enterNestedEventLoop callback some strict mode changes fix file/line regexps git-svn-id: svn://10.0.0.236/trunk@105020 18797224-902f-48f8-a5cc-f745e15eee43 --- .../resources/content/venkman-debugger.js | 10 ++++--- .../resources/content/venkman-handlers.js | 29 ++++++++++++------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/mozilla/extensions/venkman/resources/content/venkman-debugger.js b/mozilla/extensions/venkman/resources/content/venkman-debugger.js index 27d9192e88e..60ec04dee0d 100644 --- a/mozilla/extensions/venkman/resources/content/venkman-debugger.js +++ b/mozilla/extensions/venkman/resources/content/venkman-debugger.js @@ -70,6 +70,8 @@ console._executionHook = { onExecute: function exehook (frame, type, rv) { if (frame.script && frame.script.fileName != MSG_VAL_CONSOLE) return debugTrap(frame, type, rv); + ASSERT (frame.script, "Execution hook called with no script"); + return jsdIExecutionHook.RETURN_CONTINUE; } }; @@ -348,9 +350,8 @@ function debugTrap (frame, type, rv) console.frames.push(frame); } - setTimeout (console.onDebugTrap, 100, type); - - console.jsds.enterNestedEventLoop(); + console.trapType = type; + console.jsds.enterNestedEventLoop({onNest: console.onDebugTrap}); /* execution pauses here until someone calls * console.dbg.exitNestedEventLoop() @@ -370,7 +371,8 @@ function debugTrap (frame, type, rv) $ = new Array(); clearCurrentFrame(); delete console.frames; - + delete console.trapType; + console.onDebugContinue(); return console._continueCodeStack.pop(); diff --git a/mozilla/extensions/venkman/resources/content/venkman-handlers.js b/mozilla/extensions/venkman/resources/content/venkman-handlers.js index 55f8dcaae1b..03c371312ed 100644 --- a/mozilla/extensions/venkman/resources/content/venkman-handlers.js +++ b/mozilla/extensions/venkman/resources/content/venkman-handlers.js @@ -106,9 +106,10 @@ function con_reload () } console.onDebugTrap = -function con_ondt (type) +function con_ondt () { var frame = setCurrentFrameByIndex(0); + var type = console.trapType; if (type != jsdIExecutionHook.TYPE_INTERRUPTED || console._lastStackDepth != console.frames.length) @@ -155,10 +156,20 @@ function con_fchanged (currentFrame, currentFrameIndex) if (currentFrame) { - var frame = stack.childData[currentFrameIndex]; - var vr = frame.calculateVisualRow(); + var frameRecord = stack.childData[currentFrameIndex]; + var vr = frameRecord.calculateVisualRow(); console.stackView.selectedIndex = vr; console.stackView.scrollTo (vr, 0); + var source = console.scripts[currentFrame.script.fileName]; + if (source) + { + console.sourceView.displaySource(source); + console.sourceView.softScrollTo(currentFrame.line); + } + else + { + dd ("frame from unknown source"); + } } else { @@ -166,10 +177,6 @@ function con_fchanged (currentFrame, currentFrameIndex) stack.childData = new Array(); stack.hide(); } - - console.sourceView.outliner.invalidate(); /* invalidate to show the new - * currentLine */ - return; } console.onInputCommand = @@ -229,7 +236,7 @@ function cli_ibreak(e) return true; } - var ary = e.inputData.match(/([^\s\:]+)\:?\s*(\d+)\s*$/); + var ary = e.inputData.match(/([^\s]+)\s*(\d+)\s*$/); if (!ary) { console.displayUsageError(e.commandEntry); @@ -253,7 +260,7 @@ function cli_ibreak(e) console.onInputClear = function cli_iclear (e) { - var ary = e.inputData.match(/(\d+)|([^\s\:]+)\:?\s*(\d+)\s*$/); + var ary = e.inputData.match(/(\d+)|([^\s]+)\s*(\d+)\s*$/); if (!ary) { console.displayUsageError(e.commandEntry); @@ -382,7 +389,7 @@ function cli_ifbreak(e) return true; } - var ary = e.inputData.match(/([^\s\:]+)\:?\s*(\d+)\s*$/); + var ary = e.inputData.match(/([^\s]+)\s*(\d+)\s*$/); if (!ary) { console.displayUsageError(e.commandEntry); @@ -663,7 +670,7 @@ function con_stacksel (e) ASSERT (0, "bogus row index " + rowIndex); return; } - + var source; var sourceView = console.sourceView;