mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:57:35 +00:00
Browser+WebContent: Initialize WebContentConsoleClient earlier
With this patch, we now initialize the `WebContentConsoleClient` as soon as the Page has loaded, instead of waiting for the Console Window to be shown. This finally lets us see log messages that happened before the window was opened! :^) However, it is not perfect. Waiting until the page has loaded means we lose any messages that happen *during* page load. Ideally we would initialize the WCCC when the page *starts* loading instead, but it requires that the page has a document and interpreter assigned and accessible. As far as I can tell with my limited knowledge, this is not the case until the page has completed loading.
This commit is contained in:
parent
703bd4c9da
commit
95aa6562db
2 changed files with 3 additions and 6 deletions
|
@ -186,11 +186,6 @@ Tab::Tab(BrowserWindow& window)
|
|||
hooks().on_load_finish = [this](auto&) {
|
||||
if (m_dom_inspector_widget)
|
||||
m_web_content_view->inspect_dom_tree();
|
||||
|
||||
// FIXME: This is called after the page has finished loading, which means any log messages
|
||||
// that happen *while* it is loading (such as inline <script>s) will be lost.
|
||||
if (m_console_widget)
|
||||
m_web_content_view->js_console_initialize();
|
||||
};
|
||||
|
||||
hooks().on_link_click = [this](auto& url, auto& target, unsigned modifiers) {
|
||||
|
@ -528,7 +523,6 @@ void Tab::show_console_window()
|
|||
m_console_widget->on_request_messages = [this](i32 start_index) {
|
||||
m_web_content_view->js_console_request_messages(start_index);
|
||||
};
|
||||
m_web_content_view->js_console_initialize();
|
||||
}
|
||||
|
||||
auto* window = m_console_widget->window();
|
||||
|
|
|
@ -151,6 +151,9 @@ void PageHost::page_did_start_loading(const URL& url)
|
|||
|
||||
void PageHost::page_did_finish_loading(const URL& url)
|
||||
{
|
||||
// FIXME: This is called after the page has finished loading, which means any log messages
|
||||
// that happen *while* it is loading (such as inline <script>s) will be lost.
|
||||
m_client.initialize_js_console({});
|
||||
m_client.async_did_finish_loading(url);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue