[webkit-changes] [WebKit/WebKit] cc8155: [WebIDL] Default toJSON() method should create res...

Alexey Shvayka noreply at github.com
Mon Sep 19 13:32:43 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cc81559d3d3269a2f28477738c3ec1c13dd5e8e8
      https://github.com/WebKit/WebKit/commit/cc81559d3d3269a2f28477738c3ec1c13dd5e8e8
  Author: Alexey Shvayka <shvaikalesh at gmail.com>
  Date:   2022-09-19 (Mon, 19 Sep 2022)

  Changed paths:
    A LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/default-toJSON-cross-realm-expected.txt
    A LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/default-toJSON-cross-realm.html
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSON.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSONFilteredByExposed.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestNode.cpp

  Log Message:
  -----------
  [WebIDL] Default toJSON() method should create result object in its realm
https://bugs.webkit.org/show_bug.cgi?id=244939

Reviewed by Sam Weinig, Yusuke Suzuki, and Darin Adler.

Per ECMA-262 [1], %Object.prototype% notation points to current realm, which
is the realm of toJSON() function [2], and not the relevant one.

Aligns WebKit with Blink and Gecko.

[1] https://tc39.es/ecma262/#sec-well-known-intrinsic-objects (paragraph 2)
[2] https://webidl.spec.whatwg.org/#default-tojson-steps (step 4)

* LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/default-toJSON-cross-realm-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/WebIDL/ecmascript-binding/default-toJSON-cross-realm.html: Added.
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:
(GenerateDefaultToJSONOperationDefinition):
* Source/WebCore/bindings/scripts/test/JS/*: Updated.

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




More information about the webkit-changes mailing list