diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index cff8665e072..a864fdb1d20 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -699,12 +699,18 @@ void Document::set_origin(HTML::Origin const& origin) void Document::schedule_style_update() { + if (!browsing_context()) + return; + // NOTE: Update of the style is a step in HTML event loop processing. HTML::main_thread_event_loop().schedule(); } void Document::schedule_layout_update() { + if (!browsing_context()) + return; + // NOTE: Update of the layout is a step in HTML event loop processing. HTML::main_thread_event_loop().schedule(); }