mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:37:35 +00:00
LibWeb: Move passing of Web object prototypes out of constructors
This commit is contained in:
parent
834202aeb9
commit
af75493883
35 changed files with 157 additions and 23 deletions
|
@ -10,8 +10,8 @@
|
|||
|
||||
namespace Web::Bindings {
|
||||
|
||||
LegacyPlatformObject::LegacyPlatformObject(JS::Object& prototype)
|
||||
: PlatformObject(prototype)
|
||||
LegacyPlatformObject::LegacyPlatformObject(JS::Realm& realm)
|
||||
: PlatformObject(realm)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public:
|
|||
virtual bool is_supported_property_index(u32) const;
|
||||
|
||||
protected:
|
||||
explicit LegacyPlatformObject(JS::Object& prototype);
|
||||
explicit LegacyPlatformObject(JS::Realm& realm);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
23
Userland/Libraries/LibWeb/Bindings/WindowPrototype.cpp
Normal file
23
Userland/Libraries/LibWeb/Bindings/WindowPrototype.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Tim Flynn <trflynn89@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/Realm.h>
|
||||
#include <LibWeb/Bindings/WindowPrototype.h>
|
||||
|
||||
namespace Web::Bindings {
|
||||
|
||||
WindowPrototype::WindowPrototype(JS::Realm& realm)
|
||||
: JS::Object(realm, nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
void WindowPrototype::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::EventTargetPrototype>(realm, "EventTarget"));
|
||||
}
|
||||
|
||||
}
|
|
@ -16,10 +16,10 @@ class WindowPrototype final : public JS::Object {
|
|||
JS_OBJECT(WindowPrototype, JS::Object);
|
||||
|
||||
public:
|
||||
explicit WindowPrototype(JS::Realm& realm)
|
||||
: JS::Object(ConstructWithPrototypeTag::Tag, cached_web_prototype(realm, "EventTarget"))
|
||||
{
|
||||
}
|
||||
explicit WindowPrototype(JS::Realm& realm);
|
||||
|
||||
private:
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue