ScopeIterator skipped scopes that don't declare any variables (other
than the paused function's own scope). Now that ScopeIterator walks the
full lexical scope tree, keep empty scopes, so that the scope chain
reported via CDP (flagged with Debugger.Scope.emptyReason) matches the
lexical scopes, e.g. to match them against scopes in source maps and to
target them via `evaluateOnCallFrame` with `scopeNumber`.
Empty script scopes and empty eval root scopes (which also back wrapped
and Function() functions) are still skipped. [[Scopes]] is unaffected,
since the inspector omits empty scopes there itself.
R=pfaffe@chromium.org
Bug: 545412300
Change-Id: I0a5c0d71e66f7c4f747770c350713ff97dcc38ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8460466
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110382}
Now that DebugScriptScopeInfo provides the full lexical scope tree for
every script, ScopeIterator no longer switches to context-only
iteration when it leaves the paused closure. Instead it keeps walking
DebugScriptScope into outer lexical scopes, including outer scopes
that don't need a context. Stack-allocated variables of such scopes
are reported as unavailable. Iteration falls back to the context chain
once it leaves the root of the scope tree (e.g. for eval and wrapped
functions).
Empty outer scopes are still skipped for now; a follow-up changes that.
[[Scopes]] is unaffected, since the inspector builds it from the runtime
context chain.
- GetFunctionDebugName() returns undefined for outer scopes whose
enclosing function has no context, instead of using the name of an
unrelated closure context.
- DebugEvaluate uses the closest runtime context when targeting an
outer scope without a context (EvaluationContext()), and always wraps
it for contextless target scopes so the scope's blocklist applies,
even if the closest context is the native context. Otherwise
evaluating `x` in a contextless scope that declares `x` would find a
global `x`.
R=pfaffe@chromium.org
Bug: 545412300
Change-Id: Iaee6cfb7e1bee13c0bd6c3ff61d7e9c82a9b8491
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8460005
Reviewed-by: Philip Pfaffe <pfaffe@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#110376}
* Fix setting script-scope variables through inspector by internalizing
their names.
* Reconstruct values of Number, String, and Boolean classes.
* Adapt a couple of tests for API restrictions.
BUG=v8:5530
Review-Url: https://codereview.chromium.org/2512963002
Cr-Commit-Position: refs/heads/master@{#41175}