1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:27:35 +00:00

WebDriver: Implement GET /session/{id}/cookie endpoint

This commit is contained in:
Tobias Christiansen 2022-10-15 14:08:07 +02:00 committed by Linus Groh
parent 2c808958b9
commit 001699f2d6
8 changed files with 82 additions and 3 deletions

View file

@ -1,12 +1,15 @@
/*
* Copyright (c) 2022, Florent Castelli <florent.castelli@gmail.com>
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
* Copyright (c) 2022, Tobias Christiansen <tobyase@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "WebDriverConnection.h"
#include "BrowserWindow.h"
#include <AK/Vector.h>
#include <LibWeb/Cookie/Cookie.h>
namespace Browser {
@ -67,4 +70,15 @@ void WebDriverConnection::forward()
browser_window->active_tab().go_forward();
}
Messages::WebDriverSessionClient::GetAllCookiesResponse WebDriverConnection::get_all_cookies()
{
dbgln("WebDriverConnection: get_cookies");
if (auto browser_window = m_browser_window.strong_ref()) {
if (browser_window->active_tab().on_get_cookies_entries) {
return { browser_window->active_tab().on_get_cookies_entries() };
}
}
return { {} };
}
}