aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/devtools.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/devtools.rs')
-rw-r--r--components/script/devtools.rs26
1 files changed, 16 insertions, 10 deletions
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index d515d1fb99a..4163ee426ed 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -13,13 +13,13 @@ use dom::bindings::codegen::Bindings::ElementBinding::ElementMethods;
use dom::bindings::codegen::Bindings::LocationBinding::LocationMethods;
use dom::bindings::codegen::Bindings::WindowBinding::WindowMethods;
use dom::bindings::conversions::{ConversionResult, FromJSValConvertible, jsstring_to_str};
-use dom::bindings::global::GlobalRef;
use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::Reflectable;
use dom::bindings::str::DOMString;
use dom::browsingcontext::BrowsingContext;
use dom::element::Element;
+use dom::globalscope::GlobalScope;
use dom::node::Node;
use dom::window::Window;
use ipc_channel::ipc::IpcSender;
@@ -33,7 +33,7 @@ use uuid::Uuid;
#[allow(unsafe_code)]
-pub fn handle_evaluate_js(global: &GlobalRef, eval: String, reply: IpcSender<EvaluateJSReply>) {
+pub fn handle_evaluate_js(global: &GlobalScope, eval: String, reply: IpcSender<EvaluateJSReply>) {
// global.get_cx() returns a valid `JSContext` pointer, so this is safe.
let result = unsafe {
let cx = global.get_cx();
@@ -146,7 +146,7 @@ pub fn handle_get_layout(context: &BrowsingContext,
let window = context.active_window();
let elem = node.downcast::<Element>().expect("should be getting layout of element");
- let computed_style = window.r().GetComputedStyle(elem, None);
+ let computed_style = window.GetComputedStyle(elem, None);
reply.send(Some(ComputedNodeLayout {
display: String::from(computed_style.Display()),
@@ -245,21 +245,26 @@ pub fn handle_modify_attribute(context: &BrowsingContext,
}
}
-pub fn handle_wants_live_notifications(global: &GlobalRef, send_notifications: bool) {
+pub fn handle_wants_live_notifications(global: &GlobalScope, send_notifications: bool) {
global.set_devtools_wants_updates(send_notifications);
}
pub fn handle_set_timeline_markers(context: &BrowsingContext,
+ pipeline: PipelineId,
marker_types: Vec<TimelineMarkerType>,
- reply: IpcSender<TimelineMarker>) {
- let window = context.active_window();
- window.set_devtools_timeline_markers(marker_types, reply);
+ reply: IpcSender<Option<TimelineMarker>>) {
+ match context.find(pipeline) {
+ None => reply.send(None).unwrap(),
+ Some(context) => context.active_window().set_devtools_timeline_markers(marker_types, reply),
+ }
}
pub fn handle_drop_timeline_markers(context: &BrowsingContext,
+ pipeline: PipelineId,
marker_types: Vec<TimelineMarkerType>) {
- let window = context.active_window();
- window.drop_devtools_timeline_markers(marker_types);
+ if let Some(context) = context.find(pipeline) {
+ context.active_window().drop_devtools_timeline_markers(marker_types);
+ }
}
pub fn handle_request_animation_frame(context: &BrowsingContext,
@@ -271,7 +276,8 @@ pub fn handle_request_animation_frame(context: &BrowsingContext,
};
let doc = context.active_document();
- let devtools_sender = context.active_window().devtools_chan().unwrap();
+ let devtools_sender =
+ context.active_window().upcast::<GlobalScope>().devtools_chan().unwrap().clone();
doc.request_animation_frame(box move |time| {
let msg = ScriptToDevtoolsControlMsg::FramerateTick(actor_name, time);
devtools_sender.send(msg).unwrap();