Reviewers: Mads Ager, Description: During the refactoring in r1461 and adding of script ids in r1468 the propagation of a boolean flag was missing. This caused the line numbers retreived through ScriptMirror objects to ignore the resource line offset information in the script.
Added an explicit false parameter where the parameter was previously left out. Added a test case for this. Please review this at http://codereview.chromium.org/43130 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/debug-delay.js M src/messages.js M src/mirror-delay.js M test/cctest/test-debug.cc Index: test/cctest/test-debug.cc =================================================================== --- test/cctest/test-debug.cc (revision 1480) +++ test/cctest/test-debug.cc (working copy) @@ -3720,6 +3720,17 @@ // Test that a function with closure can be run in the debugger. v8::Script::Compile(v8::String::New("CheckClosure()"))->Run(); + + + // Test that the source line is correct when there is a line offset. + v8::ScriptOrigin origin(v8::String::New("test"), + v8::Integer::New(7)); + v8::Script::Compile(v8::String::New("CheckSourceLine(7)"), &origin)->Run(); + v8::Script::Compile(v8::String::New("function f() {\n" + " CheckSourceLine(8)\n" + " CheckSourceLine(9)\n" + " CheckSourceLine(10)\n" + "}; f()"), &origin)->Run(); } Index: src/mirror-delay.js =================================================================== --- src/mirror-delay.js (revision 1480) +++ src/mirror-delay.js (working copy) @@ -1592,8 +1592,9 @@ }; -ScriptMirror.prototype.locationFromPosition = function(position) { - return this.script_.locationFromPosition(position); +ScriptMirror.prototype.locationFromPosition = function( + position, include_resource_offset) { + return this.script_.locationFromPosition(position, include_resource_offset); } Index: src/messages.js =================================================================== --- src/messages.js (revision 1480) +++ src/messages.js (working copy) @@ -302,7 +302,7 @@ var offset_position = opt_offset_position || 0; if (line < 0 || column < 0 || offset_position < 0) return null; if (line == 0) { - return this.locationFromPosition(offset_position + column); + return this.locationFromPosition(offset_position + column, false); } else { // Find the line where the offset position is located var lineCount = this.lineCount(); @@ -519,7 +519,7 @@ // Returns the offset of the given position within the containing // line. function GetPositionInLine(message) { - var location = message.script.locationFromPosition(message.startPos); + var location = message.script.locationFromPosition(message.startPos, false); if (location == null) return -1; location.restrict(); return message.startPos - location.start; Index: src/debug-delay.js =================================================================== --- src/debug-delay.js (revision 1480) +++ src/debug-delay.js (working copy) @@ -521,7 +521,7 @@ source_position += %FunctionGetScriptSourcePosition(func); // Find line and column for the position in the script and set a script // break point from that. - var location = script.locationFromPosition(source_position); + var location = script.locationFromPosition(source_position, false); return this.setScriptBreakPointById(script.id, location.line, location.column, opt_condition); --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
