mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
Auto merge of #5962 - jgraham:webdriver_navigation, r=jdm
<!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5962) <!-- Reviewable:end -->
This commit is contained in:
commit
72c20d8491
5 changed files with 47 additions and 5 deletions
|
@ -791,7 +791,9 @@ impl ScriptTask {
|
|||
let page = self.root_page();
|
||||
match msg {
|
||||
WebDriverScriptCommand::EvaluateJS(script, reply) =>
|
||||
webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply)
|
||||
webdriver_handlers::handle_evaluate_js(&page, pipeline_id, script, reply),
|
||||
WebDriverScriptCommand::GetTitle(reply) =>
|
||||
webdriver_handlers::handle_get_title(&page, pipeline_id, reply)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
use webdriver_traits::{EvaluateJSReply};
|
||||
use dom::bindings::conversions::FromJSValConvertible;
|
||||
use dom::bindings::conversions::StringificationBehavior;
|
||||
use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use dom::bindings::js::{OptionalRootable, Rootable};
|
||||
use dom::window::ScriptHelpers;
|
||||
use dom::document::DocumentHelpers;
|
||||
|
@ -15,7 +16,7 @@ use script_task::get_page;
|
|||
use std::rc::Rc;
|
||||
use std::sync::mpsc::Sender;
|
||||
|
||||
pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, reply: Sender<Result<EvaluateJSReply, ()>>){
|
||||
pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, reply: Sender<Result<EvaluateJSReply, ()>>) {
|
||||
let page = get_page(&*page, pipeline);
|
||||
let window = page.window().root();
|
||||
let cx = window.r().get_cx();
|
||||
|
@ -36,3 +37,7 @@ pub fn handle_evaluate_js(page: &Rc<Page>, pipeline: PipelineId, eval: String, r
|
|||
Err(())
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
pub fn handle_get_title(page: &Rc<Page>, _pipeline: PipelineId, reply: Sender<String>) {
|
||||
reply.send(page.document().root().r().Title()).unwrap();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue