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

Browser: add urls to browser history on load start

urls were previously added to history in the Tab::load()
function, which excluded the setter on window.location.href.
This commit adds all urls to browser history when the page loads,
as long as the load_type is not LoadType::HistoryNavigation.
Closes #3148
This commit is contained in:
Jake Wilson 2020-08-18 23:34:28 -04:00 committed by Andreas Kling
parent f503d3c046
commit 0f6de0c45a
2 changed files with 9 additions and 2 deletions

View file

@ -132,6 +132,12 @@ Tab::Tab(Type type)
hooks().on_load_start = [this](auto& url) {
m_location_box->set_icon(nullptr);
m_location_box->set_text(url.to_string());
// don't add to history if back or forward is pressed
if (!m_is_history_navigation)
m_history.push(url);
m_is_history_navigation = false;
update_actions();
update_bookmark_button(url.to_string());
};
@ -404,8 +410,7 @@ Tab::~Tab()
void Tab::load(const URL& url, LoadType load_type)
{
if (load_type == LoadType::Normal)
m_history.push(url);
m_is_history_navigation = (load_type == LoadType::HistoryNavigation);
if (m_type == Type::InProcessWebView)
m_page_view->load(url);