mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-07 09:31:53 +00:00
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.
52 lines
1.3 KiB
C++
52 lines
1.3 KiB
C++
/*
|
|
* 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/ThreadConfigurationActor.h>
|
|
|
|
namespace DevTools {
|
|
|
|
NonnullRefPtr<ThreadConfigurationActor> ThreadConfigurationActor::create(DevToolsServer& devtools, ByteString name)
|
|
{
|
|
return adopt_ref(*new ThreadConfigurationActor(devtools, move(name)));
|
|
}
|
|
|
|
ThreadConfigurationActor::ThreadConfigurationActor(DevToolsServer& devtools, ByteString name)
|
|
: Actor(devtools, move(name))
|
|
{
|
|
}
|
|
|
|
ThreadConfigurationActor::~ThreadConfigurationActor() = default;
|
|
|
|
void ThreadConfigurationActor::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 ThreadConfigurationActor::serialize_configuration() const
|
|
{
|
|
JsonObject target;
|
|
target.set("actor"sv, name());
|
|
|
|
return target;
|
|
}
|
|
|
|
}
|