1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:57:44 +00:00

LibWeb: Use prototype and constructor methods from new Intrinsics

This will let us remove the helpers from Window that simply defer to the
Intrinsics that are hanging off the [[HostDefined]] slot on the realm
This commit is contained in:
Andrew Kaster 2022-09-30 17:40:20 -06:00 committed by Linus Groh
parent beb3519a49
commit f1367e0e4c
10 changed files with 19 additions and 31 deletions

View file

@ -4,10 +4,9 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibJS/Runtime/GlobalObject.h>
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/Bindings/WindowConstructor.h>
#include <LibWeb/Bindings/WindowPrototype.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {
@ -31,10 +30,9 @@ JS::ThrowCompletionOr<JS::Object*> WindowConstructor::construct(FunctionObject&)
void WindowConstructor::initialize(JS::Realm& realm)
{
auto& vm = this->vm();
auto& window = verify_cast<HTML::Window>(realm.global_object());
NativeFunction::initialize(realm);
define_direct_property(vm.names.prototype, &window.cached_web_prototype("Window"), 0);
define_direct_property(vm.names.prototype, &cached_web_prototype(realm, "Window"), 0);
define_direct_property(vm.names.length, JS::Value(0), JS::Attribute::Configurable);
}