From 9866ca7e59a848ad9ec33ff96d5de0ef15c813c4 Mon Sep 17 00:00:00 2001 From: shuppy Date: Fri, 8 Aug 2025 22:11:23 +0800 Subject: [PATCH] devtools: Warn when sending common protocol errors (#38548) #37686 fixed an entire class of devtools protocol bugs that led to protocol desyncs with warnings in the Servo log, but it also removed the warnings, making it harder to spot where our devtools impl is incomplete. this patch reintroduces a warning whenever some Actor::handle_message() returns Err(ActorError). Testing: debug logging only, so not really worth testing --------- Signed-off-by: Delan Azabani Co-authored-by: atbrakhi Co-authored-by: Martin Robinson --- components/devtools/actor.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/devtools/actor.rs b/components/devtools/actor.rs index 9ee43dcb13a..b40b08b6a59 100644 --- a/components/devtools/actor.rs +++ b/components/devtools/actor.rs @@ -11,7 +11,7 @@ use std::sync::{Arc, Mutex}; use base::cross_process_instant::CrossProcessInstant; use base::id::PipelineId; -use log::debug; +use log::{debug, warn}; use serde_json::{Map, Value, json}; use crate::StreamId; @@ -223,9 +223,11 @@ impl ActorRegistry { actor.handle_message(req, self, msg_type, msg, stream_id) }) { // - let _ = stream.write_json_packet(&json!({ + let error = json!({ "from": actor.name(), "error": error.name() - })); + }); + warn!("Sending devtools protocol error: error={error:?} request={msg:?}"); + let _ = stream.write_json_packet(&error); } }, }