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

@ -31,7 +31,6 @@ PageStyleActor::~PageStyleActor() = default;
void PageStyleActor::handle_message(StringView type, JsonObject const& message)
{
JsonObject response;
response.set("from"sv, name());
if (type == "getApplied"sv) {
// FIXME: This provides information to the "styles" pane in the inspector tab, which allows toggling and editing
@ -119,7 +118,6 @@ void PageStyleActor::inspect_dom_node(StringView node_actor, Callback&& callback
void PageStyleActor::received_layout(JsonObject const& computed_style, JsonObject const& node_box_sizing, BlockToken block_token)
{
JsonObject message;
message.set("from"sv, name());
message.set("autoMargins"sv, JsonObject {});
auto pixel_value = [&](auto const& object, auto key) {
@ -175,7 +173,6 @@ void PageStyleActor::received_computed_style(JsonObject const& computed_style, B
});
JsonObject message;
message.set("from"sv, name());
message.set("computed"sv, move(computed));
send_message(move(message), move(block_token));
}