Close Servo live sessions for removed tabs

This commit is contained in:
2026-05-13 02:41:54 -04:00
parent 74731d4faa
commit ac84a80d9e
11 changed files with 133 additions and 5 deletions
@@ -99,6 +99,10 @@ impl ServoLiveClient {
self.request(LiveRequest::Poll { tab_id })
}
pub fn close(&mut self, tab_id: String) -> Result<(), ServoLiveError> {
self.request(LiveRequest::Close { tab_id }).map(|_| ())
}
fn request(&mut self, request: LiveRequest) -> Result<Option<ServoLiveFrame>, ServoLiveError> {
serde_json::to_writer(&mut self.stdin, &request)?;
self.stdin.write_all(b"\n").map_err(ServoLiveError::Command)?;