[webkit-changes] [WebKit/WebKit] eba01b: Web Inspector: objects can have multiple private f...

Devin Rousso noreply at github.com
Wed Aug 30 21:41:57 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: eba01be516e6823677fedb7e3676d3e2cef5914e
      https://github.com/WebKit/WebKit/commit/eba01be516e6823677fedb7e3676d3e2cef5914e
  Author: Devin Rousso <hi at devinrousso.com>
  Date:   2023-08-30 (Wed, 30 Aug 2023)

  Changed paths:
    M LayoutTests/inspector/runtime/getDisplayableProperties-expected.txt
    M LayoutTests/inspector/runtime/getDisplayableProperties.html
    M LayoutTests/inspector/runtime/getProperties-expected.txt
    M LayoutTests/inspector/runtime/getProperties.html
    M LayoutTests/inspector/runtime/resources/property-descriptor-utilities.js
    M Source/JavaScriptCore/inspector/InjectedScriptSource.js
    M Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp
    M Source/JavaScriptCore/inspector/JSInjectedScriptHost.h
    M Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp

  Log Message:
  -----------
  Web Inspector: objects can have multiple private fields with the same name
https://bugs.webkit.org/show_bug.cgi?id=256319

Reviewed by Patrick Angle.

We should show all private fields for an object, not just the most recently defined one for each name.

Developers will be able to identify the value for `this.#foo` by looking for the last `#foo` in the list, as private fields must be declared as part of the `class` definition, meaning they will be created in that order.

* Source/JavaScriptCore/inspector/JSInjectedScriptHost.h:
* Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp:
(Inspector::JSInjectedScriptHost::getOwnPrivatePropertySymbols): Added.
(Inspector::JSInjectedScriptHost::getOwnPrivatePropertyDescriptors): Deleted.
* Source/JavaScriptCore/inspector/JSInjectedScriptHostPrototype.cpp:
(Inspector::JSInjectedScriptHostPrototype::finishCreation):
(Inspector::jsInjectedScriptHostPrototypeFunctionGetOwnPrivatePropertySymbols): Added.
(Inspector::jsInjectedScriptHostPrototypeFunctionGetOwnPrivatePropertyDescriptors): Deleted.
Instead of returning an object keyed by the stringified private symbol, mimic `Object.getOwnPropertySymbols` to just return the list of all private field symbols.
We can then use the existing code that calls `Object.getOwnPropertyDescriptor` (instead of doing that manually in C++).

* Source/JavaScriptCore/inspector/InjectedScriptSource.js:
(InjectedScript.prototype._forEachPropertyDescriptor.processProperty):
(InjectedScript.prototype._forEachPropertyDescriptor):
Since we're now using `Symbol`, differentiate private fields from regular (public) `Symbol` properties.

* LayoutTests/inspector/runtime/resources/property-descriptor-utilities.js:
* LayoutTests/inspector/runtime/getDisplayableProperties.html:
* LayoutTests/inspector/runtime/getDisplayableProperties-expected.txt:
* LayoutTests/inspector/runtime/getProperties.html:
* LayoutTests/inspector/runtime/getProperties-expected.txt:

Canonical link: https://commits.webkit.org/267483@main




More information about the webkit-changes mailing list