[webkit-changes] [WebKit/WebKit] 6ccd74: [JSC] Implement String#isWellFormed and String#toW...

Yusuke Suzuki noreply at github.com
Thu Dec 1 12:20:11 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6ccd7405a513dab05d5a59359330af76e177f968
      https://github.com/WebKit/WebKit/commit/6ccd7405a513dab05d5a59359330af76e177f968
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2022-12-01 (Thu, 01 Dec 2022)

  Changed paths:
    A JSTests/stress/string-well-formed.js
    M LayoutTests/js/Object-getOwnPropertyNames-expected.txt
    M LayoutTests/js/script-tests/Object-getOwnPropertyNames.js
    M Source/JavaScriptCore/runtime/CommonIdentifiers.h
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/runtime/StringPrototype.cpp

  Log Message:
  -----------
  [JSC] Implement String#isWellFormed and String#toWellFormed
https://bugs.webkit.org/show_bug.cgi?id=248588
rdar://problem/102849210

Reviewed by Ross Kirsling.

This patch implements String#isWellFormed and String#toWellFormed proposal[1].
String#isWellFormed returns true if String does not have wrong surrogate pairs (e.g. non-paired surrogate).
String#toWellFormed returns a string, which replaces non well-formed characters with unicode replacement character (\ufffd).

[1]: https://github.com/tc39/proposal-is-usv-string

* JSTests/stress/string-well-formed.js: Added.
(shouldBe):
* LayoutTests/js/Object-getOwnPropertyNames-expected.txt:
* LayoutTests/js/script-tests/Object-getOwnPropertyNames.js:
* Source/JavaScriptCore/runtime/CommonIdentifiers.h:
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::StringPrototype::finishCreation):
(JSC::nonWellFormedIndex):
(JSC::JSC_DEFINE_HOST_FUNCTION):

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




More information about the webkit-changes mailing list