Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
String.prototype.includes incorrectly returns false when string is em…
…pty 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
- Loading branch information
1 parent
aef5784
commit ebf196e
Showing
3 changed files
with
32 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters