diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-12-22 18:19:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-22 18:19:48 -0800 |
commit | f0a74ee0d2048242a480254bd525e730707973c0 (patch) | |
tree | b51f9c317569582ae33b4c2fe3ac52202bde43c9 /components/script/script_thread.rs | |
parent | 89cdcbc420d82aade20a2ee704fdea295dec437a (diff) | |
parent | 8ca387c0e067a723ca649ded958879e66535f66c (diff) | |
download | servo-f0a74ee0d2048242a480254bd525e730707973c0.tar.gz servo-f0a74ee0d2048242a480254bd525e730707973c0.zip |
Auto merge of #14679 - jdm:nowarntimer, r=asajeffrey
Warn when a timer event is processed for a discarded document.
Turn a panic into a warning for a situation that is easy to hit in web content.
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14677
- [X] There are tests for these changes
<!-- 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/14679)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r-- | components/script/script_thread.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index c2d8deec622..538ce0b5f8c 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -1049,8 +1049,11 @@ impl ScriptThread { TimerSource::FromWorker => panic!("Worker timeouts must not be sent to script thread"), }; - let window = self.documents.borrow().find_window(pipeline_id) - .expect("ScriptThread: received fire timer msg for a pipeline not in this script thread. This is a bug."); + let window = self.documents.borrow().find_window(pipeline_id); + let window = match window { + Some(w) => w, + None => return warn!("Received fire timer msg for a closed pipeline {}.", pipeline_id), + }; window.handle_fire_timer(id); } |