Commit 61292f0b authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] breakpoint after last break position should not jump to first line

R=jgruber@chromium.org

Bug: chromium:730177
Change-Id: I0f3666a333604cb80bb51410c5edf2aceb0c6ef5
Reviewed-on: https://chromium-review.googlesource.com/717717
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48556}
parent cddaf24c
......@@ -603,8 +603,13 @@ bool Debug::SetBreakPointForScript(Handle<Script> script,
Handle<DebugInfo> debug_info(shared->GetDebugInfo());
// Find the break point and change it.
*source_position = FindBreakablePosition(debug_info, *source_position);
// Find breakable position returns first breakable position after
// *source_position, it can return 0 if no break location is found after
// *source_position.
int breakable_position = FindBreakablePosition(debug_info, *source_position);
if (breakable_position < *source_position) return false;
*source_position = breakable_position;
DebugInfo::SetBreakPoint(debug_info, *source_position, break_point_object);
// At least one active break point now.
DCHECK_LT(0, debug_info->GetBreakPointCount());
......
......@@ -4,7 +4,7 @@
var source =
"var foo = function foo() {\n" +
" return 1;\n" +
" var a = 1;\n" +
"}\n" +
"//@ sourceURL=test";
......
Tests breakpoint at last line.
{
breakpointId : <breakpointId>
locations : [
[0] : {
columnNumber : 12
lineNumber : 3
scriptId : <scriptId>
}
]
}
{
breakpointId : <breakpointId>
locations : [
]
}
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
let {session, contextGroup, Protocol} = InspectorTest.start('Tests breakpoint at last line.');
let source = `
let a = 1;
//# sourceURL=foo.js
let b = 2;
`;
(async function test() {
Protocol.Debugger.enable();
Protocol.Runtime.evaluate({expression: source});
let {result} = await Protocol.Debugger.setBreakpointByUrl({
url: 'foo.js',
lineNumber: 3,
columnNumber: 12
});
InspectorTest.logMessage(result);
({result} = await Protocol.Debugger.setBreakpointByUrl({
url: 'foo.js',
lineNumber: 4
}));
InspectorTest.logMessage(result);
InspectorTest.completeTest();
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment