1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:37:35 +00:00

Browser: Replace history entry if loading URL because of a redirect

We now replace the current history entry if the page-load has been
caused because of a redirect. This makes it able to traverse the
history if one of the entries redirects you, which previously
caused an infinite history traversion loop.
This commit is contained in:
Baitinq 2022-11-24 01:18:11 +01:00 committed by Andreas Kling
parent b447e486b5
commit f1205b608f
3 changed files with 11 additions and 5 deletions

View file

@ -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);