mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:17:36 +00:00
Ladybird: 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. Depends on https://github.com/SerenityOS/serenity/pull/16004
This commit is contained in:
parent
ec55b13e96
commit
97dd5a085f
3 changed files with 11 additions and 5 deletions
|
@ -81,7 +81,13 @@ Tab::Tab(BrowserWindow* window, int webdriver_fd_passing_socket)
|
||||||
forward();
|
forward();
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(m_view, &WebContentView::load_started, [this](const URL& url) {
|
QObject::connect(m_view, &WebContentView::load_started, [this](const URL& url, bool is_redirect) {
|
||||||
|
// 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, m_title.toUtf8().data());
|
||||||
|
}
|
||||||
|
|
||||||
m_location_edit->setText(url.to_string().characters());
|
m_location_edit->setText(url.to_string().characters());
|
||||||
|
|
||||||
// Don't add to history if back or forward is pressed
|
// Don't add to history if back or forward is pressed
|
||||||
|
|
|
@ -802,10 +802,10 @@ void WebContentView::notify_server_did_middle_click_link(Badge<WebContentClient>
|
||||||
(void)modifiers;
|
(void)modifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentView::notify_server_did_start_loading(Badge<WebContentClient>, AK::URL const& url)
|
void WebContentView::notify_server_did_start_loading(Badge<WebContentClient>, AK::URL const& url, bool is_redirect)
|
||||||
{
|
{
|
||||||
m_url = url;
|
m_url = url;
|
||||||
emit load_started(url);
|
emit load_started(url, is_redirect);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentView::notify_server_did_finish_loading(Badge<WebContentClient>, AK::URL const& url)
|
void WebContentView::notify_server_did_finish_loading(Badge<WebContentClient>, AK::URL const& url)
|
||||||
|
|
|
@ -123,7 +123,7 @@ public:
|
||||||
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) override;
|
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) override;
|
||||||
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
|
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
|
||||||
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
|
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
|
||||||
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&) override;
|
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool) override;
|
||||||
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) override;
|
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) override;
|
||||||
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) override;
|
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) override;
|
||||||
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) override;
|
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) override;
|
||||||
|
@ -163,7 +163,7 @@ signals:
|
||||||
void link_unhovered();
|
void link_unhovered();
|
||||||
void back_mouse_button();
|
void back_mouse_button();
|
||||||
void forward_mouse_button();
|
void forward_mouse_button();
|
||||||
void load_started(const URL&);
|
void load_started(const URL&, bool);
|
||||||
void title_changed(QString);
|
void title_changed(QString);
|
||||||
void favicon_changed(QIcon);
|
void favicon_changed(QIcon);
|
||||||
void got_source(URL, QString);
|
void got_source(URL, QString);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue