mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:34:59 +00:00
LibWeb+WebContent: Label redirects with new FrameLoader::Type::Redirect
Previously we labeled redirects as normal FrameLoader::Type::Navigation, now we introduce a new FrameLoader::Type::Redirect and label redirects with it. This will allow us to handle redirects in the browser differently (such as for overwritting the latest history entry when a redirect happens) :^)
This commit is contained in:
parent
45a59b4d7e
commit
45214fdb1a
12 changed files with 16 additions and 15 deletions
|
@ -215,10 +215,10 @@ bool FrameLoader::load(LoadRequest& request, Type type)
|
|||
|
||||
auto& url = request.url();
|
||||
|
||||
if (type == Type::Navigation || type == Type::Reload) {
|
||||
if (type == Type::Navigation || type == Type::Reload || type == Type::Redirect) {
|
||||
if (auto* page = browsing_context().page()) {
|
||||
if (&page->top_level_browsing_context() == &m_browsing_context)
|
||||
page->client().page_did_start_loading(url);
|
||||
page->client().page_did_start_loading(url, type == Type::Redirect);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -401,7 +401,7 @@ void FrameLoader::resource_did_load()
|
|||
return;
|
||||
}
|
||||
m_redirects_count++;
|
||||
load(url.complete_url(location.value()), FrameLoader::Type::Navigation);
|
||||
load(url.complete_url(location.value()), Type::Redirect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
Navigation,
|
||||
Reload,
|
||||
IFrame,
|
||||
Redirect,
|
||||
};
|
||||
|
||||
static void set_default_favicon_path(String);
|
||||
|
|
|
@ -152,7 +152,7 @@ public:
|
|||
virtual Gfx::IntRect page_did_request_maximize_window() { return {}; }
|
||||
virtual Gfx::IntRect page_did_request_minimize_window() { return {}; }
|
||||
virtual Gfx::IntRect page_did_request_fullscreen_window() { return {}; }
|
||||
virtual void page_did_start_loading(const AK::URL&) { }
|
||||
virtual void page_did_start_loading(const AK::URL&, bool is_redirect) { (void)is_redirect; }
|
||||
virtual void page_did_create_main_document() { }
|
||||
virtual void page_did_finish_loading(const AK::URL&) { }
|
||||
virtual void page_did_change_selection() { }
|
||||
|
|
|
@ -298,7 +298,7 @@ void OutOfProcessWebView::notify_server_did_middle_click_link(Badge<WebContentCl
|
|||
on_link_middle_click(url, target, modifiers);
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL& url)
|
||||
void OutOfProcessWebView::notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL& url, bool)
|
||||
{
|
||||
m_url = url;
|
||||
if (on_load_start)
|
||||
|
|
|
@ -151,7 +151,7 @@ private:
|
|||
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&) override;
|
||||
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool is_redirect) override;
|
||||
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) override;
|
||||
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) override;
|
||||
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) override;
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
virtual void notify_server_did_unhover_link(Badge<WebContentClient>) = 0;
|
||||
virtual void notify_server_did_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) = 0;
|
||||
virtual void notify_server_did_middle_click_link(Badge<WebContentClient>, const AK::URL&, String const& target, unsigned modifiers) = 0;
|
||||
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&) = 0;
|
||||
virtual void notify_server_did_start_loading(Badge<WebContentClient>, const AK::URL&, bool is_redirect) = 0;
|
||||
virtual void notify_server_did_finish_loading(Badge<WebContentClient>, const AK::URL&) = 0;
|
||||
virtual void notify_server_did_request_navigate_back(Badge<WebContentClient>) = 0;
|
||||
virtual void notify_server_did_request_navigate_forward(Badge<WebContentClient>) = 0;
|
||||
|
|
|
@ -131,9 +131,9 @@ void WebContentClient::did_middle_click_link(AK::URL const& url, String const& t
|
|||
m_view.notify_server_did_middle_click_link({}, url, target, modifiers);
|
||||
}
|
||||
|
||||
void WebContentClient::did_start_loading(AK::URL const& url)
|
||||
void WebContentClient::did_start_loading(AK::URL const& url, bool is_redirect)
|
||||
{
|
||||
m_view.notify_server_did_start_loading({}, url);
|
||||
m_view.notify_server_did_start_loading({}, url, is_redirect);
|
||||
}
|
||||
|
||||
void WebContentClient::did_request_context_menu(Gfx::IntPoint const& content_position)
|
||||
|
|
|
@ -47,7 +47,7 @@ private:
|
|||
virtual void did_unhover_link() override;
|
||||
virtual void did_click_link(AK::URL const&, String const&, unsigned) override;
|
||||
virtual void did_middle_click_link(AK::URL const&, String const&, unsigned) override;
|
||||
virtual void did_start_loading(AK::URL const&) override;
|
||||
virtual void did_start_loading(AK::URL const&, bool) override;
|
||||
virtual void did_request_context_menu(Gfx::IntPoint const&) override;
|
||||
virtual void did_request_link_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned) override;
|
||||
virtual void did_request_image_context_menu(Gfx::IntPoint const&, AK::URL const&, String const&, unsigned, Gfx::ShareableBitmap const&) override;
|
||||
|
|
|
@ -253,9 +253,9 @@ void PageHost::page_did_middle_click_link(const URL& url, [[maybe_unused]] Strin
|
|||
m_client.async_did_middle_click_link(url, target, modifiers);
|
||||
}
|
||||
|
||||
void PageHost::page_did_start_loading(const URL& url)
|
||||
void PageHost::page_did_start_loading(const URL& url, bool is_redirect)
|
||||
{
|
||||
m_client.async_did_start_loading(url);
|
||||
m_client.async_did_start_loading(url, is_redirect);
|
||||
}
|
||||
|
||||
void PageHost::page_did_create_main_document()
|
||||
|
|
|
@ -77,7 +77,7 @@ private:
|
|||
virtual void page_did_middle_click_link(const URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_request_context_menu(Gfx::IntPoint const&) override;
|
||||
virtual void page_did_request_link_context_menu(Gfx::IntPoint const&, const URL&, String const& target, unsigned modifiers) override;
|
||||
virtual void page_did_start_loading(const URL&) override;
|
||||
virtual void page_did_start_loading(const URL&, bool) override;
|
||||
virtual void page_did_create_main_document() override;
|
||||
virtual void page_did_finish_loading(const URL&) override;
|
||||
virtual void page_did_request_alert(String const&) override;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
endpoint WebContentClient
|
||||
{
|
||||
did_start_loading(URL url) =|
|
||||
did_start_loading(URL url, bool is_redirect) =|
|
||||
did_finish_loading(URL url) =|
|
||||
did_request_navigate_back() =|
|
||||
did_request_navigate_forward() =|
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
virtual void page_did_start_loading(AK::URL const&) override
|
||||
virtual void page_did_start_loading(AK::URL const&, bool) override
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue