aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorAntoine Martin <antoine97.martin@gmail.com>2020-07-03 03:33:59 +0200
committerAntoine Martin <antoine97.martin@gmail.com>2020-07-03 20:00:26 +0200
commit36fbbea2b558c6646d58d217c9103a320d451fc7 (patch)
treef1ff25d9377341db5a1283725cf04e7f9b30488e /components/script/script_thread.rs
parent4d60fd8ea9cb58166f9684e177404260b0401517 (diff)
downloadservo-36fbbea2b558c6646d58d217c9103a320d451fc7.tar.gz
servo-36fbbea2b558c6646d58d217c9103a320d451fc7.zip
Return Option for Window's layout channel
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index 0ef48e78b17..067fce6b08e 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -1172,9 +1172,13 @@ impl ScriptThread {
);
},
};
- let _ = window
- .layout_chan()
- .send(Msg::RegisterPaint(name, properties, painter));
+
+ match window.layout_chan() {
+ Some(chan) => chan
+ .send(Msg::RegisterPaint(name, properties, painter))
+ .unwrap(),
+ None => warn!("Layout channel unavailable"),
+ }
}
pub fn push_new_element_queue() {
@@ -2467,12 +2471,12 @@ impl ScriptThread {
});
// Pick a layout thread, any layout thread
- let current_layout_chan = self
+ let current_layout_chan: Option<Sender<Msg>> = self
.documents
.borrow()
.iter()
.next()
- .map(|(_, document)| document.window().layout_chan().clone())
+ .and_then(|(_, document)| document.window().layout_chan().cloned())
.or_else(|| {
self.incomplete_loads
.borrow()
@@ -2879,7 +2883,10 @@ impl ScriptThread {
let load = self.incomplete_loads.borrow_mut().remove(idx);
load.layout_chan.clone()
} else if let Some(ref document) = document {
- document.window().layout_chan().clone()
+ match document.window().layout_chan() {
+ Some(chan) => chan.clone(),
+ None => return warn!("Layout channel unavailable"),
+ }
} else {
return warn!("Exiting nonexistant pipeline {}.", id);
};