2021-02-27 21:44:49 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Brandon Scott <xeon.productions@gmail.com>
|
|
|
|
* Copyright (c) 2020, Hunter Salyer <thefalsehonesty@gmail.com>
|
2022-11-19 16:12:19 +00:00
|
|
|
* Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org>
|
2021-02-27 21:44:49 -06:00
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-02-27 21:44:49 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibJS/Console.h>
|
|
|
|
#include <LibJS/Forward.h>
|
2025-02-24 09:48:13 -05:00
|
|
|
#include <LibJS/Runtime/Value.h>
|
2021-02-27 21:44:49 -06:00
|
|
|
#include <LibWeb/Forward.h>
|
|
|
|
#include <WebContent/Forward.h>
|
|
|
|
|
|
|
|
namespace WebContent {
|
|
|
|
|
2025-03-28 20:09:28 +00:00
|
|
|
class WebContentConsoleClient : public JS::ConsoleClient
|
|
|
|
, public Weakable<WebContentConsoleClient> {
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_CELL(WebContentConsoleClient, JS::ConsoleClient);
|
|
|
|
GC_DECLARE_ALLOCATOR(WebContentConsoleClient);
|
2024-04-20 21:19:51 +02:00
|
|
|
|
2021-02-27 21:44:49 -06:00
|
|
|
public:
|
2024-04-20 21:19:51 +02:00
|
|
|
virtual ~WebContentConsoleClient() override;
|
2021-02-27 21:44:49 -06:00
|
|
|
|
2025-02-23 08:57:40 -05:00
|
|
|
void handle_input(StringView js_source);
|
2021-02-27 21:44:49 -06:00
|
|
|
|
2025-02-24 09:48:13 -05:00
|
|
|
virtual void handle_result(JS::Value) = 0;
|
|
|
|
virtual void send_messages(i32 start_index) = 0;
|
2024-04-20 21:19:51 +02:00
|
|
|
|
2025-02-24 09:48:13 -05:00
|
|
|
protected:
|
|
|
|
WebContentConsoleClient(JS::Realm&, JS::Console&, PageClient&, ConsoleGlobalEnvironmentExtensions&);
|
2021-02-27 21:44:49 -06:00
|
|
|
|
2025-02-24 09:48:13 -05:00
|
|
|
virtual void visit_edges(JS::Cell::Visitor&) override;
|
2022-09-20 18:23:04 +01:00
|
|
|
|
2025-02-24 09:48:13 -05:00
|
|
|
GC::Ref<JS::Realm> m_realm;
|
|
|
|
GC::Ref<PageClient> m_client;
|
|
|
|
GC::Ref<ConsoleGlobalEnvironmentExtensions> m_console_global_environment_extensions;
|
2021-02-27 21:44:49 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|