mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
LibJS: Stop early-returning on missing searchString in String.startsWith
A missing searchString is allowed by the specification and is treated as js_undefined. ("undefined test".startsWith() => true)
This commit is contained in:
parent
81d7d68416
commit
b1e5330e64
Notes:
sideshowbarker
2024-07-18 19:21:11 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/b1e5330e645 Pull-request: https://github.com/SerenityOS/serenity/pull/6517
1 changed files with 2 additions and 2 deletions
|
@ -179,11 +179,11 @@ JS_DEFINE_NATIVE_FUNCTION(StringPrototype::starts_with)
|
|||
auto string = ak_string_from(vm, global_object);
|
||||
if (string.is_null())
|
||||
return {};
|
||||
if (!vm.argument_count())
|
||||
return Value(false);
|
||||
|
||||
auto search_string = vm.argument(0).to_string(global_object);
|
||||
if (vm.exception())
|
||||
return {};
|
||||
|
||||
auto string_length = string.length();
|
||||
auto search_string_length = search_string.length();
|
||||
size_t start = 0;
|
||||
|
|
Loading…
Reference in a new issue