summaryrefslogtreecommitdiff
path: root/deps/v8/test/inspector/debugger/step-over-another-context-group.js
blob: 758ff84697b35154e4b491d5a1e3f7d6ed199638 (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
32
33
34
35
36
// 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.

InspectorTest.log('Checks stepping with more then one context group.');

var contextGroup1 = new InspectorTest.ContextGroup();
var session1 = contextGroup1.connect();
session1.setupScriptMap();

let contextGroup2 = new InspectorTest.ContextGroup();
let session2 = contextGroup2.connect();
session2.setupScriptMap();

(async function test() {
  await session1.Protocol.Debugger.enable();
  await session2.Protocol.Debugger.enable({});
  session1.Protocol.Runtime.evaluate({expression: 'debugger'});
  session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => { debugger }, 0)'});
  session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => 42, 0)'});
  await waitPauseAndDumpLocation(session1);
  session1.Protocol.Debugger.stepOver();
  await session1.Protocol.Debugger.oncePaused();
  session1.Protocol.Debugger.stepOver();
  await waitPauseAndDumpLocation(session1);
  await session2.Protocol.Debugger.disable({});
  await session1.Protocol.Debugger.disable();
  InspectorTest.completeTest();
})();

async function waitPauseAndDumpLocation(session) {
  var message = await session.Protocol.Debugger.oncePaused();
  InspectorTest.log('paused at:');
  await session.logSourceLocation(message.params.callFrames[0].location);
  return message;
}