From ca2c1299233678cb4fe7fcdb9ded21e8bdde5d0e Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 1 Sep 2021 17:21:48 +0100 Subject: [PATCH] Browser: Reconnect the JS console when the current page changes Previously, it would keep a pointer to the interpreter of the previous page, which resulted in Crashy Fun Times. This also changes the clearing behavior - instead of clearing the console output every time the window is shown, we clear it when the page changes. This is more useful, since before you would lose any log messages that had happened before opening the window. --- Userland/Applications/Browser/Tab.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index 0a292b4119..13deed226b 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -178,11 +178,19 @@ Tab::Tab(BrowserWindow& window) if (m_dom_inspector_widget) m_dom_inspector_widget->clear_dom_json(); + + if (m_console_widget) + m_console_widget->clear_output(); }; 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