diff --git a/components/layout_2020/dom_traversal.rs b/components/layout_2020/dom_traversal.rs index a8f5a17fc1d..c043d3b75d3 100644 --- a/components/layout_2020/dom_traversal.rs +++ b/components/layout_2020/dom_traversal.rs @@ -346,8 +346,10 @@ impl BoxSlot<'_> { impl Drop for BoxSlot<'_> { fn drop(&mut self) { - if let Some(slot) = &mut self.slot { - assert!(slot.borrow().is_some(), "failed to set a layout box"); + if !std::thread::panicking() { + if let Some(slot) = &mut self.slot { + assert!(slot.borrow().is_some(), "failed to set a layout box"); + } } } }