mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWebView+WebContent: Create a different console client for DevTools
Our existing WebContentConsoleClient is very specific to our home-grown Inspector. It renders console output to an HTML string. For DevTools, we will not want this behavior; we will want to send representations of raw JS values. This patch makes WebContentConsoleClient a base class to handle console input from the user, either from the Inspector or from DevTools. It then moves the HTML rendering needed for the Inspector to a new class, InspectorConsoleClient. And we add a DevToolsConsoleClient (currently just stubbed) to handle needs specific to DevTools. We choose at runtime which console client to install, based on the --devtools command line flag.
This commit is contained in:
parent
a8d3252f93
commit
37f07c176a
Notes:
github-actions[bot]
2025-02-28 12:09:47 +00:00
Author: https://github.com/trflynn89
Commit: 37f07c176a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3686
12 changed files with 419 additions and 229 deletions
35
Services/WebContent/DevToolsConsoleClient.h
Normal file
35
Services/WebContent/DevToolsConsoleClient.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Console.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/Forward.h>
|
||||
#include <WebContent/Forward.h>
|
||||
#include <WebContent/WebContentConsoleClient.h>
|
||||
|
||||
namespace WebContent {
|
||||
|
||||
class DevToolsConsoleClient final : public WebContentConsoleClient {
|
||||
GC_CELL(DevToolsConsoleClient, WebContentConsoleClient);
|
||||
GC_DECLARE_ALLOCATOR(DevToolsConsoleClient);
|
||||
|
||||
public:
|
||||
static GC::Ref<DevToolsConsoleClient> create(JS::Realm&, JS::Console&, PageClient&);
|
||||
virtual ~DevToolsConsoleClient() override;
|
||||
|
||||
private:
|
||||
DevToolsConsoleClient(JS::Realm&, JS::Console&, PageClient&, ConsoleGlobalEnvironmentExtensions&);
|
||||
|
||||
virtual void handle_result(JS::Value) override;
|
||||
virtual void report_exception(JS::Error const&, bool) override;
|
||||
virtual void send_messages(i32 start_index) override;
|
||||
|
||||
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments) override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue