v8/test/debugger/debug/regress/regress-crbug-517592.js
jgruber 1834ab7246 [debug-wrapper] Adapt tests, breakpoint.actual_location
Adapted various tests to restrictions of inspector protocol:

* osr-typing-debug-change: Don't set function variable value.
* debug-evaluate-locals: Add variable introduced by eval, run typeof
  inside evaluate().
* regress-419663: Don't set duplicate breakpoints.
* regress-crbug-465298: Compare against function name instead of value.
* regress-crbug-621361: Make evaluate return string results.
* debug-script: Various counts were off due to new way tests are called.
                Added new inspector script type.

Breakpoints now contain the actual break position, and remote object
reconstruction has been extended a bit.

BUG=v8:5530

Review-Url: https://codereview.chromium.org/2505363002
Cr-Commit-Position: refs/heads/master@{#41129}
2016-11-21 09:29:17 +00:00

37 lines
877 B
JavaScript

// Copyright 2015 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.
// Flags: --min-preparse-length=10
var source =
"var foo = function foo() {\n" +
" return 1;\n" +
"}\n" +
"//@ sourceURL=test";
Debug = debug.Debug;
Debug.setListener(listener);
var exception = null;
var break_count = 0;
function listener(event, exec_state, event_data, data) {
if (event == Debug.DebugEvent.Break) break_count++;
if (event != Debug.DebugEvent.AfterCompile) return;
try {
var name = event_data.script().name();
var id = event_data.script().id();
assertEquals("test", name);
Debug.setScriptBreakPointById(id, 2);
} catch (e) {
exception = e;
}
}
eval(source);
assertEquals(0, break_count);
foo();
assertEquals(1, break_count);
assertNull(exception);