summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/RequestIdleCallback
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-10 06:28:20 -0500
committerAndreas Kling <kling@serenityos.org>2023-01-10 16:08:14 +0100
commit834202aeb9a47c544ab4e61deb813de50bc03946 (patch)
treec120e9231fa5451b527131f6e423fac2645253bb /Userland/Libraries/LibWeb/RequestIdleCallback
parent7bd8fd000f3f8e92ff632be2370a279ac2309250 (diff)
downloadserenity-834202aeb9a47c544ab4e61deb813de50bc03946.zip
LibWeb: Move setting of Web object prototypes to initialize()
This needs to happen before prototype/constructor intitialization can be made lazy. Otherwise, GC could run during the C++ constructor and try to collect the object currently being created.
Diffstat (limited to 'Userland/Libraries/LibWeb/RequestIdleCallback')
-rw-r--r--Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp7
-rw-r--r--Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
index 9fa2c62674..b0d6fb123d 100644
--- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
+++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.cpp
@@ -21,7 +21,12 @@ IdleDeadline::IdleDeadline(JS::Realm& realm, bool did_timeout)
: PlatformObject(realm)
, m_did_timeout(did_timeout)
{
- set_prototype(&Bindings::cached_web_prototype(realm, "IdleDeadline"));
+}
+
+void IdleDeadline::initialize(JS::Realm& realm)
+{
+ Base::initialize(realm);
+ set_prototype(&Bindings::ensure_web_prototype<Bindings::IdleDeadlinePrototype>(realm, "IdleDeadline"));
}
IdleDeadline::~IdleDeadline() = default;
diff --git a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
index 23d546889b..d703a9c620 100644
--- a/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
+++ b/Userland/Libraries/LibWeb/RequestIdleCallback/IdleDeadline.h
@@ -24,6 +24,8 @@ public:
private:
IdleDeadline(JS::Realm&, bool did_timeout);
+ virtual void initialize(JS::Realm&) override;
+
bool m_did_timeout { false };
};