mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #27304 - paulrouget:staticdevtoolsport, r=jdm
UWP: non random port for devtools, and support for custom UWP prefs packages-prefs.json is now taken into account for libsimpleservo. Making it possible to have custom pref for the UWP builds, removing some weirdness in the way we handle preferences in the hololens code. This also adds a new set of preferences to control the devtools server startup state, and make the port choice constant across sessions. Fix #27267 Fix #22970
This commit is contained in:
commit
774673d186
15 changed files with 116 additions and 58 deletions
|
@ -112,9 +112,12 @@ pub struct Opts {
|
|||
/// remote Firefox debugger connections.
|
||||
pub debugger_port: Option<u16>,
|
||||
|
||||
/// `None` to disable devtools or `Some` with a port number to start a server to listen to
|
||||
/// remote Firefox devtools connections.
|
||||
pub devtools_port: Option<u16>,
|
||||
/// Port number to start a server to listen to remote Firefox devtools connections.
|
||||
/// 0 for random port.
|
||||
pub devtools_port: u16,
|
||||
|
||||
/// Start the devtools server at startup
|
||||
pub devtools_server_enabled: bool,
|
||||
|
||||
/// `None` to disable WebDriver or `Some` with a port number to start a server to listen to
|
||||
/// remote WebDriver commands.
|
||||
|
@ -482,7 +485,8 @@ pub fn default_opts() -> Opts {
|
|||
enable_canvas_antialiasing: true,
|
||||
trace_layout: false,
|
||||
debugger_port: None,
|
||||
devtools_port: None,
|
||||
devtools_port: 0,
|
||||
devtools_server_enabled: false,
|
||||
webdriver_port: None,
|
||||
initial_window_size: Size2D::new(1024, 740),
|
||||
multiprocess: false,
|
||||
|
@ -802,11 +806,22 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
})
|
||||
});
|
||||
|
||||
// Set default port 0 for a random port to be selected.
|
||||
let devtools_port = opt_match.opt_default("devtools", "0").map(|port| {
|
||||
port.parse()
|
||||
.unwrap_or_else(|err| args_fail(&format!("Error parsing option: --devtools ({})", err)))
|
||||
});
|
||||
let (devtools_enabled, devtools_port) = if opt_match.opt_present("devtools") {
|
||||
let port = opt_match
|
||||
.opt_str("devtools")
|
||||
.map(|port| {
|
||||
port.parse().unwrap_or_else(|err| {
|
||||
args_fail(&format!("Error parsing option: --devtools ({})", err))
|
||||
})
|
||||
})
|
||||
.unwrap_or(pref!(devtools.server.port));
|
||||
(true, port as u16)
|
||||
} else {
|
||||
(
|
||||
pref!(devtools.server.enabled),
|
||||
pref!(devtools.server.port) as u16,
|
||||
)
|
||||
};
|
||||
|
||||
let webdriver_port = opt_match.opt_default("webdriver", "7000").map(|port| {
|
||||
port.parse().unwrap_or_else(|err| {
|
||||
|
@ -874,6 +889,7 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
|||
trace_layout: debug_options.trace_layout,
|
||||
debugger_port: debugger_port,
|
||||
devtools_port: devtools_port,
|
||||
devtools_server_enabled: devtools_enabled,
|
||||
webdriver_port: webdriver_port,
|
||||
initial_window_size: initial_window_size,
|
||||
multiprocess: opt_match.opt_present("M"),
|
||||
|
|
|
@ -123,6 +123,12 @@ mod gen {
|
|||
},
|
||||
},
|
||||
},
|
||||
devtools: {
|
||||
server: {
|
||||
enabled: bool,
|
||||
port: i64,
|
||||
},
|
||||
},
|
||||
dom: {
|
||||
webgpu: {
|
||||
enabled: bool,
|
||||
|
|
|
@ -22,6 +22,7 @@ log = "0.4"
|
|||
msg = { path = "../msg" }
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
servo_config = { path = "../config" }
|
||||
servo_rand = { path = "../rand" }
|
||||
servo_url = { path = "../url" }
|
||||
time = "0.1"
|
||||
|
|
|
@ -356,9 +356,15 @@ where
|
|||
let mem_profiler_chan = profile_mem::Profiler::create(opts.mem_profiler_period);
|
||||
|
||||
let debugger_chan = opts.debugger_port.map(|port| debugger::start_server(port));
|
||||
let devtools_chan = opts
|
||||
.devtools_port
|
||||
.map(|port| devtools::start_server(port, embedder_proxy.clone()));
|
||||
|
||||
let devtools_chan = if opts.devtools_server_enabled {
|
||||
Some(devtools::start_server(
|
||||
opts.devtools_port,
|
||||
embedder_proxy.clone(),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let coordinates = window.get_coordinates();
|
||||
let device_pixel_ratio = coordinates.hidpi_factor.get();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue