LibWeb+LibWebView+WebContent: Add a new IPC for modifying history state

Let's not re-invoke the "page did start loading" IPC when the history
state is pushed/replaced. It's a bit misleading (the change does not
actually load the new URL), but also the chromes may do more work than
we want when we change the URL.

Instead, add a new IPC for the history object to invoke.
This commit is contained in:
Timothy Flynn 2024-03-28 22:12:23 -04:00 committed by Tim Flynn
parent 1767f405dc
commit 8b1ad5c496
Notes: sideshowbarker 2024-07-16 23:57:20 +09:00
9 changed files with 31 additions and 3 deletions

View file

@ -76,6 +76,21 @@ void WebContentClient::did_finish_loading(u64 page_id, URL::URL const& url)
view.on_load_finish(url);
}
void WebContentClient::did_update_url(u64 page_id, URL::URL const& url, Web::HTML::HistoryHandlingBehavior history_behavior)
{
auto maybe_view = m_views.get(page_id);
if (!maybe_view.has_value()) {
dbgln("Received finish loading for unknown page ID {}", page_id);
return;
}
auto& view = *maybe_view.value();
view.set_url({}, url);
if (view.on_url_updated)
view.on_url_updated(url, history_behavior);
}
void WebContentClient::did_finish_text_test(u64 page_id)
{
auto maybe_view = m_views.get(page_id);