mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Allow setting userscripts directly without the need of files (#35388)
* Allow settings userscripts through preferences Signed-off-by: Tony <legendmastertony@gmail.com> * mach fmt instead of cargo fmt Signed-off-by: Tony <legendmastertony@gmail.com> * Fix pref loading not working for array values Signed-off-by: Tony <legendmastertony@gmail.com> * Use pref! in userscripts instead Signed-off-by: Tony <legendmastertony@gmail.com> * Implement the model jdm suggested - Remove userscripts from all places and move it to servoshell - Add in `UserContentManager` struct and passing it through `Servo::new` all the way down to script thread Signed-off-by: Tony <legendmastertony@gmail.com> * Apply suggestions from code review and format Signed-off-by: Tony <legendmastertony@gmail.com> * Revert unrelated change Signed-off-by: Tony <legendmastertony@gmail.com> --------- Signed-off-by: Tony <legendmastertony@gmail.com> Signed-off-by: Tony <68118705+Legend-Master@users.noreply.github.com>
This commit is contained in:
parent
53a2e61fec
commit
5a76906d64
16 changed files with 143 additions and 51 deletions
|
@ -56,6 +56,9 @@ pub(crate) struct ServoShellPreferences {
|
|||
pub output_image_path: Option<String>,
|
||||
/// Whether or not to exit after Servo detects a stable output image in all WebViews.
|
||||
pub exit_after_stable_image: bool,
|
||||
/// Where to load userscripts from, if any.
|
||||
/// and if the option isn't passed userscripts won't be loaded.
|
||||
pub userscripts_directory: Option<PathBuf>,
|
||||
}
|
||||
|
||||
impl Default for ServoShellPreferences {
|
||||
|
@ -74,6 +77,7 @@ impl Default for ServoShellPreferences {
|
|||
user_agent: None,
|
||||
output_image_path: None,
|
||||
exit_after_stable_image: false,
|
||||
userscripts_directory: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -622,6 +626,9 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
screen_size_override,
|
||||
output_image_path,
|
||||
exit_after_stable_image: exit_after_load,
|
||||
userscripts_directory: opt_match
|
||||
.opt_default("userscripts", "resources/user-agent-js")
|
||||
.map(PathBuf::from),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
|
@ -636,7 +643,6 @@ pub(crate) fn parse_command_line_arguments(args: Vec<String>) -> ArgumentParsing
|
|||
time_profiling,
|
||||
time_profiler_trace_path: opt_match.opt_str("profiler-trace-path"),
|
||||
nonincremental_layout,
|
||||
userscripts: opt_match.opt_default("userscripts", "resources/user-agent-js"),
|
||||
user_stylesheets,
|
||||
hard_fail: opt_match.opt_present("f") && !opt_match.opt_present("F"),
|
||||
webdriver_port,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue