LibDevTools: Automatically set the "from" field for server responses

The "from" field is required in every response. It is the name of the
actor sending the message. This patch fills in the "from" field in the
Actor base class so that subclasses don't have to.
This commit is contained in:
Timothy Flynn 2025-03-11 08:15:23 -04:00 committed by Tim Flynn
commit 4ce10f3bf4
Notes: github-actions[bot] 2025-03-12 16:49:10 +00:00
19 changed files with 19 additions and 76 deletions

View file

@ -54,7 +54,6 @@ FrameActor::~FrameActor()
void FrameActor::handle_message(StringView type, JsonObject const&)
{
JsonObject response;
response.set("from"sv, name());
if (type == "detach"sv) {
if (auto tab = m_tab.strong_ref()) {
@ -88,7 +87,6 @@ void FrameActor::send_frame_update_message()
}
JsonObject message;
message.set("from"sv, name());
message.set("type"sv, "frameUpdate"sv);
message.set("frames"sv, move(frames));
send_message(move(message));
@ -198,7 +196,6 @@ void FrameActor::console_messages_received(i32 start_index, Vector<WebView::Cons
array.must_append(move(console_message));
JsonObject message;
message.set("from"sv, name());
message.set("type"sv, "resources-available-array"sv);
message.set("array"sv, move(array));
send_message(move(message));