Do not glob-export DevtoolScriptControlMsg variants.

This commit is contained in:
Ruud van Asseldonk 2015-02-13 13:35:31 +01:00
parent 1452614e28
commit 6ff3a5a3c1
5 changed files with 20 additions and 18 deletions

View file

@ -9,7 +9,7 @@
use actor::{Actor, ActorRegistry}; use actor::{Actor, ActorRegistry};
use protocol::JsonPacketStream; use protocol::JsonPacketStream;
use devtools_traits::{EvaluateJS, NullValue, VoidValue, NumberValue, StringValue, BooleanValue}; use devtools_traits::{NullValue, VoidValue, NumberValue, StringValue, BooleanValue};
use devtools_traits::{ActorValue, DevtoolScriptControlMsg}; use devtools_traits::{ActorValue, DevtoolScriptControlMsg};
use msg::constellation_msg::PipelineId; use msg::constellation_msg::PipelineId;
@ -221,7 +221,8 @@ impl Actor for ConsoleActor {
"evaluateJS" => { "evaluateJS" => {
let input = msg.get(&"text".to_string()).unwrap().as_string().unwrap().to_string(); let input = msg.get(&"text".to_string()).unwrap().as_string().unwrap().to_string();
let (chan, port) = channel(); let (chan, port) = channel();
self.script_chan.send(EvaluateJS(self.pipeline, input.clone(), chan)).unwrap(); self.script_chan.send(DevtoolScriptControlMsg::EvaluateJS(
self.pipeline, input.clone(), chan)).unwrap();
//TODO: extract conversion into protocol module or some other useful place //TODO: extract conversion into protocol module or some other useful place
let result = match try!(port.recv().map_err(|_| ())) { let result = match try!(port.recv().map_err(|_| ())) {

View file

@ -4,8 +4,9 @@
/// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js). /// Liberally derived from the [Firefox JS implementation](http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/inspector.js).
use devtools_traits::{GetRootNode, GetDocumentElement, GetChildren, DevtoolScriptControlMsg}; use devtools_traits::{DevtoolScriptControlMsg, NodeInfo};
use devtools_traits::{GetLayout, NodeInfo, ModifyAttribute}; use devtools_traits::DevtoolScriptControlMsg::{GetRootNode, GetDocumentElement, GetChildren};
use devtools_traits::DevtoolScriptControlMsg::{GetLayout, ModifyAttribute};
use actor::{Actor, ActorRegistry}; use actor::{Actor, ActorRegistry};
use protocol::JsonPacketStream; use protocol::JsonPacketStream;

View file

@ -8,7 +8,7 @@
use actor::{Actor, ActorRegistry}; use actor::{Actor, ActorRegistry};
use actors::console::ConsoleActor; use actors::console::ConsoleActor;
use devtools_traits::WantsLiveNotifications; use devtools_traits::DevtoolScriptControlMsg;
use protocol::JsonPacketStream; use protocol::JsonPacketStream;
use serialize::json; use serialize::json;
@ -100,7 +100,8 @@ impl Actor for TabActor {
let console_actor = registry.find::<ConsoleActor>(self.console.as_slice()); let console_actor = registry.find::<ConsoleActor>(self.console.as_slice());
console_actor.streams.borrow_mut().push(stream.clone()); console_actor.streams.borrow_mut().push(stream.clone());
stream.write_json_packet(&msg); stream.write_json_packet(&msg);
console_actor.script_chan.send(WantsLiveNotifications(console_actor.pipeline, true)).unwrap(); console_actor.script_chan.send(
DevtoolScriptControlMsg::WantsLiveNotifications(console_actor.pipeline, true)).unwrap();
true true
} }
@ -114,7 +115,8 @@ impl Actor for TabActor {
let console_actor = registry.find::<ConsoleActor>(self.console.as_slice()); let console_actor = registry.find::<ConsoleActor>(self.console.as_slice());
console_actor.streams.borrow_mut().pop(); console_actor.streams.borrow_mut().pop();
stream.write_json_packet(&msg); stream.write_json_packet(&msg);
console_actor.script_chan.send(WantsLiveNotifications(console_actor.pipeline, false)).unwrap(); console_actor.script_chan.send(
DevtoolScriptControlMsg::WantsLiveNotifications(console_actor.pipeline, false)).unwrap();
true true
} }

View file

@ -20,7 +20,6 @@ extern crate "serialize" as rustc_serialize;
extern crate url; extern crate url;
extern crate util; extern crate util;
pub use self::DevtoolScriptControlMsg::*;
pub use self::EvaluateJSReply::*; pub use self::EvaluateJSReply::*;
use rustc_serialize::{Decodable, Decoder}; use rustc_serialize::{Decodable, Decoder};

View file

@ -41,9 +41,8 @@ use page::{Page, IterablePage, Frame};
use timers::TimerId; use timers::TimerId;
use devtools; use devtools;
use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, GetRootNode, DevtoolsPageInfo}; use devtools_traits::{DevtoolsControlChan, DevtoolsControlPort, DevtoolsPageInfo};
use devtools_traits::{DevtoolsControlMsg, DevtoolScriptControlMsg, EvaluateJS, GetDocumentElement}; use devtools_traits::{DevtoolsControlMsg, DevtoolScriptControlMsg};
use devtools_traits::{GetChildren, GetLayout, ModifyAttribute, WantsLiveNotifications};
use script_traits::CompositorEvent; use script_traits::CompositorEvent;
use script_traits::CompositorEvent::{ResizeEvent, ReflowEvent, ClickEvent}; use script_traits::CompositorEvent::{ResizeEvent, ReflowEvent, ClickEvent};
use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent}; use script_traits::CompositorEvent::{MouseDownEvent, MouseUpEvent};
@ -633,19 +632,19 @@ impl ScriptTask {
fn handle_msg_from_devtools(&self, msg: DevtoolScriptControlMsg) { fn handle_msg_from_devtools(&self, msg: DevtoolScriptControlMsg) {
match msg { match msg {
EvaluateJS(id, s, reply) => DevtoolScriptControlMsg::EvaluateJS(id, s, reply) =>
devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply), devtools::handle_evaluate_js(&*self.page.borrow(), id, s, reply),
GetRootNode(id, reply) => DevtoolScriptControlMsg::GetRootNode(id, reply) =>
devtools::handle_get_root_node(&*self.page.borrow(), id, reply), devtools::handle_get_root_node(&*self.page.borrow(), id, reply),
GetDocumentElement(id, reply) => DevtoolScriptControlMsg::GetDocumentElement(id, reply) =>
devtools::handle_get_document_element(&*self.page.borrow(), id, reply), devtools::handle_get_document_element(&*self.page.borrow(), id, reply),
GetChildren(id, node_id, reply) => DevtoolScriptControlMsg::GetChildren(id, node_id, reply) =>
devtools::handle_get_children(&*self.page.borrow(), id, node_id, reply), devtools::handle_get_children(&*self.page.borrow(), id, node_id, reply),
GetLayout(id, node_id, reply) => DevtoolScriptControlMsg::GetLayout(id, node_id, reply) =>
devtools::handle_get_layout(&*self.page.borrow(), id, node_id, reply), devtools::handle_get_layout(&*self.page.borrow(), id, node_id, reply),
ModifyAttribute(id, node_id, modifications) => DevtoolScriptControlMsg::ModifyAttribute(id, node_id, modifications) =>
devtools::handle_modify_attribute(&*self.page.borrow(), id, node_id, modifications), devtools::handle_modify_attribute(&*self.page.borrow(), id, node_id, modifications),
WantsLiveNotifications(pipeline_id, to_send) => DevtoolScriptControlMsg::WantsLiveNotifications(pipeline_id, to_send) =>
devtools::handle_wants_live_notifications(&*self.page.borrow(), pipeline_id, to_send), devtools::handle_wants_live_notifications(&*self.page.borrow(), pipeline_id, to_send),
} }
} }