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