diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 9ed8e52f74..a89ed290d0 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -1292,7 +1292,13 @@ void BrowsingContext::set_system_visibility_state(VisibilityState visibility_sta // has changed to newState, it must queue a task on the user interaction task source to update // the visibility state of all the Document objects in the top-level browsing context's document family with newState. auto document_family = top_level_browsing_context().document_family(); - queue_global_task(Task::Source::UserInteraction, Bindings::main_thread_vm().current_realm()->global_object(), [visibility_state, document_family = move(document_family)] { + + // From the new navigable version, where it tells us what global object to use here: + // 1. Let document be navigable's active document. + // 2. Queue a global task on the user interaction task source given document's relevant global object to update the visibility state of document with newState. + // FIXME: Update this function to fully match the navigable version. + VERIFY(active_document()); + queue_global_task(Task::Source::UserInteraction, relevant_global_object(*active_document()), [visibility_state, document_family = move(document_family)] { for (auto& document : document_family) { document->update_the_visibility_state(visibility_state); }