mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:27:35 +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
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…
Add table
Add a link
Reference in a new issue