[webkit-changes] [WebKit/WebKit] b035cb: Merge 254319 at main - String.prototype.includes inco...
Darin Adler
noreply at github.com
Tue Sep 13 07:28:13 PDT 2022
Branch: refs/heads/webkitgtk/2.36
Home: https://github.com/WebKit/WebKit
Commit: b035cb601f5863ffff0404ce96789a70abbea082
https://github.com/WebKit/WebKit/commit/b035cb601f5863ffff0404ce96789a70abbea082
Author: Darin Adler <darin at apple.com>
Date: 2022-09-13 (Tue, 13 Sep 2022)
Changed paths:
M LayoutTests/js/script-tests/string-includes.js
M LayoutTests/js/string-includes-expected.txt
M Source/JavaScriptCore/runtime/StringPrototype.cpp
Log Message:
-----------
Merge 254319 at main - String.prototype.includes incorrectly returns false when string is empty and position is past end of string
https://bugs.webkit.org/show_bug.cgi?id=244196
Reviewed by Alexey Shvayka.
Added length clamping to the Int32 special case of the startsWith
and includes functions. These functions could be optimized for all sorts
of cases including not fetching string lengths multiple times, and even
optimizing rope cases to not require resolving the whole rope, but for now
didn't worry about any of that, just added that bit of extra checking.
* LayoutTests/js/script-tests/string-includes.js: Added test cases.
* LayoutTests/js/string-includes-expected.txt: Added expected result.
* Source/JavaScriptCore/runtime/StringPrototype.cpp:
(JSC::stringProtoFuncStartsWith): Added clamping to the Int32 special case.
(JSC::stringProtoFuncEndsWith): Refactored clamping to match startsWith
and includes, which removes one redudant clamp.
(JSC::stringIncludesImpl): Added clamping to the Int32 special case.
Canonical link: https://commits.webkit.org/254319@main
(cherry picked from commit ebf196ed572433cb92280dac2a1d62a57ce773b5)
More information about the webkit-changes
mailing list