Skip to content

Commit 921876d

Browse files
targosMylesBorins
authored andcommitted
deps: backport 071b655 from V8 upstream
Original commit message: [PATCH] [debugger] Scope iterator should not visit inner function literals. [email protected] BUG=chromium:621361 Review-Url: https://codereview.chromium.org/2185913003 Cr-Commit-Position: refs/heads/master@{#38087} Fixes: #15075 PR-URL: #15215 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 8dfc283 commit 921876d

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

deps/v8/include/v8-version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#define V8_MAJOR_VERSION 5
1212
#define V8_MINOR_VERSION 1
1313
#define V8_BUILD_NUMBER 281
14-
#define V8_PATCH_LEVEL 107
14+
#define V8_PATCH_LEVEL 108
1515

1616
// Use 1 for candidates and 0 otherwise.
1717
// (Boolean macro values are not supported by all preprocessors.)

deps/v8/src/debug/debug-scopes.cc

+6
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,12 @@ bool ScopeIterator::CopyContextExtensionToScopeObject(
842842

843843
void ScopeIterator::GetNestedScopeChain(Isolate* isolate, Scope* scope,
844844
int position) {
845+
if (scope->is_function_scope()) {
846+
// Do not collect scopes of nested inner functions inside the current one.
847+
Handle<JSFunction> function =
848+
Handle<JSFunction>::cast(frame_inspector_->GetFunction());
849+
if (scope->end_position() < function->shared()->end_position()) return;
850+
}
845851
if (!scope->is_eval_scope()) {
846852
nested_scope_chain_.Add(ExtendedScopeInfo(scope->GetScopeInfo(isolate),
847853
scope->start_position(),
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
// Copyright 2016 the V8 project authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
// Flags: --expose-debug-as debug
6+
7+
var Debug = debug.Debug;
8+
var steps = 0;
9+
var exception = null;
10+
11+
function listener(event, execState, eventData, data) {
12+
if (event != Debug.DebugEvent.Break) return;
13+
try {
14+
assertEquals([ debug.ScopeType.Local,
15+
debug.ScopeType.Script,
16+
debug.ScopeType.Global],
17+
execState.frame().allScopes().map(s => s.scopeType()));
18+
var x_value = execState.frame().evaluate("x").value();
19+
if (steps < 2) {
20+
assertEquals(undefined, x_value);
21+
execState.prepareStep(Debug.StepAction.StepIn);
22+
} else {
23+
assertEquals("l => l", x_value.toString());
24+
}
25+
steps++;
26+
} catch (e) {
27+
exception = e;
28+
}
29+
}
30+
31+
Debug.setListener(listener);
32+
33+
(function() {
34+
debugger;
35+
var x = l => l;
36+
})();
37+
38+
Debug.setListener(null);
39+
assertNull(exception);
40+
assertEquals(3, steps);

0 commit comments

Comments
 (0)