diff options
author | Ravi Shankar <wafflespeanut@gmail.com> | 2015-08-01 21:25:49 +0530 |
---|---|---|
committer | Ravi Shankar <wafflespeanut@gmail.com> | 2015-08-01 21:25:49 +0530 |
commit | 79b65402d70e54af10e11bc859db50fb0d5744c5 (patch) | |
tree | 29bdcfc951341fd8820f2cf7555281518bbf0343 /components/script/devtools.rs | |
parent | 4de6e699b2ee095177360ae1812d9f47829adcc3 (diff) | |
download | servo-79b65402d70e54af10e11bc859db50fb0d5744c5.tar.gz servo-79b65402d70e54af10e11bc859db50fb0d5744c5.zip |
Persuading devtools to communicate with the workers; r=jdm
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r-- | components/script/devtools.rs | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs index b7edc7616a3..8c40af12c73 100644 --- a/components/script/devtools.rs +++ b/components/script/devtools.rs @@ -12,6 +12,7 @@ use dom::bindings::codegen::InheritTypes::{NodeCast, ElementCast}; use dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods; use dom::bindings::codegen::Bindings::DOMRectBinding::{DOMRectMethods}; use dom::bindings::codegen::Bindings::ElementBinding::{ElementMethods}; +use dom::bindings::global::GlobalRef; use dom::node::{Node, NodeHelpers}; use dom::window::{WindowHelpers, ScriptHelpers}; use dom::document::DocumentHelpers; @@ -24,18 +25,10 @@ use js::jsval::UndefinedValue; use std::rc::Rc; - -pub fn handle_evaluate_js( - page: &Rc<Page>, - pipeline: PipelineId, - eval: String, - reply: IpcSender<EvaluateJSReply> - ) { - let page = get_page(&*page, pipeline); - let window = page.window(); - let cx = window.r().get_cx(); +pub fn handle_evaluate_js(global: &GlobalRef, eval: String, reply: IpcSender<EvaluateJSReply>) { + let cx = global.get_cx(); let mut rval = RootedValue::new(cx, UndefinedValue()); - window.r().evaluate_js_on_global_with_result(&eval, rval.handle_mut()); + global.evaluate_js_on_global_with_result(&eval, rval.handle_mut()); reply.send(if rval.ptr.is_undefined() { EvaluateJSReply::VoidValue @@ -43,8 +36,7 @@ pub fn handle_evaluate_js( EvaluateJSReply::BooleanValue(rval.ptr.to_boolean()) } else if rval.ptr.is_double() || rval.ptr.is_int32() { EvaluateJSReply::NumberValue( - FromJSValConvertible::from_jsval(cx, rval.handle(), ()).unwrap() - ) + FromJSValConvertible::from_jsval(cx, rval.handle(), ()).unwrap()) } else if rval.ptr.is_string() { //FIXME: use jsstring_to_str when jsval grows to_jsstring EvaluateJSReply::StringValue( @@ -165,10 +157,8 @@ pub fn handle_modify_attribute(page: &Rc<Page>, } } -pub fn handle_wants_live_notifications(page: &Rc<Page>, pipeline_id: PipelineId, send_notifications: bool) { - let page = get_page(&*page, pipeline_id); - let window = page.window(); - window.r().set_devtools_wants_updates(send_notifications); +pub fn handle_wants_live_notifications(global: &GlobalRef, send_notifications: bool) { + global.set_devtools_wants_updates(send_notifications); } pub fn handle_set_timeline_markers(page: &Rc<Page>, |