mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
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:
parent
a7b577126a
commit
4ce10f3bf4
Notes:
github-actions[bot]
2025-03-12 16:49:10 +00:00
Author: https://github.com/trflynn89
Commit: 4ce10f3bf4
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3904
19 changed files with 19 additions and 76 deletions
|
@ -96,7 +96,6 @@ NodeActor::~NodeActor() = default;
|
|||
void NodeActor::handle_message(StringView type, JsonObject const& message)
|
||||
{
|
||||
JsonObject response;
|
||||
response.set("from"sv, name());
|
||||
|
||||
if (type == "getUniqueSelector"sv) {
|
||||
auto dom_node = WalkerActor::dom_node_for(m_walker, name());
|
||||
|
@ -136,7 +135,7 @@ void NodeActor::handle_message(StringView type, JsonObject const& message)
|
|||
}
|
||||
|
||||
if (auto self = weak_self.strong_ref())
|
||||
self->finished_editing_dom_node(move(block_token));
|
||||
self->send_message({}, move(block_token));
|
||||
};
|
||||
|
||||
if (attribute_to_replace.has_value()) {
|
||||
|
@ -172,7 +171,7 @@ void NodeActor::handle_message(StringView type, JsonObject const& message)
|
|||
}
|
||||
|
||||
if (auto self = weak_self.strong_ref())
|
||||
self->finished_editing_dom_node(move(block_token));
|
||||
self->send_message({}, move(block_token));
|
||||
});
|
||||
|
||||
return;
|
||||
|
@ -181,11 +180,4 @@ void NodeActor::handle_message(StringView type, JsonObject const& message)
|
|||
send_unrecognized_packet_type_error(type);
|
||||
}
|
||||
|
||||
void NodeActor::finished_editing_dom_node(BlockToken block_token)
|
||||
{
|
||||
JsonObject message;
|
||||
message.set("from"sv, name());
|
||||
send_message(move(message), move(block_token));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue