1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:48:12 +00:00

LibWeb: Remove unecessary dependence on Window from assorted classes

These classes only needed Window to get at its realm. Pass a realm
directly to construct Crypto, Encoding, HRT, IntersectionObserver,
NavigationTiming, Page, RequestIdleCallback, Selection, Streams, URL,
and XML classes.
This commit is contained in:
Andrew Kaster 2022-09-25 18:11:21 -06:00 committed by Linus Groh
parent 4878a18ee7
commit 4bb6345b2f
30 changed files with 125 additions and 126 deletions

View file

@ -658,7 +658,7 @@ void Window::invoke_idle_callbacks()
// 1. Pop the top callback from window's list of runnable idle callbacks.
auto callback = m_runnable_idle_callbacks.take_first();
// 2. Let deadlineArg be a new IdleDeadline whose [get deadline time algorithm] is getDeadline.
auto deadline_arg = RequestIdleCallback::IdleDeadline::create(*this);
auto deadline_arg = RequestIdleCallback::IdleDeadline::create(realm());
// 3. Call callback with deadlineArg as its argument. If an uncaught runtime script error occurs, then report the exception.
auto result = callback->invoke(deadline_arg);
if (result.is_error())
@ -744,7 +744,7 @@ void Window::initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>)
Object::set_prototype(&Bindings::ensure_web_prototype<Bindings::WindowPrototype>(realm, "Window"));
m_crypto = Crypto::Crypto::create(*this);
m_crypto = Crypto::Crypto::create(realm);
// FIXME: These should be native accessors, not properties
define_direct_property("window", this, JS::Attribute::Enumerable);