1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:07:35 +00:00

LibWeb: Replace GlobalObject with VM in CrossOrigin AOs [Part 2/4]

This commit is contained in:
Linus Groh 2022-08-21 21:21:52 +01:00
parent 5f1fe4b012
commit f8fb985b05
4 changed files with 18 additions and 26 deletions

View file

@ -65,8 +65,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_prevent_extensions()
// 7.4.5 [[GetOwnProperty]] ( P ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-getownproperty
JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_get_own_property(JS::PropertyKey const& property_key) const
{
auto& global_object = HTML::current_global_object();
auto& vm = global_object.vm();
auto& vm = this->vm();
// 1. Let W be the value of the [[Window]] internal slot of this.
@ -123,7 +122,7 @@ JS::ThrowCompletionOr<Optional<JS::PropertyDescriptor>> WindowProxy::internal_ge
}
// 7. Return ? CrossOriginPropertyFallback(P).
return TRY(cross_origin_property_fallback(global_object, property_key));
return TRY(cross_origin_property_fallback(vm, property_key));
}
// 7.4.6 [[DefineOwnProperty]] ( P, Desc ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-defineownproperty
@ -152,7 +151,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_define_own_property(JS::Proper
// 7.4.7 [[Get]] ( P, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-get
JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const& property_key, JS::Value receiver) const
{
auto& global_object = HTML::current_global_object();
auto& vm = this->vm();
// 1. Let W be the value of the [[Window]] internal slot of this.
@ -166,13 +165,13 @@ JS::ThrowCompletionOr<JS::Value> WindowProxy::internal_get(JS::PropertyKey const
// 4. Return ? CrossOriginGet(this, P, Receiver).
// NOTE: this is passed rather than W as OrdinaryGet and CrossOriginGet will invoke the [[GetOwnProperty]] internal method.
return cross_origin_get(global_object, *this, property_key, receiver);
return cross_origin_get(vm, *this, property_key, receiver);
}
// 7.4.8 [[Set]] ( P, V, Receiver ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-set
JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& property_key, JS::Value value, JS::Value receiver)
{
auto& global_object = HTML::current_global_object();
auto& vm = this->vm();
// 1. Let W be the value of the [[Window]] internal slot of this.
@ -191,7 +190,7 @@ JS::ThrowCompletionOr<bool> WindowProxy::internal_set(JS::PropertyKey const& pro
// 4. Return ? CrossOriginSet(this, P, V, Receiver).
// NOTE: this is passed rather than W as CrossOriginSet will invoke the [[GetOwnProperty]] internal method.
return cross_origin_set(global_object, *this, property_key, value, receiver);
return cross_origin_set(vm, *this, property_key, value, receiver);
}
// 7.4.9 [[Delete]] ( P ), https://html.spec.whatwg.org/multipage/window-object.html#windowproxy-delete