mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #21941 - codehag:devtools-add-stylesheets-actor, r=jdm
DevTools - add preliminary StyleSheetActor Based on an error coming from devtools, that the server did not support a stylesheets actor, this patch introduces a [StyleSheetsActor](https://searchfox.org/mozilla-central/rev/26b40a44691e0710838130b614c2f2662bc91eec/devtools/server/actors/stylesheets.js#590-853). It has no methods yet, but it is a small step towards getting the devtools up and running. Before the change: No stylesheet editor After the change we can see that the style editor now loads. It has no information but I will get to that later. <img width="902" alt="screen shot 2018-10-14 at 12 51 51" src="https://user-images.githubusercontent.com/26968615/46915813-61192900-cfb1-11e8-8382-3d9dc8db4114.png"> Status after this PR: * Debugger does not load * Netmonitor does not load * Console is loading but doesn't receive messages. * Inspector is, but does not have any information * style editor is *now loading* but does not have any information * Performance is an out of date tab, and will likely need to be changed substantially next steps for this will be to implement the [protocol methods](https://searchfox.org/mozilla-central/source/devtools/shared/specs/stylesheets.js#74-95) I am not too sure how to test this, it doesn't look like there are tests yet for the devtools, is that right? --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21941) <!-- Reviewable:end -->
This commit is contained in:
commit
f3533b4c78
3 changed files with 45 additions and 1 deletions
|
@ -65,6 +65,7 @@ pub struct BrowsingContextActorMsg {
|
||||||
timelineActor: String,
|
timelineActor: String,
|
||||||
profilerActor: String,
|
profilerActor: String,
|
||||||
performanceActor: String,
|
performanceActor: String,
|
||||||
|
styleSheetsActor: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct BrowsingContextActor {
|
pub struct BrowsingContextActor {
|
||||||
|
@ -76,6 +77,7 @@ pub struct BrowsingContextActor {
|
||||||
pub timeline: String,
|
pub timeline: String,
|
||||||
pub profiler: String,
|
pub profiler: String,
|
||||||
pub performance: String,
|
pub performance: String,
|
||||||
|
pub styleSheets: String,
|
||||||
pub thread: String,
|
pub thread: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +176,7 @@ impl BrowsingContextActor {
|
||||||
timelineActor: self.timeline.clone(),
|
timelineActor: self.timeline.clone(),
|
||||||
profilerActor: self.profiler.clone(),
|
profilerActor: self.profiler.clone(),
|
||||||
performanceActor: self.performance.clone(),
|
performanceActor: self.performance.clone(),
|
||||||
|
styleSheetsActor: self.styleSheets.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
33
components/devtools/actors/stylesheets.rs
Normal file
33
components/devtools/actors/stylesheets.rs
Normal file
|
@ -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<String, Value>,
|
||||||
|
_: &mut TcpStream,
|
||||||
|
) -> Result<ActorMessageStatus, ()> {
|
||||||
|
Ok(ActorMessageStatus::Ignored)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl StyleSheetsActor {
|
||||||
|
pub fn new(name: String) -> StyleSheetsActor {
|
||||||
|
StyleSheetsActor { name: name }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg};
|
||||||
use actors::performance::PerformanceActor;
|
use actors::performance::PerformanceActor;
|
||||||
use actors::profiler::ProfilerActor;
|
use actors::profiler::ProfilerActor;
|
||||||
use actors::root::RootActor;
|
use actors::root::RootActor;
|
||||||
|
use actors::stylesheets::StyleSheetsActor;
|
||||||
use actors::thread::ThreadActor;
|
use actors::thread::ThreadActor;
|
||||||
use actors::timeline::TimelineActor;
|
use actors::timeline::TimelineActor;
|
||||||
use actors::worker::WorkerActor;
|
use actors::worker::WorkerActor;
|
||||||
|
@ -65,6 +66,7 @@ mod actors {
|
||||||
pub mod performance;
|
pub mod performance;
|
||||||
pub mod profiler;
|
pub mod profiler;
|
||||||
pub mod root;
|
pub mod root;
|
||||||
|
pub mod stylesheets;
|
||||||
pub mod thread;
|
pub mod thread;
|
||||||
pub mod timeline;
|
pub mod timeline;
|
||||||
pub mod worker;
|
pub mod worker;
|
||||||
|
@ -216,7 +218,7 @@ fn run_server(
|
||||||
let (pipeline, worker_id) = ids;
|
let (pipeline, worker_id) = ids;
|
||||||
|
|
||||||
//TODO: move all this actor creation into a constructor method on BrowsingContextActor
|
//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 {
|
let console = ConsoleActor {
|
||||||
name: actors.new_name("console"),
|
name: actors.new_name("console"),
|
||||||
script_chan: script_sender.clone(),
|
script_chan: script_sender.clone(),
|
||||||
|
@ -237,6 +239,9 @@ fn run_server(
|
||||||
let profiler = ProfilerActor::new(actors.new_name("profiler"));
|
let profiler = ProfilerActor::new(actors.new_name("profiler"));
|
||||||
let performance = PerformanceActor::new(actors.new_name("performance"));
|
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 thread = ThreadActor::new(actors.new_name("context"));
|
||||||
|
|
||||||
let DevtoolsPageInfo { title, url } = page_info;
|
let DevtoolsPageInfo { title, url } = page_info;
|
||||||
|
@ -249,6 +254,7 @@ fn run_server(
|
||||||
timeline: timeline.name(),
|
timeline: timeline.name(),
|
||||||
profiler: profiler.name(),
|
profiler: profiler.name(),
|
||||||
performance: performance.name(),
|
performance: performance.name(),
|
||||||
|
styleSheets: styleSheets.name(),
|
||||||
thread: thread.name(),
|
thread: thread.name(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -262,6 +268,7 @@ fn run_server(
|
||||||
timeline,
|
timeline,
|
||||||
profiler,
|
profiler,
|
||||||
performance,
|
performance,
|
||||||
|
styleSheets,
|
||||||
thread,
|
thread,
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
@ -283,6 +290,7 @@ fn run_server(
|
||||||
actors.register(Box::new(timeline));
|
actors.register(Box::new(timeline));
|
||||||
actors.register(Box::new(profiler));
|
actors.register(Box::new(profiler));
|
||||||
actors.register(Box::new(performance));
|
actors.register(Box::new(performance));
|
||||||
|
actors.register(Box::new(styleSheets));
|
||||||
actors.register(Box::new(thread));
|
actors.register(Box::new(thread));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue