mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 17:24:48 -05:00
WebContent: Create a temporary execution context to parse WebDriver JSON
This commit is contained in:
parent
b5aa8f65b1
commit
264b2827cd
Notes:
github-actions[bot]
2024-09-29 09:49:41 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/264b2827cd0 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1557 Reviewed-by: https://github.com/AtkinsSJ
2 changed files with 5 additions and 1 deletions
|
@ -37,6 +37,7 @@
|
|||
#include <LibWeb/HTML/HTMLOptGroupElement.h>
|
||||
#include <LibWeb/HTML/HTMLOptionElement.h>
|
||||
#include <LibWeb/HTML/HTMLSelectElement.h>
|
||||
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
|
@ -2350,6 +2351,9 @@ ErrorOr<JsonArray, Web::WebDriver::Error> WebDriverConnection::find(StartNodeGet
|
|||
// https://w3c.github.io/webdriver/#dfn-extract-the-script-arguments-from-a-request
|
||||
ErrorOr<WebDriverConnection::ScriptArguments, Web::WebDriver::Error> WebDriverConnection::extract_the_script_arguments_from_a_request(JS::VM& vm, JsonValue const& payload)
|
||||
{
|
||||
// Creating JSON objects below requires an execution context.
|
||||
Web::HTML::TemporaryExecutionContext execution_context { current_browsing_context().active_document()->relevant_settings_object() };
|
||||
|
||||
// 1. Let script be the result of getting a property named script from the parameters.
|
||||
// 2. If script is not a String, return error with error code invalid argument.
|
||||
auto script = TRY(get_property(payload, "script"sv));
|
||||
|
|
|
@ -128,7 +128,7 @@ private:
|
|||
ByteString script;
|
||||
JS::MarkedVector<JS::Value> arguments;
|
||||
};
|
||||
static ErrorOr<ScriptArguments, Web::WebDriver::Error> extract_the_script_arguments_from_a_request(JS::VM&, JsonValue const& payload);
|
||||
ErrorOr<ScriptArguments, Web::WebDriver::Error> extract_the_script_arguments_from_a_request(JS::VM&, JsonValue const& payload);
|
||||
void delete_cookies(Optional<StringView> const& name = {});
|
||||
|
||||
// https://w3c.github.io/webdriver/#dfn-page-load-strategy
|
||||
|
|
Loading…
Reference in a new issue