[webkit-changes] [WebKit/WebKit] f0420f: [JSC] Replace narrow no-break space and thin space...

Yusuke Suzuki noreply at github.com
Sun Feb 12 22:50:06 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f0420f3bf5b9316e4871996ebda2a1cc0191096a
      https://github.com/WebKit/WebKit/commit/f0420f3bf5b9316e4871996ebda2a1cc0191096a
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-02-12 (Sun, 12 Feb 2023)

  Changed paths:
    A JSTests/stress/intl-datetimeformat-en-do-not-include-special-spaces.js
    M JSTests/test262/expectations.yaml
    M Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp
    M Source/WTF/wtf/unicode/CharacterNames.h

  Log Message:
  -----------
  [JSC] Replace narrow no-break space and thin space with normal space in Intl.DateTimeFormat output
https://bugs.webkit.org/show_bug.cgi?id=252147
rdar://105375286

Reviewed by Ross Kirsling.

ICU 72 replaces normal spaces with narrow no-break spaces and thin spaces for Intl.DateTimeFormat output.
However, a lot of real world code (websites[1], Node.js modules[2] etc.) strongly assumes that this output
only contains normal spaces and these code stops working because of parsing failures. This behavior change
unfortunately caused massive web-compat problems.

As a workaround for this ICU 72 issue, we scan the output string and replace narrow no-break spaces and thin
spaces with normal spaces. This behavior is aligned to SpiderMonkey[3] and V8[4].

[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1806042
[2]: https://github.com/nodejs/node/issues/46123
[3]: https://hg.mozilla.org/mozilla-central/rev/40e2c54d5618
[4]: https://chromium.googlesource.com/v8/v8/+/bab790f9165f65a44845b4383c8df7c6c32cf4b3

* JSTests/stress/intl-datetimeformat-en-do-not-include-special-spaces.js: Added.
(shouldBe):
(test):
(let.date2.new.Date):
(fmt.formatToParts.date1.forEach):
(date2.forEach):
* Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp:
(JSC::replaceNarrowNoBreakSpaceOrThinSpaceWithNormalSpace):
(JSC::IntlDateTimeFormat::format const):
(JSC::IntlDateTimeFormat::formatToParts const):
(JSC::IntlDateTimeFormat::formatRange):
(JSC::IntlDateTimeFormat::formatRangeToParts):
* Source/WTF/wtf/unicode/CharacterNames.h:

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




More information about the webkit-changes mailing list