mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
LibJS: Add [[GlobalThisValue]] internal slot to GlobalEnvironment
Instead of hardcoding the environment's global object as the return value of GlobalEnvironment::global_this_value(), it now stores an Object reference which is passed to the constructor for this purpose. From the spec (https://tc39.es/ecma262/#sec-global-environment-records): [[GlobalThisValue]] | Object | The value returned by this in global scope. Hosts may provide any ECMAScript Object value.
This commit is contained in:
parent
2b8d5696ab
commit
1e79934acf
4 changed files with 13 additions and 18 deletions
|
@ -647,7 +647,7 @@ void VM::ordinary_call_bind_this(FunctionObject& function, ExecutionContext& cal
|
|||
this_value = this_argument;
|
||||
} else if (this_argument.is_nullish()) {
|
||||
auto& global_environment = callee_realm->environment();
|
||||
this_value = global_environment.global_this_value();
|
||||
this_value = &global_environment.global_this_value();
|
||||
} else {
|
||||
this_value = this_argument.to_object(function.global_object());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue