-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve firefox profile prefs merging: #423
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -334,11 +334,12 @@ impl MarionetteHandler { | |
.map_err(|_| WebDriverError::new(ErrorStatus::UnknownError, | ||
"Unable to read profile preferences file"))); | ||
|
||
prefs.insert("marionette.defaultPrefs.port", Pref::new(port as i64)); | ||
for &(ref name, ref value) in prefs::DEFAULT.iter() { | ||
if !custom_profile || !prefs.contains_key(name) { | ||
prefs.insert((*name).clone(), (*value).clone()); | ||
} | ||
} | ||
|
||
if !custom_profile { | ||
prefs.insert_slice(&prefs::DEFAULT[..]); | ||
}; | ||
prefs.insert_slice(&extra_prefs[..]); | ||
|
||
prefs.insert_slice(&prefs::REQUIRED[..]); | ||
|
@@ -347,6 +348,8 @@ impl MarionetteHandler { | |
prefs.insert("marionette.logging", Pref::new(level.to_string())); | ||
}; | ||
|
||
prefs.insert("marionette.defaultPrefs.port", Pref::new(port as i64)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But this part I agree is correct :) |
||
|
||
prefs.write().map_err(|_| WebDriverError::new(ErrorStatus::UnknownError, | ||
"Unable to write Firefox profile")) | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is obviously the correct behaviour. If you set a custom profile you might reasonably expect to get the prefs you set, except any that are actually required to make marionette function correctly. If you want the default set you can always set those explicitly.
What's the specific problem here that you're trying to solve? (n.b. I hope that in the future we can enable more things that currently require an entire custom profile via more fine grained capabilities e.g. extension installation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this might be a result of 2bfdc3e.
Many of the preferences in
prefs::DEFAULT
are actually required for Marionette to function correctly, and some of these we can’t set at runtime. We should probably move those that are absolute requirements over toprefs::REQUIRED
, and we should set those we can set at runtime in Marionette. I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1323290 about the latter before Christmas.As I read this code, the default prefs will only get written to the profile if a custom profile is not provided. The intention of
prefs::DEFAULT
is to say “we recommend these settings for running Marionette”, and triggering another code path that doesn’t set these if the user provides a profile a bit surprising in my opinion.I’m also curious what the reason for this change is. I guess you are providing a profile with some preferences that get overridden by geckodriver?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the customers I support, the usual pattern is that they start by using the default settings, and at some point they realize that they need to install an extension or set up some certs that can (currently) most easily be accomplished by providing a custom profile. It is then surprising when a profile created with the sole purpose of doing this causes other behavior changes because DEFAULT prefs are no longer being set. My goal with the change is to make that transition from no profile to providing a profile more seamless by only changing things that the user has explicitly chosen to change when providing the profile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking at the moment is to move those preferences that are absolutely required to meet WebDriver conformance from
prefs::DEFAULT
toprefs::REQUIRED
and to accept this change. This would change the meaning of ‘default preferences’ towards ‘suggested preferences’, as they would not take effect if a custom profile with custom preferences is provided.