6a65e6deef
V8 provides ScriptCompiler::CompileFunctionInContext method which takes expression and compile it as anonymous function like (function() .. expression ..). To produce correct locations for stmts inside of this expression V8 compile this function with negative offset. Instead of stmt position blackboxing use function start position which is negative in described case. Bug: chromium:705963 Change-Id: I86b113198fb59e77b3bbf523c8cd943e22f8a6ca Reviewed-on: https://chromium-review.googlesource.com/519384 Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Cr-Commit-Position: refs/heads/master@{#45637}
32 lines
1.1 KiB
JavaScript
32 lines
1.1 KiB
JavaScript
// 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('Locations in script with negative offset.');
|
|
|
|
(async function test() {
|
|
contextGroup.addScript(`function foo() { debugger; }
|
|
function boo(){ debugger; }
|
|
`, -1, -1);
|
|
session.setupScriptMap();
|
|
Protocol.Debugger.enable();
|
|
let {params:{scriptId}} = await Protocol.Debugger.onceScriptParsed();
|
|
let {result:{locations}} = await Protocol.Debugger.getPossibleBreakpoints({
|
|
start: {scriptId, lineNumber: 0, columnNumber: 0}
|
|
});
|
|
InspectorTest.logMessage(locations);
|
|
|
|
Protocol.Runtime.evaluate({expression: 'foo()'});
|
|
var {params:{callFrames}} = await Protocol.Debugger.oncePaused();
|
|
session.logCallFrames(callFrames);
|
|
await Protocol.Debugger.resume();
|
|
|
|
Protocol.Runtime.evaluate({expression: 'boo()'});
|
|
var {params:{callFrames}} = await Protocol.Debugger.oncePaused();
|
|
session.logCallFrames(callFrames);
|
|
await Protocol.Debugger.resume();
|
|
|
|
InspectorTest.completeTest();
|
|
})();
|