diff options
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/document_loader.rs | 5 | ||||
-rw-r--r-- | components/script/script_thread.rs | 12 |
2 files changed, 9 insertions, 8 deletions
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs index 8fd447350f4..dac891053d7 100644 --- a/components/script/document_loader.rs +++ b/components/script/document_loader.rs @@ -14,7 +14,6 @@ use net_traits::request::RequestInit; use net_traits::{CoreResourceMsg, FetchChannels, FetchResponseMsg}; use net_traits::{IpcSend, ResourceThreads}; use servo_url::ServoUrl; -use std::thread; #[derive(Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)] pub enum LoadType { @@ -77,8 +76,8 @@ impl LoadBlocker { impl Drop for LoadBlocker { fn drop(&mut self) { - if !thread::panicking() { - debug_assert!(self.load.is_none()); + if let Some(load) = self.load.take() { + self.doc.finish_load(load); } } } diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index 9e20b09ef20..41a7192e70a 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -809,11 +809,13 @@ impl ScriptThread { pub fn mark_document_with_no_blocked_loads(doc: &Document) { SCRIPT_THREAD_ROOT.with(|root| { - let script_thread = unsafe { &*root.get().unwrap() }; - script_thread - .docs_with_no_blocking_loads - .borrow_mut() - .insert(Dom::from_ref(doc)); + if let Some(script_thread) = root.get() { + let script_thread = unsafe { &*script_thread }; + script_thread + .docs_with_no_blocking_loads + .borrow_mut() + .insert(Dom::from_ref(doc)); + } }) } |