1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-15 09:54:57 +00:00

LibJS: Allow null or undefined as a bound |this| value in strict mode

This commit is contained in:
Jack Karamanian 2020-06-02 21:26:35 -05:00 committed by Andreas Kling
parent 870bcaeef6
commit b0932b0aec
2 changed files with 12 additions and 9 deletions

View file

@ -57,7 +57,8 @@ BoundFunction* Function::bind(Value bound_this_value, Vector<Value> arguments)
switch (bound_this_value.type()) {
case Value::Type::Undefined:
case Value::Type::Null:
// FIXME: Null or undefined should be passed through in strict mode.
if (interpreter().in_strict_mode())
return bound_this_value;
return &interpreter().global_object();
default:
return bound_this_value.to_object(interpreter());