0b690227f8
This is a reland of 4363a69335
Original change's description:
> [inspector] fixed location of top level function return
>
> We should pass false as has_braces argument to create FunctionLiteral
> for top level function.
>
> R=dgozman@chromium.org,bmeurer@chromium.org
> TBR=bmeurer@chromium.org
>
> Bug: none
> Change-Id: I397f31b562d32c71f3a12bfc9ceeed16c367aa80
> Reviewed-on: https://chromium-review.googlesource.com/1098018
> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
> Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
> Reviewed-by: Yang Guo <yangguo@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#53769}
TBR=dgozman@chromium.org
Bug: v8:7858
Change-Id: Ie636bc101f9d29d9d40bd10b96e62da6505c2734
Reviewed-on: https://chromium-review.googlesource.com/1104497
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53808}
53 lines
1.0 KiB
JavaScript
53 lines
1.0 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.
|
|
|
|
Debug = debug.Debug
|
|
var exception = null;
|
|
var log = [];
|
|
|
|
function listener(event, exec_state, event_data, data) {
|
|
try {
|
|
if (event == Debug.DebugEvent.Break) {
|
|
var line = exec_state.frame(0).sourceLineText();
|
|
log.push(line);
|
|
if (!/STOP/.test(line)) {
|
|
exec_state.prepareStep(Debug.StepAction.StepIn);
|
|
}
|
|
}
|
|
} catch (e) {
|
|
exception = e;
|
|
}
|
|
};
|
|
|
|
Debug.setListener(listener);
|
|
|
|
Promise.resolve().then(
|
|
function() {
|
|
print(1);
|
|
}
|
|
).then(
|
|
function() {
|
|
return 2;
|
|
}
|
|
).then(
|
|
function() {
|
|
throw new Error();
|
|
}
|
|
).catch(
|
|
function() {
|
|
print(3);
|
|
} // STOP
|
|
);
|
|
|
|
setTimeout(function() {
|
|
Debug.setListener(null);
|
|
assertNull(exception);
|
|
var expectation =
|
|
["debugger;",""," print(1);","}"," return 2;"," return 2;",
|
|
" throw new Error();"," print(3);","} // STOP"];
|
|
assertEquals(log, expectation);
|
|
});
|
|
|
|
debugger;
|