diff --git a/components/devtools/actors/browsing_context.rs b/components/devtools/actors/browsing_context.rs index bccfc9c77d01..8ff81160b166 100644 --- a/components/devtools/actors/browsing_context.rs +++ b/components/devtools/actors/browsing_context.rs @@ -65,6 +65,7 @@ pub struct BrowsingContextActorMsg { timelineActor: String, profilerActor: String, performanceActor: String, + styleSheetsActor: String, } pub struct BrowsingContextActor { @@ -76,6 +77,7 @@ pub struct BrowsingContextActor { pub timeline: String, pub profiler: String, pub performance: String, + pub styleSheets: String, pub thread: String, } @@ -174,6 +176,7 @@ impl BrowsingContextActor { timelineActor: self.timeline.clone(), profilerActor: self.profiler.clone(), performanceActor: self.performance.clone(), + styleSheetsActor: self.styleSheets.clone(), } } } diff --git a/components/devtools/actors/stylesheets.rs b/components/devtools/actors/stylesheets.rs new file mode 100644 index 000000000000..ab2ec8738f6c --- /dev/null +++ b/components/devtools/actors/stylesheets.rs @@ -0,0 +1,33 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +use actor::{Actor, ActorMessageStatus, ActorRegistry}; +use serde_json::{Map, Value}; +use std::net::TcpStream; + +pub struct StyleSheetsActor { + pub name: String, +} + +impl Actor for StyleSheetsActor { + fn name(&self) -> String { + self.name.clone() + } + fn handle_message( + &self, + _: &ActorRegistry, + _: &str, + _: &Map, + _: &mut TcpStream, + ) -> Result { + Ok(ActorMessageStatus::Ignored) + } +} + +impl StyleSheetsActor { + pub fn new(name: String) -> StyleSheetsActor { + StyleSheetsActor { name: name } + } +} + diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 0600c984e9f5..da779a9855b8 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -33,6 +33,7 @@ use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg}; use actors::performance::PerformanceActor; use actors::profiler::ProfilerActor; use actors::root::RootActor; +use actors::stylesheets::StyleSheetsActor; use actors::thread::ThreadActor; use actors::timeline::TimelineActor; use actors::worker::WorkerActor; @@ -65,6 +66,7 @@ mod actors { pub mod performance; pub mod profiler; pub mod root; + pub mod stylesheets; pub mod thread; pub mod timeline; pub mod worker; @@ -216,7 +218,7 @@ fn run_server( let (pipeline, worker_id) = ids; //TODO: move all this actor creation into a constructor method on BrowsingContextActor - let (target, console, inspector, timeline, profiler, performance, thread) = { + let (target, console, inspector, timeline, profiler, performance, styleSheets, thread) = { let console = ConsoleActor { name: actors.new_name("console"), script_chan: script_sender.clone(), @@ -237,6 +239,9 @@ fn run_server( let profiler = ProfilerActor::new(actors.new_name("profiler")); let performance = PerformanceActor::new(actors.new_name("performance")); + // the strange switch between styleSheets and stylesheets is due + // to an inconsistency in devtools. See Bug #1498893 in bugzilla + let styleSheets = StyleSheetsActor::new(actors.new_name("stylesheets")); let thread = ThreadActor::new(actors.new_name("context")); let DevtoolsPageInfo { title, url } = page_info; @@ -249,6 +254,7 @@ fn run_server( timeline: timeline.name(), profiler: profiler.name(), performance: performance.name(), + styleSheets: styleSheets.name(), thread: thread.name(), }; @@ -262,6 +268,7 @@ fn run_server( timeline, profiler, performance, + styleSheets, thread, ) }; @@ -283,6 +290,7 @@ fn run_server( actors.register(Box::new(timeline)); actors.register(Box::new(profiler)); actors.register(Box::new(performance)); + actors.register(Box::new(styleSheets)); actors.register(Box::new(thread)); }