diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2019-03-18 15:44:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-18 15:44:36 -0400 |
commit | 0fac8f2f62aff22897a0ca657a840333827cabf0 (patch) | |
tree | c2a5ea7a392f899ff5760591203d69d0e8fe6adf | |
parent | db7bb2a5101ea6042654b59b3b81725e2da65891 (diff) | |
parent | be82d7c9058cd22c54b01a4b6aa0858307364f6c (diff) | |
download | servo-0fac8f2f62aff22897a0ca657a840333827cabf0.tar.gz servo-0fac8f2f62aff22897a0ca657a840333827cabf0.zip |
Auto merge of #23021 - ejmg:assert_fail_#18439, r=jdm
Assert fail #18439
<!-- Please describe your changes on the following line: -->
This PR addresses #18439 by removing an assert statement that forces a panic whenever `LoadBlocker` is dropped during a GC sweep and receives a `None` `SCRIPT_THREAD_ROOT` value from `mark_document_with_no_blocked_loads()`. Instead of panicking on the assert, we remove it and let the None value pass silently.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #18439
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/23021)
<!-- Reviewable:end -->
-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)); + } }) } |