[inspector] Disable [[Scopes]] internal property

We don't remove the code just yet in case we need to re-enable the
feature. This could be in case we discover workflows not covered by
the "Scope View" and the scopes we report on "Debugger.paused".

R=kimanh@chromium.org

Bug: chromium:1365858
Change-Id: I636cc861af932156944a3f6e0a149cce0f939329
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3905185
Reviewed-by: Kim-Anh Tran <kimanh@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83379}
This commit is contained in:
Simon Zünd 2022-09-20 12:26:43 +02:00 committed by V8 LUCI CQ
parent 5110b3c6cc
commit 735401e1fb
8 changed files with 20 additions and 0 deletions

View File

@ -1434,6 +1434,10 @@ bool isExperimentalAsyncStackTaggingApiEnabled() {
return i::v8_flags.experimental_async_stack_tagging_api;
}
bool isExperimentalRemoveInternalScopesPropertyEnabled() {
return i::v8_flags.experimental_remove_internal_scopes_property;
}
void RecordAsyncStackTaggingCreateTaskCall(v8::Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
isolate->CountUsage(v8::Isolate::kAsyncStackTaggingCreateTaskCall);

View File

@ -732,6 +732,7 @@ AccessorPair* AccessorPair::Cast(v8::Value* value) {
MaybeLocal<Message> GetMessageFromPromise(Local<Promise> promise);
bool isExperimentalAsyncStackTaggingApiEnabled();
bool isExperimentalRemoveInternalScopesPropertyEnabled();
void RecordAsyncStackTaggingCreateTaskCall(v8::Isolate* isolate);

View File

@ -1701,6 +1701,8 @@ DEFINE_BOOL(experimental_value_unavailable, false,
DEFINE_BOOL(
live_edit_top_frame, true,
"enable support for live-editing the top-most function on the stack")
DEFINE_BOOL(experimental_remove_internal_scopes_property, true,
"don't report the artificial [[Scopes]] property for functions")
// disassembler
DEFINE_BOOL(log_colour, ENABLE_LOG_COLOUR,

View File

@ -786,6 +786,11 @@ v8::MaybeLocal<v8::Array> V8Debugger::internalProperties(
toV8StringInternalized(m_isolate, "[[Entries]]"));
createDataProperty(context, properties, properties->Length(), entries);
}
if (v8::debug::isExperimentalRemoveInternalScopesPropertyEnabled()) {
return properties;
}
if (value->IsGeneratorObject()) {
v8::Local<v8::Value> scopes;
if (generatorScopes(context, value).ToLocal(&scopes)) {

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-experimental-remove-internal-scopes-property
let {session, contextGroup, Protocol} = InspectorTest.start('Tests that suspended generators produce scopes');
contextGroup.addScript(`

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-experimental-remove-internal-scopes-property
const {Protocol} = InspectorTest.start('Don\'t crash when getting the properties of a native function');
(async () => {

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-experimental-remove-internal-scopes-property
let {session, contextGroup, Protocol} = InspectorTest.start('Checks [[Scopes]] for functions');
contextGroup.addScript(`

View File

@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --no-experimental-remove-internal-scopes-property
let {session, contextGroup, Protocol} = InspectorTest.start('Checks internal properties in Runtime.getProperties output');
contextGroup.addScript(`