mirror of
https://github.com/servo/servo.git
synced 2025-06-09 00:53:26 +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
|
@ -43,6 +43,7 @@ use devtools_traits::{
|
|||
CSSError, DevtoolScriptControlMsg, DevtoolsPageInfo, NavigationState,
|
||||
ScriptToDevtoolsControlMsg, WorkerId,
|
||||
};
|
||||
use embedder_traits::user_content_manager::UserContentManager;
|
||||
use embedder_traits::{
|
||||
EmbedderMsg, InputEvent, MediaSessionActionType, Theme, WebDriverScriptCommand,
|
||||
};
|
||||
|
@ -303,10 +304,9 @@ pub struct ScriptThread {
|
|||
/// Unminify Css.
|
||||
unminify_css: 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
|
||||
userscripts_path: Option<String>,
|
||||
/// User content manager
|
||||
#[no_trace]
|
||||
user_content_manager: UserContentManager,
|
||||
|
||||
/// An optional string allowing the user agent to be set for testing.
|
||||
user_agent: Cow<'static, str>,
|
||||
|
@ -938,8 +938,8 @@ impl ScriptThread {
|
|||
unminify_js: opts.unminify_js,
|
||||
local_script_source: opts.local_script_source.clone(),
|
||||
unminify_css: opts.unminify_css,
|
||||
userscripts_path: opts.userscripts.clone(),
|
||||
user_agent,
|
||||
user_content_manager: state.user_content_manager,
|
||||
player_context: state.player_context,
|
||||
node_ids: Default::default(),
|
||||
is_user_interacting: Cell::new(false),
|
||||
|
@ -3096,7 +3096,7 @@ impl ScriptThread {
|
|||
self.unminify_js,
|
||||
self.unminify_css,
|
||||
self.local_script_source.clone(),
|
||||
self.userscripts_path.clone(),
|
||||
self.user_content_manager.clone(),
|
||||
self.user_agent.clone(),
|
||||
self.player_context.clone(),
|
||||
#[cfg(feature = "webgpu")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue