mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +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();
|
||||
});
|
||||
|
||||
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());
|
||||
|
||||
// Don't add to history if back or forward is pressed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue