[webkit-changes] [WebKit/WebKit] 12544d: [Bindings] Align [[DefineOwnProperty]], [[Set]] & ...

Chris Dumez noreply at github.com
Fri May 26 10:52:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 12544d4187162da11dad0451bceece73a83c4837
      https://github.com/WebKit/WebKit/commit/12544d4187162da11dad0451bceece73a83c4837
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-05-26 (Fri, 26 May 2023)

  Changed paths:
    M LayoutTests/fast/dom/htmlcollection-getownproperty-expected.txt
    M LayoutTests/fast/dom/htmlcollection-getownproperty.html
    M LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-platform-object/DefineOwnProperty-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-platform-object/Set-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-delete-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-own-props-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-supported-property-indices-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-supported-property-names-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TextTrackCueList/getter-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/TextTrackList/getter-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-indexed-element-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/forms/the-form-element/form-nameditem-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webstorage/set.window-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webstorage/storage_builtins.window-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/webstorage/symbol-props.window-expected.txt
    M LayoutTests/js/dom/legacy-platform-object-defineOwnProperty.html
    M Source/WebCore/Modules/mediasource/SourceBufferList.h
    M Source/WebCore/Modules/speech/SpeechRecognitionResult.h
    M Source/WebCore/Modules/speech/SpeechRecognitionResultList.h
    M Source/WebCore/Modules/webxr/WebXRInputSourceArray.h
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestLegacyOverrideBuiltIns.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestLegacyOverrideBuiltIns.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterCallWith.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterThrowingException.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyOverrideBuiltIns.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeableProperties.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNamedSetterWithLegacyUnforgeablePropertiesAndLegacyOverrideBuiltIns.h
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
    M Source/WebCore/css/CSSKeyframesRule.h
    M Source/WebCore/css/CSSRuleList.h
    M Source/WebCore/css/CSSStyleDeclaration.h
    M Source/WebCore/css/DeprecatedCSSOMValueList.h
    M Source/WebCore/css/MediaList.h
    M Source/WebCore/css/StyleSheetList.cpp
    M Source/WebCore/css/StyleSheetList.h
    M Source/WebCore/css/typedom/CSSUnparsedValue.h
    M Source/WebCore/css/typedom/numeric/CSSNumericArray.h
    M Source/WebCore/css/typedom/transform/CSSTransformValue.h
    M Source/WebCore/dom/DOMRectList.h
    M Source/WebCore/dom/DOMStringList.h
    M Source/WebCore/dom/DataTransferItemList.cpp
    M Source/WebCore/dom/DataTransferItemList.h
    M Source/WebCore/dom/NamedNodeMap.cpp
    M Source/WebCore/dom/NamedNodeMap.h
    M Source/WebCore/dom/NodeList.h
    M Source/WebCore/dom/TouchList.h
    M Source/WebCore/fileapi/FileList.h
    M Source/WebCore/html/DOMTokenList.h
    M Source/WebCore/html/HTMLDocument.cpp
    M Source/WebCore/html/HTMLDocument.h
    M Source/WebCore/html/HTMLFormElement.cpp
    M Source/WebCore/html/HTMLFormElement.h
    M Source/WebCore/html/HTMLFrameSetElement.cpp
    M Source/WebCore/html/HTMLFrameSetElement.h
    M Source/WebCore/html/HTMLSelectElement.cpp
    M Source/WebCore/html/HTMLSelectElement.h
    M Source/WebCore/html/track/AudioTrackList.h
    M Source/WebCore/html/track/TextTrackCueList.h
    M Source/WebCore/html/track/TextTrackList.h
    M Source/WebCore/html/track/VTTRegionList.h
    M Source/WebCore/html/track/VideoTrackList.h
    M Source/WebCore/page/UserMessageHandlersNamespace.cpp
    M Source/WebCore/page/UserMessageHandlersNamespace.h
    M Source/WebCore/plugins/DOMMimeTypeArray.cpp
    M Source/WebCore/plugins/DOMMimeTypeArray.h
    M Source/WebCore/plugins/DOMPlugin.cpp
    M Source/WebCore/plugins/DOMPlugin.h
    M Source/WebCore/plugins/DOMPluginArray.cpp
    M Source/WebCore/plugins/DOMPluginArray.h
    M Source/WebCore/svg/properties/SVGList.h

  Log Message:
  -----------
  [Bindings] Align [[DefineOwnProperty]], [[Set]] & [[Delete]] with the Web IDL specification
https://bugs.webkit.org/show_bug.cgi?id=257153

Reviewed by Alexey Shvayka.

Align [[DefineOwnProperty]], [[Set]] & [[Delete]] more closely with the Web IDL
specification for legacy platform objects:
[1] https://webidl.spec.whatwg.org/#legacy-platform-object-defineownproperty
[2] https://webidl.spec.whatwg.org/#legacy-platform-object-set
[3] https://webidl.spec.whatwg.org/#legacy-platform-object-delete

And more importantly, align very closely with Blink and Gecko for better
interoperability.

In particular, the following changes were made:
- We used to not override defineOwnProperty() for IDL interfaces that have
  an indexed/named getter but no indexed/named setter. However, the Web IDL
  specification has special handling for them in [1].
- Per the ECMAScript specification, setting a property is supposed to call
  [[DefineOwnProperty]]. However, JSObject's put()/putByIndex() do not call
  the defineOwnProperty overrides by default (for performance reasons). This
  means that the IDL interfaces overriding defineOwnProperty also need to
  override put()/putByIndex() to call JSC's ordinarySet(), which does end up
  calling the defineOwnProperty override.
- Drop logic that was marking the property as configurable in the generated
  defineOwnProperty() overrides. While the Web IDL specification says to do
  so, it doesn't match the behavior of Blink & Gecko and causes us to fail
  WPT tests.
- The generated defineOwnProperty() overrides were sometimes returning false
  without throwing an exception when in strict mode.
- Update our deleteProperty() overrides to match [3] more closely, especially
  for IDL interfaces with indexed/named getters. In particular, we were missing
  some checks for step 2 of the spec's algorithm.

This fixes a lot of WPT tests which were failing in WebKit only.

This patch tested as performance neutral on Speedometer.

* LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-platform-object/DefineOwnProperty-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/legacy-platform-object/Set-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-delete-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-own-props-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-supported-property-indices-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/collections/HTMLCollection-supported-property-names-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Document-getElementsByTagName-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/dom/nodes/Element-getElementsByTagName-expected.txt:
* Source/WebCore/Modules/mediasource/SourceBufferList.h:
* Source/WebCore/Modules/speech/SpeechRecognitionResult.h:
* Source/WebCore/Modules/speech/SpeechRecognitionResultList.h:
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GeneratePut):
(GeneratePutByIndex):
(GenerateDefineOwnProperty):
(GenerateDeleteProperty):
(GenerateDeletePropertyByIndex):
(GenerateDeletePropertyDefinition):
(InstanceOverridesPut):
(InstanceOverridesDefineOwnProperty):
(InstanceOverridesDeleteProperty):
(GenerateImplementation):
(GenerateNamedDeleterDefinition): Deleted.
* Source/WebCore/css/CSSKeyframesRule.h:
* Source/WebCore/css/CSSRuleList.h:
(WebCore::CSSRuleList::isSupportedPropertyIndex const):
* Source/WebCore/css/CSSStyleDeclaration.h:
(WebCore::CSSStyleDeclaration::isSupportedPropertyIndex const):
* Source/WebCore/css/DeprecatedCSSOMValueList.h:
(WebCore::DeprecatedCSSOMValueList::isSupportedPropertyIndex const):
* Source/WebCore/css/MediaList.h:
* Source/WebCore/css/StyleSheetList.cpp:
(WebCore::StyleSheetList::isSupportedPropertyName const):
* Source/WebCore/css/StyleSheetList.h:
* Source/WebCore/css/typedom/CSSUnparsedValue.h:
* Source/WebCore/css/typedom/numeric/CSSNumericArray.h:
(WebCore::CSSNumericArray::isSupportedPropertyIndex const):
* Source/WebCore/css/typedom/transform/CSSTransformValue.h:
* Source/WebCore/dom/DOMRectList.h:
(WebCore::DOMRectList::isSupportedPropertyIndex const):
* Source/WebCore/dom/DOMStringList.h:
(WebCore::DOMStringList::isSupportedPropertyIndex const):
* Source/WebCore/dom/DataTransferItemList.cpp:
(WebCore::DataTransferItemList::isSupportedPropertyIndex):
* Source/WebCore/dom/DataTransferItemList.h:
* Source/WebCore/dom/NamedNodeMap.cpp:
(WebCore::NamedNodeMap::isSupportedPropertyName const):
* Source/WebCore/dom/NamedNodeMap.h:
* Source/WebCore/dom/NodeList.h:
(WebCore::NodeList::isSupportedPropertyIndex const):
* Source/WebCore/fileapi/FileList.h:
* Source/WebCore/html/DOMTokenList.h:
(WebCore::DOMTokenList::isSupportedPropertyIndex const):
* Source/WebCore/html/HTMLDocument.cpp:
(WebCore::HTMLDocument::isSupportedPropertyName const):
* Source/WebCore/html/HTMLDocument.h:
* Source/WebCore/html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::isSupportedPropertyName):
* Source/WebCore/html/HTMLFormElement.h:
* Source/WebCore/html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::isSupportedPropertyName):
* Source/WebCore/html/HTMLFrameSetElement.h:
* Source/WebCore/html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::isSupportedPropertyIndex):
* Source/WebCore/html/HTMLSelectElement.h:
* Source/WebCore/html/track/AudioTrackList.h:
* Source/WebCore/html/track/TextTrackCueList.h:
(WebCore::TextTrackCueList::isSupportedPropertyIndex const):
* Source/WebCore/html/track/TextTrackList.h:
* Source/WebCore/html/track/VTTRegionList.h:
(WebCore::VTTRegionList::isSupportedPropertyIndex const):
* Source/WebCore/html/track/VideoTrackList.h:
* Source/WebCore/page/UserMessageHandlersNamespace.cpp:
(WebCore::UserMessageHandlersNamespace::isSupportedPropertyName):
* Source/WebCore/page/UserMessageHandlersNamespace.h:
* Source/WebCore/plugins/DOMMimeTypeArray.cpp:
(WebCore::DOMMimeTypeArray::isSupportedPropertyName const):
* Source/WebCore/plugins/DOMMimeTypeArray.h:
* Source/WebCore/plugins/DOMPlugin.cpp:
(WebCore::DOMPlugin::isSupportedPropertyName const):
* Source/WebCore/plugins/DOMPlugin.h:
* Source/WebCore/plugins/DOMPluginArray.cpp:
(WebCore::DOMPluginArray::isSupportedPropertyName const):
* Source/WebCore/plugins/DOMPluginArray.h:
* Source/WebCore/svg/properties/SVGList.h:
(WebCore::SVGList::isSupportedPropertyIndex const):

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




More information about the webkit-changes mailing list