[webkit-changes] [WebKit/WebKit] 23551a: Generated attribute setters for nullable types fai...

Ryan Reno noreply at github.com
Wed Aug 9 08:08:15 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 23551a03b824a73d7f0b63db00a35706701324f5
      https://github.com/WebKit/WebKit/commit/23551a03b824a73d7f0b63db00a35706701324f5
  Author: Ryan Reno <rreno at apple.com>
  Date:   2023-08-09 (Wed, 09 Aug 2023)

  Changed paths:
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
    M Source/WebCore/bindings/scripts/test/TestObj.idl

  Log Message:
  -----------
  Generated attribute setters for nullable types fail when passing null.
https://bugs.webkit.org/show_bug.cgi?id=259947
rdar://113591277

Reviewed by Chris Dumez.

We aren't allowing `null` as an attribute value in the setter for
nullable enum attributes. This change will check if the attribute is
nullable in the code generator and if so generate C++ code which will
call the native implementation of the setter with `std::nullopt` when
passed `null` in the JS code.

Preserves the existing behavior for non-nullable attributes.

* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateAttributeSetterBodyDefinition):
* Source/WebCore/bindings/scripts/test:
    Added an attribute to TestObj to check the output of the generator for
    nullable enum type attributes.

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




More information about the webkit-changes mailing list