aboutsummaryrefslogtreecommitdiffstats
path: root/components/devtools/actors
diff options
context:
space:
mode:
Diffstat (limited to 'components/devtools/actors')
-rw-r--r--components/devtools/actors/console.rs2
-rw-r--r--components/devtools/actors/tab.rs9
2 files changed, 10 insertions, 1 deletions
diff --git a/components/devtools/actors/console.rs b/components/devtools/actors/console.rs
index dd714d3e220..1e5ea5080cd 100644
--- a/components/devtools/actors/console.rs
+++ b/components/devtools/actors/console.rs
@@ -14,6 +14,7 @@ use devtools_traits::{ActorValue, DevtoolScriptControlMsg};
use servo_msg::constellation_msg::PipelineId;
use collections::TreeMap;
+use core::cell::RefCell;
use serialize::json;
use serialize::json::ToJson;
use std::io::TcpStream;
@@ -105,6 +106,7 @@ pub struct ConsoleActor {
pub name: String,
pub pipeline: PipelineId,
pub script_chan: Sender<DevtoolScriptControlMsg>,
+ pub streams: RefCell<Vec<TcpStream>>,
}
impl Actor for ConsoleActor {
diff --git a/components/devtools/actors/tab.rs b/components/devtools/actors/tab.rs
index bbd8ce9c323..48e773b0d83 100644
--- a/components/devtools/actors/tab.rs
+++ b/components/devtools/actors/tab.rs
@@ -7,6 +7,7 @@
/// Supports dynamic attaching and detaching which control notifications of navigation, etc.
use actor::{Actor, ActorRegistry};
+use actors::console::ConsoleActor;
use protocol::JsonPacketStream;
use serialize::json;
@@ -74,7 +75,7 @@ impl Actor for TabActor {
}
fn handle_message(&self,
- _registry: &ActorRegistry,
+ registry: &ActorRegistry,
msg_type: &String,
_msg: &json::JsonObject,
stream: &mut TcpStream) -> bool {
@@ -95,15 +96,21 @@ impl Actor for TabActor {
javascriptEnabled: true,
traits: TabTraits,
};
+ let console_actor = registry.find::<ConsoleActor>(self.console.as_slice());
+ console_actor.streams.borrow_mut().push(stream.clone());
stream.write_json_packet(&msg);
true
}
+ //FIXME: The current implementation won't work for multiple connections. Need to ensure 105
+ // that the correct stream is removed.
"detach" => {
let msg = TabDetachedReply {
from: self.name(),
__type__: "detached".to_string(),
};
+ let console_actor = registry.find::<ConsoleActor>(self.console.as_slice());
+ console_actor.streams.borrow_mut().pop();
stream.write_json_packet(&msg);
true
}