1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:47:44 +00:00

WebDriver: Implement Close Window closer to the spec

We are expected to return the list of open handles after closing the
current handle. Also just return a WebDriver::Response instead of a
wrapped Error variant.
This commit is contained in:
Timothy Flynn 2022-11-12 18:17:09 -05:00 committed by Linus Groh
parent 9dc622475e
commit 47493b5734
4 changed files with 12 additions and 36 deletions

View file

@ -95,29 +95,6 @@ private:
ErrorOr<NonnullOwnPtr<Session>, Web::WebDriver::Error> take_session_with_id(StringView session_id);
JsonValue make_json_value(JsonValue const&);
template<typename T>
static ErrorOr<T, Web::WebDriver::Error> unwrap_result(ErrorOr<T, Variant<Web::WebDriver::Error, Error>> result)
{
if (result.is_error()) {
Variant<Web::WebDriver::Error, Error> error = result.release_error();
if (error.has<Web::WebDriver::Error>())
return error.get<Web::WebDriver::Error>();
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::UnsupportedOperation, error.get<Error>().string_literal());
}
return result.release_value();
}
static ErrorOr<void, Web::WebDriver::Error> unwrap_result(ErrorOr<void, Variant<Web::WebDriver::Error, Error>> result)
{
if (result.is_error()) {
Variant<Web::WebDriver::Error, Error> error = result.release_error();
if (error.has<Web::WebDriver::Error>())
return error.get<Web::WebDriver::Error>();
return Web::WebDriver::Error::from_code(Web::WebDriver::ErrorCode::UnsupportedOperation, error.get<Error>().string_literal());
}
return {};
}
NonnullOwnPtr<Core::Stream::BufferedTCPSocket> m_socket;
static Vector<Route> s_routes;
String m_prefix = "/";