aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorFuguo <1782765876@qq.com>2025-04-30 03:04:22 +0800
committerGitHub <noreply@github.com>2025-04-29 19:04:22 +0000
commitbab788f5d541bd18da75331040d4cc6132723de4 (patch)
tree586a3f593f482e5d6087a6de55a6d5289c4aece2 /components/script
parentb6a89ae40861b1ca0a15fb61f4e963955a992bda (diff)
downloadservo-bab788f5d541bd18da75331040d4cc6132723de4.tar.gz
servo-bab788f5d541bd18da75331040d4cc6132723de4.zip
fix crash occurs when the focus element is adopted (#36608)
fix crash occurs when the focus element is adopted. Testing: wpt dom/nodes/insertion-removing-steps/blur-event.window.html not crash Fixes: #36607 #32972 --------- Signed-off-by: kongbai1996 <1782765876@qq.com>
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/document.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 1e2a3747751..ec2ad98c464 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -1180,7 +1180,9 @@ impl Document {
let node = elem.upcast::<Node>();
elem.set_focus_state(false);
// FIXME: pass appropriate relatedTarget
- self.fire_focus_event(FocusEventType::Blur, node, None, can_gc);
+ if node.is_connected() {
+ self.fire_focus_event(FocusEventType::Blur, node, None, can_gc);
+ }
// Notify the embedder to hide the input method.
if elem.input_method_type().is_some() {