mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:17: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:
parent
f503d3c046
commit
0f6de0c45a
2 changed files with 9 additions and 2 deletions
|
@ -132,6 +132,12 @@ Tab::Tab(Type type)
|
||||||
hooks().on_load_start = [this](auto& url) {
|
hooks().on_load_start = [this](auto& url) {
|
||||||
m_location_box->set_icon(nullptr);
|
m_location_box->set_icon(nullptr);
|
||||||
m_location_box->set_text(url.to_string());
|
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_actions();
|
||||||
update_bookmark_button(url.to_string());
|
update_bookmark_button(url.to_string());
|
||||||
};
|
};
|
||||||
|
@ -404,8 +410,7 @@ Tab::~Tab()
|
||||||
|
|
||||||
void Tab::load(const URL& url, LoadType load_type)
|
void Tab::load(const URL& url, LoadType load_type)
|
||||||
{
|
{
|
||||||
if (load_type == LoadType::Normal)
|
m_is_history_navigation = (load_type == LoadType::HistoryNavigation);
|
||||||
m_history.push(url);
|
|
||||||
|
|
||||||
if (m_type == Type::InProcessWebView)
|
if (m_type == Type::InProcessWebView)
|
||||||
m_page_view->load(url);
|
m_page_view->load(url);
|
||||||
|
|
|
@ -109,6 +109,8 @@ private:
|
||||||
|
|
||||||
String m_title;
|
String m_title;
|
||||||
RefPtr<const Gfx::Bitmap> m_icon;
|
RefPtr<const Gfx::Bitmap> m_icon;
|
||||||
|
|
||||||
|
bool m_is_history_navigation { false };
|
||||||
};
|
};
|
||||||
|
|
||||||
URL url_from_user_input(const String& input);
|
URL url_from_user_input(const String& input);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue