LibDevTools: Move message data into a structure

This is to prepare for an upcoming change where we will need to track
replies to messages by ID. We will be able to add parameters to this
structure without having to edit every single actor subclass header
file.
This commit is contained in:
Timothy Flynn 2025-03-12 08:01:23 -04:00 committed by Tim Flynn
commit 24a5e4e7d5
Notes: github-actions[bot] 2025-03-13 20:57:59 +00:00
42 changed files with 162 additions and 146 deletions

View file

@ -28,11 +28,11 @@ TabActor::~TabActor()
reset_selected_node();
}
void TabActor::handle_message(StringView type, JsonObject const&)
void TabActor::handle_message(Message const& message)
{
JsonObject response;
if (type == "getFavicon"sv) {
if (message.type == "getFavicon"sv) {
// FIXME: Firefox DevTools wants a favicon URL here, but supplying a URL seems to prevent this tab from being
// listed on the about:debugging page. Both Servo and Firefox itself supply `null` here.
response.set("favicon"sv, JsonValue {});
@ -40,7 +40,7 @@ void TabActor::handle_message(StringView type, JsonObject const&)
return;
}
if (type == "getWatcher"sv) {
if (message.type == "getWatcher"sv) {
if (!m_watcher)
m_watcher = devtools().register_actor<WatcherActor>(this);
@ -50,7 +50,7 @@ void TabActor::handle_message(StringView type, JsonObject const&)
return;
}
send_unrecognized_packet_type_error(type);
send_unrecognized_packet_type_error(message);
}
JsonObject TabActor::serialize_description() const