mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-11 02:29:21 +00:00
LibJS: Follow the spec more closely when determining the this value
Co-authored-by: davidot <david.tuin@gmail.com>
This commit is contained in:
parent
a394aa5830
commit
c6e9c6d6ab
Notes:
sideshowbarker
2024-07-18 08:39:36 +09:00
Author: https://github.com/trflynn89
Commit: c6e9c6d6ab
Pull-request: https://github.com/SerenityOS/serenity/pull/8667
Reviewed-by: https://github.com/IdanHo
Reviewed-by: https://github.com/davidot
Reviewed-by: https://github.com/linusg
3 changed files with 36 additions and 11 deletions
|
@ -161,12 +161,8 @@ CallExpression::ThisAndCallee CallExpression::compute_this_and_callee(Interprete
|
|||
return { this_value, callee };
|
||||
}
|
||||
|
||||
if (interpreter.vm().in_strict_mode()) {
|
||||
// If we are in strict mode, |this| should never be bound to global object by default.
|
||||
return { js_undefined(), m_callee->execute(interpreter, global_object) };
|
||||
}
|
||||
|
||||
return { &global_object, m_callee->execute(interpreter, global_object) };
|
||||
// [[Call]] will handle that in non-strict mode the this value becomes the global object
|
||||
return { js_undefined(), m_callee->execute(interpreter, global_object) };
|
||||
}
|
||||
|
||||
// 13.3.8.1 Runtime Semantics: ArgumentListEvaluation, https://tc39.es/ecma262/#sec-runtime-semantics-argumentlistevaluation
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue