mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add a pref for a default homepage.
This commit is contained in:
parent
79e548905e
commit
8d9ab50a96
5 changed files with 46 additions and 15 deletions
|
@ -10,6 +10,7 @@ use geometry::ScreenPx;
|
|||
use getopts::Options;
|
||||
use num_cpus;
|
||||
use prefs::{self, PrefValue};
|
||||
use resource_files::set_resources_path;
|
||||
use std::cmp;
|
||||
use std::default::Default;
|
||||
use std::env;
|
||||
|
@ -155,9 +156,6 @@ pub struct Opts {
|
|||
/// Whether to show an error when display list geometry escapes flow overflow regions.
|
||||
pub validate_display_list_geometry: bool,
|
||||
|
||||
/// A specific path to find required resources (such as user-agent.css).
|
||||
pub resources_path: Option<String>,
|
||||
|
||||
/// Whether MIME sniffing should be used
|
||||
pub sniff_mime_types: bool,
|
||||
|
||||
|
@ -409,7 +407,6 @@ pub fn default_opts() -> Opts {
|
|||
validate_display_list_geometry: false,
|
||||
profile_tasks: false,
|
||||
profile_script_events: false,
|
||||
resources_path: None,
|
||||
sniff_mime_types: false,
|
||||
disable_share_style_cache: false,
|
||||
parallel_display_list_building: false,
|
||||
|
@ -460,6 +457,8 @@ pub fn from_cmdline_args(args: &[String]) {
|
|||
Err(f) => args_fail(&f.to_string()),
|
||||
};
|
||||
|
||||
set_resources_path(opt_match.opt_str("resources-path"));
|
||||
|
||||
if opt_match.opt_present("h") || opt_match.opt_present("help") {
|
||||
print_usage(app_name, &opts);
|
||||
process::exit(0);
|
||||
|
@ -480,12 +479,21 @@ pub fn from_cmdline_args(args: &[String]) {
|
|||
}
|
||||
|
||||
let cwd = env::current_dir().unwrap();
|
||||
let url = if opt_match.free.is_empty() {
|
||||
print_usage(app_name, &opts);
|
||||
args_fail("servo asks that you provide a URL")
|
||||
let homepage_pref = prefs::get_pref("shell.homepage");
|
||||
let url_opt = if !opt_match.free.is_empty() {
|
||||
Some(&opt_match.free[0][..])
|
||||
} else {
|
||||
parse_url_or_filename(&cwd, &opt_match.free[0])
|
||||
.unwrap_or_else(|()| args_fail("URL parsing failed"))
|
||||
homepage_pref.as_string()
|
||||
};
|
||||
let url = match url_opt {
|
||||
Some(url_string) => {
|
||||
parse_url_or_filename(&cwd, url_string)
|
||||
.unwrap_or_else(|()| args_fail("URL parsing failed"))
|
||||
},
|
||||
None => {
|
||||
print_usage(app_name, &opts);
|
||||
args_fail("servo asks that you provide a URL")
|
||||
}
|
||||
};
|
||||
|
||||
let tile_size: usize = match opt_match.opt_str("s") {
|
||||
|
@ -602,7 +610,6 @@ pub fn from_cmdline_args(args: &[String]) {
|
|||
dump_display_list_optimized: debug_options.dump_display_list_optimized,
|
||||
relayout_event: debug_options.relayout_event,
|
||||
validate_display_list_geometry: debug_options.validate_display_list_geometry,
|
||||
resources_path: opt_match.opt_str("resources-path"),
|
||||
sniff_mime_types: opt_match.opt_present("sniff-mime-types"),
|
||||
disable_share_style_cache: debug_options.disable_share_style_cache,
|
||||
parallel_display_list_building: debug_options.parallel_display_list_building,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue