summaryrefslogtreecommitdiff
path: root/deps/v8/test/inspector/debugger/script-with-negative-offset.js
blob: fbc0b34302eb921a07a81ab7d245aa021c178041 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// 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();
})();