Persuading devtools to communicate with the workers; r=jdm

This commit is contained in:
Ravi Shankar 2015-08-01 21:25:49 +05:30
parent 4de6e699b2
commit 79b65402d7
7 changed files with 161 additions and 56 deletions

View file

@ -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>,