aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorGilbert Röhrbein <gilbert@ifsr.de>2014-12-04 13:39:01 +0100
committerMs2ger <ms2ger@gmail.com>2014-12-12 23:54:52 +0100
commit1fc46471ffb35bb0457555c80604e7d2e637554b (patch)
treeff42ba868011a6f19dfdd683d13768265378c41e /components/script
parent8da73afa06a89369a7506f44dc12c93b74392344 (diff)
downloadservo-1fc46471ffb35bb0457555c80604e7d2e637554b.tar.gz
servo-1fc46471ffb35bb0457555c80604e7d2e637554b.zip
script_trask, handle_msgs: factored out handle_msg_from_script
Diffstat (limited to 'components/script')
-rw-r--r--components/script/script_task.rs39
1 files changed, 28 insertions, 11 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index bd420f88048..2ec6699a60e 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -540,17 +540,7 @@ impl ScriptTask {
FromConstellation(ExitPipelineMsg(id)) =>
if self.handle_exit_pipeline_msg(id) { return false },
FromConstellation(inner_msg) => self.handle_msg_from_constellation(inner_msg),
- FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data),
- FromScript(TriggerFragmentMsg(id, url)) => self.trigger_fragment(id, url),
- FromScript(FireTimerMsg(FromWindow(id), timer_id)) => self.handle_fire_timer_msg(id, timer_id),
- FromScript(FireTimerMsg(FromWorker, _)) => panic!("Worker timeouts must not be sent to script task"),
- FromScript(NavigateMsg(direction)) => self.handle_navigate_msg(direction),
- FromScript(ExitWindowMsg(id)) => self.handle_exit_window_msg(id),
- FromScript(XHRProgressMsg(addr, progress)) => XMLHttpRequest::handle_progress(addr, progress),
- FromScript(XHRReleaseMsg(addr)) => XMLHttpRequest::handle_release(addr),
- FromScript(DOMMessage(..)) => panic!("unexpected message"),
- FromScript(WorkerPostMessage(addr, data, nbytes)) => Worker::handle_message(addr, data, nbytes),
- FromScript(WorkerRelease(addr)) => Worker::handle_release(addr),
+ FromScript(inner_msg) => self.handle_msg_from_script(inner_msg),
FromDevtools(EvaluateJS(id, s, reply)) => devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply),
FromDevtools(GetRootNode(id, reply)) => devtools::handle_get_root_node(&*self.page.borrow(), id, reply),
FromDevtools(GetDocumentElement(id, reply)) => devtools::handle_get_document_element(&*self.page.borrow(), id, reply),
@@ -592,6 +582,33 @@ impl ScriptTask {
}
}
+ fn handle_msg_from_script(&self, msg: ScriptMsg) {
+ match msg {
+ TriggerLoadMsg(id, load_data) =>
+ self.trigger_load(id, load_data),
+ TriggerFragmentMsg(id, url) =>
+ self.trigger_fragment(id, url),
+ FireTimerMsg(FromWindow(id), timer_id) =>
+ self.handle_fire_timer_msg(id, timer_id),
+ FireTimerMsg(FromWorker, _) =>
+ panic!("Worker timeouts must not be sent to script task"),
+ NavigateMsg(direction) =>
+ self.handle_navigate_msg(direction),
+ ExitWindowMsg(id) =>
+ self.handle_exit_window_msg(id),
+ XHRProgressMsg(addr, progress) =>
+ XMLHttpRequest::handle_progress(addr, progress),
+ XHRReleaseMsg(addr) =>
+ XMLHttpRequest::handle_release(addr),
+ DOMMessage(..) =>
+ panic!("unexpected message"),
+ WorkerPostMessage(addr, data, nbytes) =>
+ Worker::handle_message(addr, data, nbytes),
+ WorkerRelease(addr) =>
+ Worker::handle_release(addr),
+ }
+ }
+
fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) {
let NewLayoutInfo {
old_pipeline_id,