mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +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
42
Libraries/LibDevTools/Actors/PreferenceActor.cpp
Normal file
42
Libraries/LibDevTools/Actors/PreferenceActor.cpp
Normal file
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibDevTools/Actors/PreferenceActor.h>
|
||||
|
||||
namespace DevTools {
|
||||
|
||||
NonnullRefPtr<PreferenceActor> PreferenceActor::create(DevToolsServer& devtools, ByteString name)
|
||||
{
|
||||
return adopt_ref(*new PreferenceActor(devtools, move(name)));
|
||||
}
|
||||
|
||||
PreferenceActor::PreferenceActor(DevToolsServer& devtools, ByteString name)
|
||||
: Actor(devtools, move(name))
|
||||
{
|
||||
}
|
||||
|
||||
PreferenceActor::~PreferenceActor() = default;
|
||||
|
||||
void PreferenceActor::handle_message(StringView type, JsonObject const&)
|
||||
{
|
||||
// FIXME: During session initialization, Firefox DevTools asks for the following boolean configurations:
|
||||
// browser.privatebrowsing.autostart
|
||||
// devtools.debugger.prompt-connection
|
||||
// dom.serviceWorkers.enabled
|
||||
// We just blindly return `false` for these, but we will eventually want a real configuration manager.
|
||||
if (type == "getBoolPref"sv) {
|
||||
JsonObject response;
|
||||
response.set("from"sv, name());
|
||||
response.set("value"sv, false);
|
||||
send_message(move(response));
|
||||
return;
|
||||
}
|
||||
|
||||
send_unrecognized_packet_type_error(type);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue