From 32f19c1eae3ead86987fa353f3f3e7e6fadb47eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20W=C3=BClker?= Date: Mon, 17 Feb 2025 22:33:11 +0100 Subject: [PATCH] Don't attempt to report style attribute for non-htmlelements to devtools (#35519) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Simon Wülker --- components/script/devtools.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/script/devtools.rs b/components/script/devtools.rs index 7718486c14d..66e22fc7b4e 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -198,9 +198,11 @@ pub(crate) fn handle_get_attribute_style( Some(found_node) => found_node, }; - let elem = node - .downcast::() - .expect("This should be an HTMLElement"); + let Some(elem) = node.downcast::() else { + // the style attribute only works on html elements + reply.send(None).unwrap(); + return; + }; let style = elem.Style(); let msg = (0..style.Length())