script: Don't panic when trying to de-activate accessibility (#44473)

When reloading, the pipeline is closed before we get the chance to set
accessibility inactive, which we do for pipelines which stick around in
the bfcache. We don't need to panic if we're trying to de-activate
accessibility and the pipeline is already closed.

Trying to activate accessibility on a closed pipeline is an error we
should investigate, but probably also not a panic-worthy condition.

Testing: Not sure how to test this beyond manual testing. Manual
testing: run servoshell with `--pref accessibility_enabled` and reload
any page.

Signed-off-by: Alice Boxhall <alice@igalia.com>
This commit is contained in:
Alice
2026-04-24 10:19:00 +02:00
committed by GitHub
parent d812d2f1a7
commit 61203e68b9

View File

@@ -3723,11 +3723,13 @@ impl ScriptThread {
return;
}
let document = self
.documents
.borrow()
.find_document(pipeline_id)
.expect("Got pipeline_id from self.documents");
let Some(document) = self.documents.borrow().find_document(pipeline_id) else {
if active {
error!("Trying to set accessibility active on stale document: {pipeline_id}");
}
return;
};
document
.window()
.layout()