mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 19:19:30 +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:
parent
f503d3c046
commit
0f6de0c45a
Notes:
sideshowbarker
2024-07-19 03:25:16 +09:00
Author: https://github.com/jakewilson 🔰
Commit: 0f6de0c45a
Pull-request: https://github.com/SerenityOS/serenity/pull/3218
Issue: https://github.com/SerenityOS/serenity/issues/3148
2 changed files with 9 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue