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 <dazabani@igalia.com>
Co-authored-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
shuppy 2025-08-08 22:11:23 +08:00 committed by GitHub
parent 4257db643b
commit 9866ca7e59
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
}) {
// <https://firefox-source-docs.mozilla.org/devtools/backend/protocol.html#error-packets>
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);
}
},
}