mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
Ladybird/WebDriver: Implement the cookie endpoints for Ladybird
This commit is contained in:
parent
9e0db602ca
commit
948c4ba102
3 changed files with 24 additions and 3 deletions
|
@ -297,6 +297,14 @@ void BrowserWindow::new_tab()
|
|||
QObject::connect(tab_ptr, &Tab::title_changed, this, &BrowserWindow::tab_title_changed);
|
||||
QObject::connect(tab_ptr, &Tab::favicon_changed, this, &BrowserWindow::tab_favicon_changed);
|
||||
|
||||
tab_ptr->view().on_get_all_cookies = [this](auto const& url) {
|
||||
return m_cookie_jar.get_all_cookies(url);
|
||||
};
|
||||
|
||||
tab_ptr->view().on_get_named_cookie = [this](auto const& url, auto const& name) {
|
||||
return m_cookie_jar.get_named_cookie(url, name);
|
||||
};
|
||||
|
||||
tab_ptr->view().on_get_cookie = [this](auto& url, auto source) -> String {
|
||||
return m_cookie_jar.get_cookie(url, source);
|
||||
};
|
||||
|
@ -305,6 +313,10 @@ void BrowserWindow::new_tab()
|
|||
m_cookie_jar.set_cookie(url, cookie, source);
|
||||
};
|
||||
|
||||
tab_ptr->view().on_update_cookie = [this](auto const& url, auto const& cookie) {
|
||||
m_cookie_jar.update_cookie(url, cookie);
|
||||
};
|
||||
|
||||
tab_ptr->focus_location_editor();
|
||||
}
|
||||
|
||||
|
|
|
@ -914,13 +914,17 @@ void WebContentView::notify_server_did_change_favicon(Gfx::Bitmap const& bitmap)
|
|||
emit favicon_changed(QIcon(qpixmap));
|
||||
}
|
||||
|
||||
Vector<Web::Cookie::Cookie> WebContentView::notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const&)
|
||||
Vector<Web::Cookie::Cookie> WebContentView::notify_server_did_request_all_cookies(Badge<WebContentClient>, AK::URL const& url)
|
||||
{
|
||||
if (on_get_all_cookies)
|
||||
return on_get_all_cookies(url);
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<Web::Cookie::Cookie> WebContentView::notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const&, String const&)
|
||||
Optional<Web::Cookie::Cookie> WebContentView::notify_server_did_request_named_cookie(Badge<WebContentClient>, AK::URL const& url, String const& name)
|
||||
{
|
||||
if (on_get_named_cookie)
|
||||
return on_get_named_cookie(url, name);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -937,8 +941,10 @@ void WebContentView::notify_server_did_set_cookie(Badge<WebContentClient>, AK::U
|
|||
on_set_cookie(url, cookie, source);
|
||||
}
|
||||
|
||||
void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, AK::URL const&, Web::Cookie::Cookie const&)
|
||||
void WebContentView::notify_server_did_update_cookie(Badge<WebContentClient>, AK::URL const& url, Web::Cookie::Cookie const& cookie)
|
||||
{
|
||||
if (on_update_cookie)
|
||||
on_update_cookie(url, cookie);
|
||||
}
|
||||
|
||||
void WebContentView::notify_server_did_update_resource_count(i32 count_waiting)
|
||||
|
|
|
@ -71,8 +71,11 @@ public:
|
|||
Function<void(i32 node_id, String const& specified_style, String const& computed_style, String const& custom_properties, String const& node_box_sizing)> on_get_dom_node_properties;
|
||||
Function<void(i32 message_id)> on_js_console_new_message;
|
||||
Function<void(i32 start_index, Vector<String> const& message_types, Vector<String> const& messages)> on_get_js_console_messages;
|
||||
Function<Vector<Web::Cookie::Cookie>(AK::URL const& url)> on_get_all_cookies;
|
||||
Function<Optional<Web::Cookie::Cookie>(AK::URL const& url, String const& name)> on_get_named_cookie;
|
||||
Function<String(const AK::URL& url, Web::Cookie::Source source)> on_get_cookie;
|
||||
Function<void(const AK::URL& url, Web::Cookie::ParsedCookie const& cookie, Web::Cookie::Source source)> on_set_cookie;
|
||||
Function<void(AK::URL const& url, Web::Cookie::Cookie const& cookie)> on_update_cookie;
|
||||
Function<void(i32 count_waiting)> on_resource_status_change;
|
||||
|
||||
virtual void paintEvent(QPaintEvent*) override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue