diff --git a/Userland/Applications/Browser/Tab.cpp b/Userland/Applications/Browser/Tab.cpp index ec0c910366..8f725f100c 100644 --- a/Userland/Applications/Browser/Tab.cpp +++ b/Userland/Applications/Browser/Tab.cpp @@ -202,10 +202,16 @@ Tab::Tab(BrowserWindow& window) m_bookmark_button->set_icon(g_icon_bag.bookmark_contour); m_bookmark_button->set_fixed_size(22, 22); - view().on_load_start = [this](auto& url) { + view().on_load_start = [this](auto& url, bool is_redirect) { m_navigating_url = url; m_loaded = false; + // If we are loading due to a redirect, we replace the current history entry + // with the loaded URL + if (is_redirect) { + m_history.replace_current(url, title()); + } + update_status(); m_location_box->set_icon(nullptr); diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp index ed6185983c..ecea4dcc4d 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.cpp @@ -298,11 +298,11 @@ void OutOfProcessWebView::notify_server_did_middle_click_link(Badge, const AK::URL& url, bool) +void OutOfProcessWebView::notify_server_did_start_loading(Badge, const AK::URL& url, bool is_redirect) { m_url = url; if (on_load_start) - on_load_start(url); + on_load_start(url, is_redirect); } void OutOfProcessWebView::notify_server_did_finish_loading(Badge, const AK::URL& url) diff --git a/Userland/Libraries/LibWebView/OutOfProcessWebView.h b/Userland/Libraries/LibWebView/OutOfProcessWebView.h index 34e5424dbb..b9eba07fb8 100644 --- a/Userland/Libraries/LibWebView/OutOfProcessWebView.h +++ b/Userland/Libraries/LibWebView/OutOfProcessWebView.h @@ -86,7 +86,7 @@ public: Function on_link_middle_click; Function on_link_hover; Function on_title_change; - Function on_load_start; + Function on_load_start; Function on_load_finish; Function on_navigate_back; Function on_navigate_forward; @@ -151,7 +151,7 @@ private: virtual void notify_server_did_unhover_link(Badge) override; virtual void notify_server_did_click_link(Badge, const AK::URL&, String const& target, unsigned modifiers) override; virtual void notify_server_did_middle_click_link(Badge, const AK::URL&, String const& target, unsigned modifiers) override; - virtual void notify_server_did_start_loading(Badge, const AK::URL&, bool is_redirect) override; + virtual void notify_server_did_start_loading(Badge, const AK::URL&, bool) override; virtual void notify_server_did_finish_loading(Badge, const AK::URL&) override; virtual void notify_server_did_request_navigate_back(Badge) override; virtual void notify_server_did_request_navigate_forward(Badge) override;