aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-11-24 04:57:50 -0800
committerGitHub <noreply@github.com>2016-11-24 04:57:50 -0800
commit99c4821485de30eabc0eb81af9cc5e5102e2f3f6 (patch)
treeff16a33ad0c12463cd41468dc98c361843503a4e /components/script/script_thread.rs
parent1321c0704dead3421221cb7581fa261a82603f87 (diff)
parentfb6cefcb78fa4f15ece887800308de997bbfc8f5 (diff)
downloadservo-99c4821485de30eabc0eb81af9cc5e5102e2f3f6.tar.gz
servo-99c4821485de30eabc0eb81af9cc5e5102e2f3f6.zip
Auto merge of #14344 - asajeffrey:script-thread-new-layout-use-incomplete-loads, r=jdm
Script thread creating layout thread should use the incomplete loads <!-- Please describe your changes on the following line: --> When a script thread creates a new layout thread, it does so by sending a message to an existing layout thread asking it to spawn. At the moment, we're only looking at the completed loads for that layout thread, so we can get a panic if two loads happen in quick succession. The temporary fix is to look for the layout thread in the incomplete loads too. --- <!-- 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 #14333. - [X] These changes do not require tests because it fixes a panic. <!-- 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/14344) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 135fccf58c3..b902c6df101 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1201,10 +1201,14 @@ impl ScriptThread {
});
// Pick a layout thread, any layout thread
- match self.documents.borrow().iter().next() {
+ let current_layout_chan = self.documents.borrow().iter().next()
+ .map(|(_, document)| document.window().layout_chan().clone())
+ .or_else(|| self.incomplete_loads.borrow().first().map(|load| load.layout_chan.clone()));
+
+ match current_layout_chan {
None => panic!("Layout attached to empty script thread."),
// Tell the layout thread factory to actually spawn the thread.
- Some((_, document)) => document.window().layout_chan().send(msg).unwrap(),
+ Some(layout_chan) => layout_chan.send(msg).unwrap(),
};
// Kick off the fetch for the new resource.