aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorJames Graham <james@hoppipolla.co.uk>2015-04-23 12:58:41 +0100
committerJames Graham <james@hoppipolla.co.uk>2015-04-23 16:14:27 +0100
commitc2fc6e311a0cb3ec4c702c77bb5d13f97bd19078 (patch)
tree2ff2f2b65614f94f34181813bd81bf38ca84ade4 /components/script/script_task.rs
parent1b08211a5e9ec00eeaf241b916d51dc665289825 (diff)
downloadservo-c2fc6e311a0cb3ec4c702c77bb5d13f97bd19078.tar.gz
servo-c2fc6e311a0cb3ec4c702c77bb5d13f97bd19078.zip
Add script execution support via WebDriver
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 6886137e48c..6de72745163 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -45,6 +45,7 @@ use layout_interface;
use page::{Page, IterablePage, Frame};
use timers::TimerId;
use devtools;
+use webdriver_handlers;
use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, DevtoolsPageInfo};
use devtools_traits::{DevtoolsControlMsg, DevtoolScriptControlMsg};
@@ -56,6 +57,7 @@ use script_traits::CompositorEvent::{MouseMoveEvent, KeyEvent};
use script_traits::{NewLayoutInfo, OpaqueScriptLayoutChannel};
use script_traits::{ConstellationControlMsg, ScriptControlChan};
use script_traits::ScriptTaskFactory;
+use webdriver_traits::WebDriverScriptCommand;
use msg::compositor_msg::ReadyState::{FinishedLoading, Loading, PerformingLayout};
use msg::compositor_msg::{LayerId, ScriptListener};
use msg::constellation_msg::{ConstellationChan, FocusType};
@@ -727,6 +729,9 @@ impl ScriptTask {
self.handle_update_subpage_id(containing_pipeline_id, old_subpage_id, new_subpage_id),
ConstellationControlMsg::FocusIFrameMsg(containing_pipeline_id, subpage_id) =>
self.handle_focus_iframe_msg(containing_pipeline_id, subpage_id),
+ ConstellationControlMsg::WebDriverCommandMsg(pipeline_id, msg) => {
+ self.handle_webdriver_msg(pipeline_id, msg);
+ }
}
}
@@ -783,6 +788,14 @@ impl ScriptTask {
msg.responder.unwrap().respond(msg.image);
}
+ fn handle_webdriver_msg(&self, pipeline_id: PipelineId, msg: WebDriverScriptCommand) {
+ let page = self.root_page();
+ match msg {
+ WebDriverScriptCommand::EvaluateJS(script, reply) =>
+ webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply)
+ }
+ }
+
fn handle_resize(&self, id: PipelineId, size: WindowSizeData) {
let page = self.page.borrow();
if let Some(ref page) = page.as_ref() {