summaryrefslogtreecommitdiff
path: root/deps/v8/test/inspector/debugger/disable-agent-on-pause.js
blob: 6b1f33f93a1c361ac9316d0b2b9b76a7497980ac (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
// Copyright 2018 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(
  'Checks that it is possible to disable agent on pause.');

contextGroup.addScript(`
function foo() {
  return 42;
}`, 0, 0, 'test.js');

(async function test() {
  Protocol.Debugger.enable();
  InspectorTest.log('set breakpoint, call foo, wait for pause..');
  let {result:{breakpointId}} = await Protocol.Debugger.setBreakpointByUrl({
    lineNumber: 2, url: 'test.js'});
  const finished = Protocol.Runtime.evaluate({
    expression: 'foo()//# sourceURL=expr.js'
  });
  const {params:{callFrames:[topFrame]}} = await Protocol.Debugger.oncePaused();
  InspectorTest.log('disable agent..');
  Protocol.Debugger.disable();
  await finished;
  InspectorTest.log('call finished');
  InspectorTest.completeTest();
})();