2022-11-02 15:02:19 -03:00
|
|
|
/*
|
2023-04-20 13:41:32 -03:00
|
|
|
* Copyright (c) 2022-2023, Linus Groh <linusg@serenityos.org>
|
2024-11-02 15:29:37 -03:00
|
|
|
* Copyright (c) 2024, Tim Flynn <trflynn89@ladybird.org>
|
2022-11-02 15:02:19 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <AK/Forward.h>
|
|
|
|
|
#include <LibJS/Forward.h>
|
2024-09-13 08:42:24 -03:00
|
|
|
#include <LibJS/Heap/HeapFunction.h>
|
2024-11-02 15:29:37 -03:00
|
|
|
#include <LibJS/Runtime/Promise.h>
|
2022-11-02 15:02:19 -03:00
|
|
|
#include <LibJS/Runtime/Value.h>
|
|
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::WebDriver {
|
|
|
|
|
|
2024-11-02 15:29:37 -03:00
|
|
|
struct ExecutionResult {
|
|
|
|
|
JS::Promise::State state { JS::Promise::State::Pending };
|
|
|
|
|
JS::Value value {};
|
2022-11-02 15:02:19 -03:00
|
|
|
};
|
|
|
|
|
|
2024-11-02 15:29:37 -03:00
|
|
|
using OnScriptComplete = JS::HeapFunction<void(ExecutionResult)>;
|
2024-09-13 08:42:24 -03:00
|
|
|
|
2024-10-29 15:12:13 -03:00
|
|
|
JS::ThrowCompletionOr<JS::Value> execute_a_function_body(HTML::BrowsingContext const&, ByteString const& body, ReadonlySpan<JS::Value> parameters);
|
|
|
|
|
JS::ThrowCompletionOr<JS::Value> execute_a_function_body(HTML::Window const&, ByteString const& body, ReadonlySpan<JS::Value> parameters, JS::GCPtr<JS::Object> environment_override_object = {});
|
|
|
|
|
|
2024-09-14 09:04:15 -03:00
|
|
|
void execute_script(HTML::BrowsingContext const&, ByteString body, JS::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout_ms, JS::NonnullGCPtr<OnScriptComplete> on_complete);
|
|
|
|
|
void execute_async_script(HTML::BrowsingContext const&, ByteString body, JS::MarkedVector<JS::Value> arguments, Optional<u64> const& timeout_ms, JS::NonnullGCPtr<OnScriptComplete> on_complete);
|
2022-11-02 15:02:19 -03:00
|
|
|
|
|
|
|
|
}
|