1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:18:11 +00:00

Browser: Add update_cookie WebDriver IPC endpoint

Through this the WebDriver will be able to change cookies. Needed for
deleting cookies.
This commit is contained in:
Tobias Christiansen 2022-10-16 19:49:39 +02:00 committed by Linus Groh
parent 30360918d4
commit c710780852
3 changed files with 12 additions and 0 deletions

View file

@ -95,4 +95,14 @@ Messages::WebDriverSessionClient::GetNamedCookieResponse WebDriverConnection::ge
return { {} };
}
void WebDriverConnection::update_cookie(Web::Cookie::Cookie const& cookie)
{
if (auto browser_window = m_browser_window.strong_ref()) {
auto& tab = browser_window->active_tab();
if (tab.on_update_cookie) {
tab.on_update_cookie(tab.url(), cookie);
}
}
}
}

View file

@ -45,6 +45,7 @@ public:
virtual void forward() override;
virtual Messages::WebDriverSessionClient::GetAllCookiesResponse get_all_cookies() override;
virtual Messages::WebDriverSessionClient::GetNamedCookieResponse get_named_cookie(String const& name) override;
virtual void update_cookie(Web::Cookie::Cookie const&) override;
private:
WebDriverConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, NonnullRefPtr<BrowserWindow> browser_window);

View file

@ -13,5 +13,6 @@ endpoint WebDriverSessionClient {
forward() =|
get_all_cookies() => (Vector<Web::Cookie::Cookie> cookies)
get_named_cookie(String name) => (Optional<Web::Cookie::Cookie> cookie)
update_cookie(Web::Cookie::Cookie cookie) =|
}