mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
WebDriver: Implement POST /session/{id}/cookie
endpoint
This allows the WebDriver to create a cookie. We use a Web::Cookie::ParsedCookie to transport the data through IPC to take advantage of the RFC6265 Section 5.3 implementation in the CookieJar.
This commit is contained in:
parent
b79b78a5cc
commit
122e2d2076
7 changed files with 152 additions and 0 deletions
|
@ -95,6 +95,20 @@ Messages::WebDriverSessionClient::GetNamedCookieResponse WebDriverConnection::ge
|
|||
return { {} };
|
||||
}
|
||||
|
||||
void WebDriverConnection::add_cookie(Web::Cookie::ParsedCookie const& cookie)
|
||||
{
|
||||
dbgln("WebDriverConnection: add_cookie");
|
||||
if (auto browser_window = m_browser_window.strong_ref()) {
|
||||
auto& tab = browser_window->active_tab();
|
||||
if (tab.on_set_cookie) {
|
||||
// FIXME: The spec doesn't say anything about the source
|
||||
// but can we assume a cookie created through a HTTP-request to the WebDriver
|
||||
// to be (source) from an HTTP-API?
|
||||
tab.on_set_cookie(tab.url(), cookie, Web::Cookie::Source::Http);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WebDriverConnection::update_cookie(Web::Cookie::Cookie const& cookie)
|
||||
{
|
||||
if (auto browser_window = m_browser_window.strong_ref()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue