aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/script/script_task.rs
diff options
context:
space:
mode:
authorLars Bergstrom <lars@lars.com>2014-01-15 15:26:39 -0600
committerLars Bergstrom <lars@lars.com>2014-01-15 15:26:39 -0600
commit342844ed7b5684d67e16ca74ada6dcdb7bcf92fc (patch)
treef48ed6f3637ee2ac6dbe38bfc7adbd94d6a6e649 /src/components/script/script_task.rs
parent3e6ff80f18f3407eda6a445db1f4f56b592127b5 (diff)
downloadservo-342844ed7b5684d67e16ca74ada6dcdb7bcf92fc.tar.gz
servo-342844ed7b5684d67e16ca74ada6dcdb7bcf92fc.zip
When `window.close()` is called, we should just ask the compositor to exit
normally. The old code made the mistake of attempting to shutdown the associated pipelines itself, which caused race conditions with the constellation and compositor, as they expect to be able to drain their message queues before exiting.
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r--src/components/script/script_task.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs
index 9ca9af2f8a6..8034822e9d9 100644
--- a/src/components/script/script_task.rs
+++ b/src/components/script/script_task.rs
@@ -531,10 +531,7 @@ impl ScriptTask {
ReflowCompleteMsg(id, reflow_id) => self.handle_reflow_complete_msg(id, reflow_id),
ResizeInactiveMsg(id, new_size) => self.handle_resize_inactive_msg(id, new_size),
ExitPipelineMsg(id) => if self.handle_exit_pipeline_msg(id) { return false },
- ExitWindowMsg(id) => {
- self.handle_exit_window_msg(id);
- return false
- },
+ ExitWindowMsg(id) => self.handle_exit_window_msg(id),
ResizeMsg(..) => fail!("should have handled ResizeMsg already"),
}
}
@@ -614,9 +611,13 @@ impl ScriptTask {
}
}
- fn handle_exit_window_msg(&mut self, id: PipelineId) {
+ /// We have gotten a window.close from script, which we pass on to the compositor.
+ /// We do not shut down the script task now, because the compositor will ask the
+ /// constellation to shut down the pipeline, which will clean everything up
+ /// normally. If we do exit, we will tear down the DOM nodes, possibly at a point
+ /// where layout is still accessing them.
+ fn handle_exit_window_msg(&mut self, _: PipelineId) {
debug!("script task handling exit window msg");
- self.handle_exit_pipeline_msg(id);
// TODO(tkuehn): currently there is only one window,
// so this can afford to be naive and just shut down the