mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1882748
- [remote] Always apply recommended common preferences. r=webdriver-reviewers,jdescottes
Differential Revision: https://phabricator.services.mozilla.com/D203236
This commit is contained in:
parent
dbdd18537a
commit
ffcae73032
@ -9,6 +9,8 @@ ChromeUtils.defineESModuleGetters(lazy, {
|
||||
Deferred: "chrome://remote/content/shared/Sync.sys.mjs",
|
||||
HttpServer: "chrome://remote/content/server/httpd.sys.mjs",
|
||||
Log: "chrome://remote/content/shared/Log.sys.mjs",
|
||||
RecommendedPreferences:
|
||||
"chrome://remote/content/shared/RecommendedPreferences.sys.mjs",
|
||||
WebDriverBiDi: "chrome://remote/content/webdriver-bidi/WebDriverBiDi.sys.mjs",
|
||||
});
|
||||
|
||||
@ -31,7 +33,6 @@ const DEFAULT_PORT = 9222;
|
||||
|
||||
const isRemote =
|
||||
Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
|
||||
|
||||
class RemoteAgentParentProcess {
|
||||
#allowHosts;
|
||||
#allowOrigins;
|
||||
@ -394,6 +395,9 @@ class RemoteAgentParentProcess {
|
||||
Services.obs.addObserver(this, "mail-idle-startup-tasks-finished");
|
||||
Services.obs.addObserver(this, "quit-application");
|
||||
|
||||
// Apply the common set of preferences for all supported protocols
|
||||
lazy.RecommendedPreferences.applyPreferences();
|
||||
|
||||
// With Bug 1717899 we will extend the lifetime of the Remote Agent to
|
||||
// the whole Firefox session, which will be identical to Marionette. For
|
||||
// now prevent logging if the component is not enabled during startup.
|
||||
|
@ -310,6 +310,9 @@ const COMMON_PREFERENCES = new Map([
|
||||
// Privacy and Tracking Protection
|
||||
["privacy.trackingprotection.enabled", false],
|
||||
|
||||
// Used to check if recommended preferences are applied
|
||||
["remote.prefs.recommended.applied", true],
|
||||
|
||||
// Don't do network connections for mitm priming
|
||||
["security.certerrors.mitm.priming.enabled", false],
|
||||
|
||||
@ -362,7 +365,7 @@ export const RecommendedPreferences = {
|
||||
* @param {Map<string, object>=} preferences
|
||||
* Map of preference name to preference value.
|
||||
*/
|
||||
applyPreferences(preferences) {
|
||||
applyPreferences(preferences = new Map()) {
|
||||
if (!lazy.useRecommendedPrefs) {
|
||||
// If remote.prefs.recommended is set to false, do not set any preference
|
||||
// here. Needed for our Firefox CI.
|
||||
@ -374,11 +377,7 @@ export const RecommendedPreferences = {
|
||||
if (!this.isInitialized) {
|
||||
// Merge common preferences and optionally provided preferences in a
|
||||
// single map. Hereby the extra preferences have higher priority.
|
||||
if (preferences) {
|
||||
preferences = new Map([...COMMON_PREFERENCES, ...preferences]);
|
||||
} else {
|
||||
preferences = COMMON_PREFERENCES;
|
||||
}
|
||||
preferences = new Map([...COMMON_PREFERENCES, ...preferences]);
|
||||
|
||||
Services.obs.addObserver(this, "quit-application");
|
||||
this.isInitialized = true;
|
||||
|
@ -76,6 +76,11 @@ add_task(async function test_disabled() {
|
||||
|
||||
add_task(async function test_noCustomPreferences() {
|
||||
info("Applying preferences without any custom preference should not throw");
|
||||
|
||||
// First call invokes setting of default preferences
|
||||
RecommendedPreferences.applyPreferences();
|
||||
|
||||
// Second call does nothing
|
||||
RecommendedPreferences.applyPreferences();
|
||||
|
||||
cleanup();
|
||||
|
@ -2,5 +2,5 @@ from support.fixtures import get_pref
|
||||
|
||||
|
||||
def test_recommended_preferences(session):
|
||||
has_recommended_prefs = get_pref(session, "remote.prefs.recommended")
|
||||
has_recommended_prefs = get_pref(session, "remote.prefs.recommended.applied")
|
||||
assert has_recommended_prefs is True
|
Loading…
Reference in New Issue
Block a user