aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <servo-ops@mozilla.com>2020-07-04 01:30:27 -0400
committerGitHub <noreply@github.com>2020-07-04 01:30:27 -0400
commit8916a42180a9119bf5d8710a30694b1825b97414 (patch)
treefb41477474102ae969a76ce3b059e8817e4c3e2a /components/script/script_thread.rs
parent026760a17b16a7389b1265d741416e0413d3ba04 (diff)
parent36fbbea2b558c6646d58d217c9103a320d451fc7 (diff)
downloadservo-8916a42180a9119bf5d8710a30694b1825b97414.tar.gz
servo-8916a42180a9119bf5d8710a30694b1825b97414.zip
Auto merge of #27163 - alarsyo:23053-layout-queries-disconnected-frames-panic, r=jdm
Return Option for Window's layout channel <!-- Please describe your changes on the following line: --> `Window::layout_chan()` now returns an `Option<Sender<Msg>>`, returning `None` if the window is dead. FIX #26969 FIX #26429 FIX #21208 FIX #19092 FIX #22559 FIX #22584 FIX #22652 --- <!-- 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 #23053 <!-- Either: --> - [x] There are tests for these changes <!-- 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. --> This is my first contribution, I'm trying to figure things out! This fix passes the test case shown in #23053, however I don't know what the behavior should be in `Document` and `ScriptThread` if `Window::is_alive()` is false : simply ignore it, don't do anything ? Or is this something that should not happen now that we return false in `Window::force_reflow()` ? I'm not sure about the directory where the test case should go, any advice?
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 6caba693309..7a439e0dcd6 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);
};