LibWeb+WebContent: Initialise JS console from Document::initialize()

Before this change JS console was initialise from
activate_history_entry() which is too late for about:blank documents
that are ready to run scripts immediately after creation.
This commit is contained in:
Aliaksandr Kalenik 2024-04-11 17:21:09 +02:00 committed by Andreas Kling
commit 649f70db65
Notes: sideshowbarker 2024-07-17 07:08:37 +09:00
5 changed files with 14 additions and 9 deletions

View file

@ -378,6 +378,8 @@ void Document::initialize(JS::Realm& realm)
m_selection = heap().allocate<Selection::Selection>(realm, realm, *this);
m_list_of_available_images = heap().allocate<HTML::ListOfAvailableImages>(realm);
page().client().page_did_create_new_document(*this);
}
// https://html.spec.whatwg.org/multipage/document-lifecycle.html#populate-with-html/head/body
@ -3408,6 +3410,10 @@ void Document::make_active()
// 2. Set document's browsing context's WindowProxy's [[Window]] internal slot value to window.
m_browsing_context->window_proxy()->set_window(window);
if (m_browsing_context->is_top_level()) {
page().client().page_did_change_active_document_in_top_level_browsing_context(*this);
}
// 3. Set document's visibility state to document's node navigable's traversable navigable's system visibility state.
if (navigable()) {
m_visibility_state = navigable()->traversable_navigable()->system_visibility_state();