Author: [EMAIL PROTECTED] Date: Thu Dec 4 05:39:07 2008 New Revision: 917
Modified: branches/bleeding_edge/src/debug-delay.js Log: Added type method to the debug events. Fixed handling of script break points past the length of the script. Review URL: http://codereview.chromium.org/13126 Modified: branches/bleeding_edge/src/debug-delay.js ============================================================================== --- branches/bleeding_edge/src/debug-delay.js (original) +++ branches/bleeding_edge/src/debug-delay.js Thu Dec 4 05:39:07 2008 @@ -322,6 +322,10 @@ // Convert the line and column into an absolute position within the script. var pos = Debug.findScriptSourcePosition(script, this.line(), column); + // If the position is not found in the script (the script might be shorter + // than it used to be) just ignore it. + if (pos === null) return; + // Create a break point object and set the break point. break_point = MakeBreakPoint(pos, this.line(), this.column(), this); break_point.setIgnoreCount(this.ignoreCount()); @@ -443,7 +447,8 @@ // Returns the character position in a script based on a line number and an // optional position within that line. Debug.findScriptSourcePosition = function(script, opt_line, opt_column) { - return script.locationFromLine(opt_line, opt_column).position; + var location = script.locationFromLine(opt_line, opt_column); + return location ? location.position : null; } @@ -727,6 +732,16 @@ } +BreakEvent.prototype.executionState = function() { + return this.exec_state_; +}; + + +BreakEvent.prototype.eventType = function() { + return Debug.DebugEvent.Break; +}; + + BreakEvent.prototype.func = function() { return this.exec_state_.frame(0).func(); }; @@ -799,12 +814,24 @@ return new ExceptionEvent(exec_state, exception, uncaught); } + function ExceptionEvent(exec_state, exception, uncaught) { this.exec_state_ = exec_state; this.exception_ = exception; this.uncaught_ = uncaught; } + +ExceptionEvent.prototype.executionState = function() { + return this.exec_state_; +}; + + +ExceptionEvent.prototype.eventType = function() { + return Debug.DebugEvent.Exception; +}; + + ExceptionEvent.prototype.uncaught = function() { return this.uncaught_; } @@ -855,18 +882,28 @@ }; -function MakeCompileEvent(script_source, script_name, script_function) { - return new CompileEvent(script_source, script_name, script_function); +function MakeCompileEvent(script_source, script_name, script_function, before) { + return new CompileEvent(script_source, script_name, script_function, before); } -function CompileEvent(script_source, script_name, script_function) { +function CompileEvent(script_source, script_name, script_function, before) { this.scriptSource = script_source; this.scriptName = script_name; this.scriptFunction = script_function; + this.before = before; } +CompileEvent.prototype.eventType = function() { + if (this.before) { + return Debug.DebugEvent.BeforeComplie; + } else { + return Debug.DebugEvent.AfterComplie; + } +}; + + function MakeNewFunctionEvent(func) { return new NewFunctionEvent(func); } @@ -875,6 +912,12 @@ function NewFunctionEvent(func) { this.func = func; } + + +NewFunctionEvent.prototype.eventType = function() { + return Debug.DebugEvent.NewFunction; +}; + NewFunctionEvent.prototype.name = function() { return this.func.name; --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list v8-dev@googlegroups.com http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---