v8/test/inspector/debugger/class-private-fields-scopes.js
Joyee Cheung 8eadbe5cb0 [class] hide private name symbols from the block scope in DevTools
Currently, the private name symbols are displayed in the block
scopes in DevTools, though these are just implementation details
of private fields. This patch hides them from the block scope
by marking variables with names starting with `#` as synthetic.

The private fields are still going to show up in the previews
of objects, only the key symbols themselves are going to be hidden.

Bug: v8:8773, chromium:982267
Change-Id: I059472d05c26a1f035ab92718a1b7e5ecafa8dc4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1741846
Reviewed-by: Sathya Gunasekaran  <gsathya@chromium.org>
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Cr-Commit-Position: refs/heads/master@{#63112}
2019-08-07 10:55:38 +00:00

33 lines
788 B
JavaScript

// Copyright 2019 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.
let { session, contextGroup, Protocol } = InspectorTest.start(
"Test private class fields in scopes"
);
contextGroup.addScript(`
function run() {
class A {
#foo = "hello"
constructor () {
debugger;
}
};
new A();
}`);
InspectorTest.runAsyncTestSuite([
async function testScopesPaused() {
Protocol.Debugger.enable();
Protocol.Runtime.evaluate({ expression: "run()" });
let {
params: { callFrames }
} = await Protocol.Debugger.oncePaused(); // inside A()
InspectorTest.logMessage(callFrames);
Protocol.Debugger.resume();
Protocol.Debugger.disable();
}
]);