mirror of
https://github.com/RGBCube/serenity
synced 2025-08-07 13:37:35 +00:00
WebDriver: Implement GET /session/{id}/cookie
endpoint
This commit is contained in:
parent
2c808958b9
commit
001699f2d6
8 changed files with 82 additions and 3 deletions
|
@ -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 { {} };
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
@ -42,6 +43,7 @@ public:
|
|||
virtual void refresh() override;
|
||||
virtual void back() override;
|
||||
virtual void forward() override;
|
||||
virtual Messages::WebDriverSessionClient::GetAllCookiesResponse get_all_cookies() override;
|
||||
|
||||
private:
|
||||
WebDriverConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket, NonnullRefPtr<BrowserWindow> browser_window);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include <AK/URL.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Cookie/Cookie.h>
|
||||
|
||||
endpoint WebDriverSessionClient {
|
||||
quit() =|
|
||||
|
@ -9,4 +11,5 @@ endpoint WebDriverSessionClient {
|
|||
refresh() =|
|
||||
back() =|
|
||||
forward() =|
|
||||
get_all_cookies() => (Vector<Web::Cookie::Cookie> cookies)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue