mirror of
https://github.com/servo/servo.git
synced 2025-06-14 03:14:29 +00:00
script_trask, handle_msgs: factored out handle_msg_from_script
This commit is contained in:
parent
8da73afa06
commit
1fc46471ff
1 changed files with 28 additions and 11 deletions
|
@ -540,17 +540,7 @@ impl ScriptTask {
|
||||||
FromConstellation(ExitPipelineMsg(id)) =>
|
FromConstellation(ExitPipelineMsg(id)) =>
|
||||||
if self.handle_exit_pipeline_msg(id) { return false },
|
if self.handle_exit_pipeline_msg(id) { return false },
|
||||||
FromConstellation(inner_msg) => self.handle_msg_from_constellation(inner_msg),
|
FromConstellation(inner_msg) => self.handle_msg_from_constellation(inner_msg),
|
||||||
FromScript(TriggerLoadMsg(id, load_data)) => self.trigger_load(id, load_data),
|
FromScript(inner_msg) => self.handle_msg_from_script(inner_msg),
|
||||||
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),
|
|
||||||
FromDevtools(EvaluateJS(id, s, reply)) => devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply),
|
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(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),
|
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) {
|
fn handle_new_layout(&self, new_layout_info: NewLayoutInfo) {
|
||||||
let NewLayoutInfo {
|
let NewLayoutInfo {
|
||||||
old_pipeline_id,
|
old_pipeline_id,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue