mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 19:19:30 +00:00
LibDevTools: Introduce a Firefox DevTools server library
To aid with debugging web page issues in Ladybird without needing to implement a fully fledged inspector, we can implement the Firefox DevTools protocol and use their DevTools. The protocol is described here: https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html This commit contains just enough to connect to Ladybird from a DevTools client.
This commit is contained in:
parent
49c93d01db
commit
58bc44ba2a
Notes:
github-actions[bot]
2025-02-19 13:47:24 +00:00
Author: https://github.com/trflynn89
Commit: 58bc44ba2a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3589
Reviewed-by: https://github.com/ADKaster
20 changed files with 947 additions and 0 deletions
38
Libraries/LibDevTools/Connection.h
Normal file
38
Libraries/LibDevTools/Connection.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Error.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/NonnullOwnPtr.h>
|
||||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <LibCore/Socket.h>
|
||||
#include <LibDevTools/Forward.h>
|
||||
|
||||
namespace DevTools {
|
||||
|
||||
class Connection : public RefCounted<Connection> {
|
||||
public:
|
||||
static NonnullRefPtr<Connection> create(NonnullOwnPtr<Core::BufferedTCPSocket>);
|
||||
~Connection();
|
||||
|
||||
Function<void()> on_connection_closed;
|
||||
Function<void(JsonObject const&)> on_message_received;
|
||||
|
||||
void send_message(JsonValue const&);
|
||||
|
||||
private:
|
||||
explicit Connection(NonnullOwnPtr<Core::BufferedTCPSocket>);
|
||||
|
||||
ErrorOr<void> on_ready_to_read();
|
||||
ErrorOr<JsonValue> read_message();
|
||||
|
||||
NonnullOwnPtr<Core::BufferedTCPSocket> m_socket;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue