mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibDevTools: Implement enough of the protocol to inspect tabs
There is a lot needed all at once to actually inspect a tab's DOM tree. It begins with requesting a "watcher" from a TabActor. It seems there can be many types of watchers, but here we implement the "frame" watcher only. The watcher creates an "inspector", which in turn creates a "walker", which is the actor ultimately responsible for serializing and inspecting the DOM tree. In between all that, the DevTools client will send a handful of other informational requests. If we do not reply to these, the client will not move forward with the walker. For example, the CSSPropertiesActor will be asked for a list of all known CSS properties.
This commit is contained in:
parent
b974e91731
commit
5ed91dc915
Notes:
github-actions[bot]
2025-02-19 13:47:12 +00:00
Author: https://github.com/trflynn89
Commit: 5ed91dc915
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3589
Reviewed-by: https://github.com/ADKaster
25 changed files with 1278 additions and 0 deletions
76
Libraries/LibDevTools/Actors/TargetConfigurationActor.cpp
Normal file
76
Libraries/LibDevTools/Actors/TargetConfigurationActor.cpp
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Tim Flynn <trflynn89@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <LibDevTools/Actors/TargetConfigurationActor.h>
|
||||
|
||||
namespace DevTools {
|
||||
|
||||
NonnullRefPtr<TargetConfigurationActor> TargetConfigurationActor::create(DevToolsServer& devtools, ByteString name)
|
||||
{
|
||||
return adopt_ref(*new TargetConfigurationActor(devtools, move(name)));
|
||||
}
|
||||
|
||||
TargetConfigurationActor::TargetConfigurationActor(DevToolsServer& devtools, ByteString name)
|
||||
: Actor(devtools, move(name))
|
||||
{
|
||||
}
|
||||
|
||||
TargetConfigurationActor::~TargetConfigurationActor() = default;
|
||||
|
||||
void TargetConfigurationActor::handle_message(StringView type, JsonObject const& message)
|
||||
{
|
||||
JsonObject response;
|
||||
response.set("from"sv, name());
|
||||
|
||||
if (type == "updateConfiguration"sv) {
|
||||
auto configuration = message.get_object("configuration"sv);
|
||||
if (!configuration.has_value()) {
|
||||
send_missing_parameter_error("configuration"sv);
|
||||
return;
|
||||
}
|
||||
|
||||
send_message(move(response));
|
||||
return;
|
||||
}
|
||||
|
||||
send_unrecognized_packet_type_error(type);
|
||||
}
|
||||
|
||||
JsonObject TargetConfigurationActor::serialize_configuration() const
|
||||
{
|
||||
JsonObject supported_options;
|
||||
supported_options.set("cacheDisabled"sv, false);
|
||||
supported_options.set("colorSchemeSimulation"sv, false);
|
||||
supported_options.set("customFormatters"sv, false);
|
||||
supported_options.set("customUserAgent"sv, false);
|
||||
supported_options.set("javascriptEnabled"sv, false);
|
||||
supported_options.set("overrideDPPX"sv, false);
|
||||
supported_options.set("printSimulationEnabled"sv, false);
|
||||
supported_options.set("rdmPaneMaxTouchPoints"sv, false);
|
||||
supported_options.set("rdmPaneOrientation"sv, false);
|
||||
supported_options.set("recordAllocations"sv, false);
|
||||
supported_options.set("reloadOnTouchSimulationToggle"sv, false);
|
||||
supported_options.set("restoreFocus"sv, false);
|
||||
supported_options.set("serviceWorkersTestingEnabled"sv, false);
|
||||
supported_options.set("setTabOffline"sv, false);
|
||||
supported_options.set("touchEventsOverride"sv, false);
|
||||
supported_options.set("tracerOptions"sv, false);
|
||||
supported_options.set("useSimpleHighlightersForReducedMotion"sv, false);
|
||||
|
||||
JsonObject traits;
|
||||
traits.set("supportedOptions"sv, move(supported_options));
|
||||
|
||||
JsonObject target;
|
||||
target.set("actor"sv, name());
|
||||
target.set("configuration"sv, JsonObject {});
|
||||
target.set("traits"sv, move(traits));
|
||||
|
||||
return target;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue