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>
|
2025-02-17 15:58:21 -03:00
|
|
|
#include <AK/String.h>
|
2024-11-14 12:01:23 -03:00
|
|
|
#include <LibGC/Function.h>
|
2022-11-02 15:02:19 -03:00
|
|
|
#include <LibJS/Forward.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>
|
2025-07-19 23:35:33 -03:00
|
|
|
#include <LibWeb/Export.h>
|
2022-11-02 15:02:19 -03:00
|
|
|
#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-14 12:01:23 -03:00
|
|
|
using OnScriptComplete = GC::Function<void(ExecutionResult)>;
|
2024-09-13 08:42:24 -03:00
|
|
|
|
2025-07-19 23:35:33 -03:00
|
|
|
WEB_API void execute_script(HTML::BrowsingContext const&, String body, GC::RootVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete);
|
|
|
|
|
WEB_API void execute_async_script(HTML::BrowsingContext const&, String body, GC::RootVector<JS::Value> arguments, Optional<u64> const& timeout_ms, GC::Ref<OnScriptComplete> on_complete);
|
2022-11-02 15:02:19 -03:00
|
|
|
|
|
|
|
|
}
|