1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

Browser+WebContent+WebDriver: Move Get Named Cookie to WebContent

Instead of sending *all* cookies over IPC and filtering by name, we now
filter by name from the cookie jar and send just the first matching
cookie.
This commit is contained in:
Timothy Flynn 2022-11-11 09:55:11 -05:00 committed by Linus Groh
parent c6a0888088
commit a3d6c2f6af
14 changed files with 51 additions and 57 deletions

View file

@ -69,21 +69,6 @@ Messages::WebDriverSessionClient::GetAllCookiesResponse WebDriverConnection::get
return { {} };
}
Messages::WebDriverSessionClient::GetNamedCookieResponse WebDriverConnection::get_named_cookie(String const& name)
{
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: get_named_cookie {}", name);
if (auto browser_window = m_browser_window.strong_ref()) {
if (browser_window->active_tab().on_get_cookies_entries) {
for (auto cookie : browser_window->active_tab().on_get_cookies_entries()) {
if (cookie.name == name)
return { cookie };
}
return Optional<Web::Cookie::Cookie> {};
}
}
return { {} };
}
void WebDriverConnection::add_cookie(Web::Cookie::ParsedCookie const& cookie)
{
dbgln_if(WEBDRIVER_DEBUG, "WebDriverConnection: add_cookie {}", cookie.name);