mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +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
45
Libraries/LibDevTools/Actors/ProcessActor.cpp
Normal file
45
Libraries/LibDevTools/Actors/ProcessActor.cpp
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibDevTools/Actors/ProcessActor.h>
|
||||
|
||||
namespace DevTools {
|
||||
|
||||
NonnullRefPtr<ProcessActor> ProcessActor::create(DevToolsServer& devtools, ByteString name, ProcessDescription description)
|
||||
{
|
||||
return adopt_ref(*new ProcessActor(devtools, move(name), move(description)));
|
||||
}
|
||||
|
||||
ProcessActor::ProcessActor(DevToolsServer& devtools, ByteString name, ProcessDescription description)
|
||||
: Actor(devtools, move(name))
|
||||
, m_description(move(description))
|
||||
{
|
||||
}
|
||||
|
||||
ProcessActor::~ProcessActor() = default;
|
||||
|
||||
void ProcessActor::handle_message(StringView type, JsonObject const&)
|
||||
{
|
||||
send_unrecognized_packet_type_error(type);
|
||||
}
|
||||
|
||||
JsonObject ProcessActor::serialize_description() const
|
||||
{
|
||||
JsonObject traits;
|
||||
traits.set("watcher"sv, m_description.is_parent);
|
||||
traits.set("supportsReloadDescriptor"sv, true);
|
||||
|
||||
JsonObject description;
|
||||
description.set("actor"sv, name());
|
||||
description.set("id"sv, m_description.id);
|
||||
description.set("isParent"sv, m_description.is_parent);
|
||||
description.set("isWindowlessParent"sv, m_description.is_windowless_parent);
|
||||
description.set("traits"sv, move(traits));
|
||||
return description;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue