diff options
Diffstat (limited to 'components/util')
-rw-r--r-- | components/util/opts.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/components/util/opts.rs b/components/util/opts.rs index b03a6bfbbc3..f445359407e 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -59,7 +59,11 @@ pub struct Opts { pub nonincremental_layout: bool, pub nossl: bool, - pub userscripts: bool, + + /// Where to load userscripts from, if any. An empty string will load from + /// the resources/user-agent-js directory, and if the option isn't passed userscripts + /// won't be loaded + pub userscripts: Option<String>, pub output_file: Option<String>, pub headless: bool, @@ -183,7 +187,7 @@ pub fn default_opts() -> Opts { layout_threads: 1, nonincremental_layout: false, nossl: false, - userscripts: false, + userscripts: None, output_file: None, headless: true, hard_fail: true, @@ -224,7 +228,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { getopts::optopt("y", "layout-threads", "Number of threads to use for layout", "1"), getopts::optflag("i", "nonincremental-layout", "Enable to turn off incremental layout."), getopts::optflag("", "no-ssl", "Disables ssl certificate verification."), - getopts::optflag("", "userscripts", "Uses userscripts in resources/user-agent-js"), + getopts::optflagopt("", "userscripts", "Uses userscripts in resources/user-agent-js, or a specified full path",""), getopts::optflag("z", "headless", "Headless mode"), getopts::optflag("f", "hard-fail", "Exit on task failure instead of displaying about:failure"), getopts::optflagopt("", "devtools", "Start remote devtools server on port", "6000"), @@ -301,7 +305,6 @@ pub fn from_cmdline_args(args: &[String]) -> bool { let nonincremental_layout = opt_match.opt_present("i"); let nossl = opt_match.opt_present("no-ssl"); - let userscripts = opt_match.opt_present("userscripts"); let mut bubble_inline_sizes_separately = debug_options.contains(&"bubble-widths"); let trace_layout = debug_options.contains(&"trace-layout"); @@ -337,7 +340,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool { layout_threads: layout_threads, nonincremental_layout: nonincremental_layout, nossl: nossl, - userscripts: userscripts, + userscripts: opt_match.opt_default("userscripts", ""), output_file: opt_match.opt_str("o"), headless: opt_match.opt_present("z"), hard_fail: opt_match.opt_present("f"), |