mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 10:19:03 +03:00
LibJS: Stop coercing this to object in Function's Symbol.hasInstance
This commit is contained in:
parent
6ef56f79bd
commit
e37f96ccfe
Notes:
sideshowbarker
2024-07-18 11:10:56 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/e37f96ccfef Pull-request: https://github.com/SerenityOS/serenity/pull/8346
@ -162,14 +162,7 @@ JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::to_string)
|
||||
// 20.2.3.6 Function.prototype [ @@hasInstance ] ( V ), https://tc39.es/ecma262/#sec-function.prototype-@@hasinstance
|
||||
JS_DEFINE_NATIVE_FUNCTION(FunctionPrototype::symbol_has_instance)
|
||||
{
|
||||
auto* this_object = vm.this_value(global_object).to_object(global_object);
|
||||
if (!this_object)
|
||||
return {};
|
||||
if (!this_object->is_function()) {
|
||||
vm.throw_exception<TypeError>(global_object, ErrorType::NotA, "Function");
|
||||
return {};
|
||||
}
|
||||
return ordinary_has_instance(global_object, vm.argument(0), this_object);
|
||||
return ordinary_has_instance(global_object, vm.argument(0), vm.this_value(global_object));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user