LibDevTools: Begin supporting the JavaScript console

This implements enough to execute JavaScript and reply with the result.
We do not yet support autocomplete or eager evaluation.
This commit is contained in:
Timothy Flynn 2025-02-24 11:55:46 -05:00 committed by Andreas Kling
commit 6d33b70e61
Notes: github-actions[bot] 2025-02-28 12:09:40 +00:00
8 changed files with 170 additions and 7 deletions

View file

@ -0,0 +1,33 @@
/*
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/NonnullRefPtr.h>
#include <LibDevTools/Actor.h>
namespace DevTools {
class ConsoleActor final : public Actor {
public:
static constexpr auto base_name = "console"sv;
static NonnullRefPtr<ConsoleActor> create(DevToolsServer&, String name, WeakPtr<TabActor>);
virtual ~ConsoleActor() override;
virtual void handle_message(StringView type, JsonObject const&) override;
private:
ConsoleActor(DevToolsServer&, String name, WeakPtr<TabActor>);
void received_console_result(String result_id, String input, JsonValue result, BlockToken);
WeakPtr<TabActor> m_tab;
u64 m_execution_id { 0 };
};
}