Bug 1466658 - [geckodriver] Overhaul of user preferences in prefs.rs. r=ato, a=test-only
authorHenrik Skupin <mail@hskupin.info>
Tue, 05 Jun 2018 11:37:27 +0200
changeset 473634 ebdb496585ab89d5698ff18be74be35c50fe6ff8
parent 473633 e4e135dd13f5b95c4f4f0f54c3a6624c93ab498e
child 473635 9008c3afe6b1c6eee770aa2b853685e0ea89de8e
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersato, test-only
bugs1466658
milestone61.0
Bug 1466658 - [geckodriver] Overhaul of user preferences in prefs.rs. r=ato, a=test-only Lots of preferences aren't used anymore, or are safe to set at startup in marionette.js. This also makes them specific to a version of Firefox, and prevents us from keeping fallback preferences around in geckodriver. This patch bumps the recommended version of Firefox to 57. MozReview-Commit-ID: Iic6iWFP3Nx
testing/geckodriver/CHANGES.md
testing/geckodriver/README.md
testing/geckodriver/src/prefs.rs
testing/marionette/client/marionette_driver/geckoinstance.py
testing/marionette/components/marionette.js
--- a/testing/geckodriver/CHANGES.md
+++ b/testing/geckodriver/CHANGES.md
@@ -3,29 +3,32 @@ Change log
 
 All notable changes to this program is documented in this file.
 
 
 Unreleased
 ----------
 
 Note that with geckodriver 'next' the following versions are recommended:
-- Firefox 56.0 (and greater)
+- Firefox 57.0 (and greater)
 - Selenium 3.11 (and greater)
 
 ### Added
 
 - Support for the new chrome element identifier in Marionette.
 
 ### Changed
 
 - Updated mapping of all supported commands to the new prefixed commands
   in Marionette, whereby all WebDriver specific commands make use of the
   `WebDriver:` prefix.
 
+- Overhaul of Firefox preferences. Already deprecated preferences in Firefox
+  versions earlier than 57 got removed.
+
 
 0.20.1 (2018-04-06)
 -------------------
 
 ### Fixed
 
 - Avoid attempting to kill Firefox process that has stopped.
 
--- a/testing/geckodriver/README.md
+++ b/testing/geckodriver/README.md
@@ -46,17 +46,17 @@ Supported Firefoxen
 
 geckodriver is not yet feature complete.  This means that it does not
 yet offer full conformance with the [WebDriver] standard or complete
 compatibility with [Selenium].  You can track the [implementation
 status] of the latest [Firefox Nightly](http://whattrainisitnow.com/)
 on [MDN].  We also keep track of known [Selenium], [remote protocol],
 and [specification] problems in our [issue tracker].
 
-Support is best in Firefox 55 and greater, although generally the more
+Support is best in Firefox 57 and greater, although generally the more
 recent the Firefox version, the better the experience as they have more
 bug fixes and features.  Some features will only be available in the
 most recent Firefox versions, and we strongly advise using the latest
 [Firefox Nightly] with geckodriver.  Since Windows XP support in Firefox
 was dropped with Firefox 53, we do not support this platform.
 
 [implementation status]: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver/status
 [MDN]: https://developer.mozilla.org/
--- a/testing/geckodriver/src/prefs.rs
+++ b/testing/geckodriver/src/prefs.rs
@@ -3,175 +3,105 @@ use mozprofile::preferences::Pref;
 // ALL CHANGES TO THIS FILE MUST HAVE REVIEW FROM A GECKODRIVER PEER!
 //
 // The Marionette Python client is used out-of-tree with release
 // channel builds of Firefox.  Removing a preference from this file
 // will cause regressions, so please be careful and get review from
 // a Testing :: Marionette peer before you make any changes to this file.
 
 lazy_static! {
-    pub static ref DEFAULT: [(&'static str, Pref); 80] = [
+    pub static ref DEFAULT: [(&'static str, Pref); 52] = [
         // Make sure Shield doesn't hit the network.
         ("app.normandy.api_url", Pref::new("")),
 
         // Disable automatic downloading of new releases
         ("app.update.auto", Pref::new(false)),
 
         // Disable automatically upgrading Firefox
         ("app.update.enabled", Pref::new(false)),
 
-        // Increase the APZ content response timeout in tests to 1
-        // minute.  This is to accommodate the fact that test environments
-        // tends to be slower than production environments (with the
-        // b2g emulator being the slowest of them all), resulting in the
-        // production timeout value sometimes being exceeded and causing
-        // false-positive test failures.
-        //
-        // (bug 1176798, bug 1177018, bug 1210465)
-        ("apz.content_response_timeout", Pref::new(60000)),
-
         // Enable the dump function, which sends messages to the system
         // console
         ("browser.dom.window.dump.enabled", Pref::new(true)),
 
-        // Indicate that the download panel has been shown once so
-        // that whichever download test runs first does not show the popup
-        // inconsistently
-        ("browser.download.panel.shown", Pref::new(true)),
-
-        // Implicitly accept license
-        ("browser.EULA.override", Pref::new(true)),
-
-        // Never start the browser in offline mode
-        ("browser.offline", Pref::new(false)),
-
-        // Background thumbnails in particular cause grief, and disabling
-        // thumbnails in general cannot hurt
-        ("browser.pagethumbnails.capturing_disabled", Pref::new(true)),
-
-        // Avoid performing Reader Mode intros during tests
-        ("browser.reader.detectedFirstArticle", Pref::new(true)),
-
         // Disable safebrowsing components
         ("browser.safebrowsing.blockedURIs.enabled", Pref::new(false)),
         ("browser.safebrowsing.downloads.enabled", Pref::new(false)),
         ("browser.safebrowsing.passwords.enabled", Pref::new(false)),
         ("browser.safebrowsing.malware.enabled", Pref::new(false)),
         ("browser.safebrowsing.phishing.enabled", Pref::new(false)),
 
-        // Disable updates to search engines
-        ("browser.search.update", Pref::new(false)),
-
         // Do not restore the last open set of tabs if the browser crashed
         ("browser.sessionstore.resume_from_crash", Pref::new(false)),
 
         // Skip check for default browser on startup
         ("browser.shell.checkDefaultBrowser", Pref::new(false)),
 
         // Do not warn when quitting with multiple tabs
+        // TODO: Remove once minimum supported Firefox release is 61.
         ("browser.showQuitWarning", Pref::new(false)),
 
         // Disable Android snippets
         ("browser.snippets.enabled", Pref::new(false)),
         ("browser.snippets.syncPromo.enabled", Pref::new(false)),
         ("browser.snippets.firstrunHomepage.enabled", Pref::new(false)),
 
         // Do not redirect user when a milestone upgrade of Firefox
         // is detected
         ("browser.startup.homepage_override.mstone", Pref::new("ignore")),
 
         // Start with a blank page (about:blank)
         ("browser.startup.page", Pref::new(0)),
 
-        // Disable tab animation
-        ("browser.tabs.animate", Pref::new(false)),
-
-        // Do not warn when quitting a window with multiple tabs
+        // Do not close the window when the last tab gets closed
+        // TODO: Remove once minimum supported Firefox release is 61.
         ("browser.tabs.closeWindowWithLastTab", Pref::new(false)),
 
-        // Do not allow background tabs to be zombified, otherwise for
-        // tests that open additional tabs, the test harness tab itself
-        // might get unloaded
-        ("browser.tabs.disableBackgroundZombification", Pref::new(false)),
-
-        // Do not warn on exit when multiple tabs are open
+        // Do not warn when closing all open tabs
+        // TODO: Remove once minimum supported Firefox release is 61.
         ("browser.tabs.warnOnClose", Pref::new(false)),
 
-        // Do not warn when closing all other open tabs
-        ("browser.tabs.warnOnCloseOtherTabs", Pref::new(false)),
-
-        // Do not warn when multiple tabs will be opened
-        ("browser.tabs.warnOnOpen", Pref::new(false)),
-
-        // Disable first run splash page on Windows 10
-        ("browser.usedOnWindows10.introURL", Pref::new("")),
-
         // Disable the UI tour
         ("browser.uitour.enabled", Pref::new(false)),
 
-        // Turn off search suggestions in the location bar so as not to trigger
-        // network connections.
-        ("browser.urlbar.suggest.searches", Pref::new(false)),
-
-        // Turn off the location bar search suggestions opt-in.  It interferes with
-        // tests that don't expect it to be there.
-        ("browser.urlbar.userMadeSearchSuggestionsChoice", Pref::new(true)),
-
         // Do not warn on quitting Firefox
+        // TODO: Remove once minimum supported Firefox release is 61.
         ("browser.warnOnQuit", Pref::new(false)),
 
         // Do not show datareporting policy notifications which can
         // interfere with tests
         ("datareporting.healthreport.about.reportUrl", Pref::new("http://%(server)s/dummy/abouthealthreport/")),  // removed in Firefox 59
         ("datareporting.healthreport.documentServerURI", Pref::new("http://%(server)s/dummy/healthreport/")),
         ("datareporting.healthreport.logging.consoleEnabled", Pref::new(false)),
         ("datareporting.healthreport.service.enabled", Pref::new(false)),
         ("datareporting.healthreport.service.firstRun", Pref::new(false)),
         ("datareporting.healthreport.uploadEnabled", Pref::new(false)),
         ("datareporting.policy.dataSubmissionEnabled", Pref::new(false)),
         ("datareporting.policy.dataSubmissionPolicyAccepted", Pref::new(false)),
         ("datareporting.policy.dataSubmissionPolicyBypassNotification", Pref::new(true)),
 
-        // Disable popup-blocker
-        ("dom.disable_open_during_load", Pref::new(false)),
-
-        // Enabling the support for File object creation in the content process
-        ("dom.file.createInChild", Pref::new(true)),
-
         // Disable the ProcessHangMonitor
         ("dom.ipc.reportProcessHangs", Pref::new(false)),
 
-        // Disable slow script dialogues
-        ("dom.max_chrome_script_run_time", Pref::new(0)),
-        ("dom.max_script_run_time", Pref::new(0)),
-
         // Only load extensions from the application and user profile
         // AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
         ("extensions.autoDisableScopes", Pref::new(0)),
         ("extensions.enabledScopes", Pref::new(5)),
 
-        // Disable metadata caching for installed add-ons by default
-        ("extensions.getAddons.cache.enabled", Pref::new(false)),
-
         // Disable intalling any distribution extensions or add-ons
         ("extensions.installDistroAddons", Pref::new(false)),
 
         // Make sure Shield doesn't hit the network.
-        // Removed in Firefox 60.
+        // TODO: Remove once minimum supported Firefox release is 60.
         ("extensions.shield-recipe-client.api_url", Pref::new("")),
 
-        ("extensions.showMismatchUI", Pref::new(false)),
-
         // Turn off extension updates so they do not bother tests
         ("extensions.update.enabled", Pref::new(false)),
         ("extensions.update.notifyUser", Pref::new(false)),
 
-        // Make sure opening about:addons will not hit the network
-        ("extensions.webservice.discoverURL", Pref::new("http://%(server)s/dummy/discoveryURL")),
-
         // Allow the application to have focus even it runs in the
         // background
         ("focusmanager.testmode", Pref::new(true)),
 
         // Disable useragent updates
         ("general.useragent.updates.enabled", Pref::new(false)),
 
         // Always use network provider for geolocation tests so we bypass
@@ -182,59 +112,34 @@ lazy_static! {
         ("geo.wifi.scan", Pref::new(false)),
 
         // No hang monitor
         ("hangmonitor.timeout", Pref::new(0)),
 
         // Show chrome errors and warnings in the error console
         ("javascript.options.showInConsole", Pref::new(true)),
 
-        // Make sure the disk cache does not get auto disabled
-        ("network.http.bypass-cachelock-threshold", Pref::new(200000)),
-
         // Do not prompt with long usernames or passwords in URLs
+        // TODO: Remove once minimum supported Firefox release is 61.
         ("network.http.phishy-userpass-length", Pref::new(255)),
 
-        // Do not prompt for temporary redirects
-        ("network.http.prompt-temp-redirect", Pref::new(false)),
-
-        // Disable speculative connections so they are not reported as
-        // leaking when they are hanging around
-        ("network.http.speculative-parallel-limit", Pref::new(0)),
-
         // Do not automatically switch between offline and online
         ("network.manage-offline-status", Pref::new(false)),
 
         // Make sure SNTP requests do not hit the network
         ("network.sntp.pools", Pref::new("%(server)s")),
 
         // Disable Flash.  The plugin container it is run in is
         // causing problems when quitting Firefox from geckodriver,
         // c.f. https://github.com/mozilla/geckodriver/issues/225.
         ("plugin.state.flash", Pref::new(0)),
 
-        // Local documents have access to all other local docments,
-        // including directory listings.
-        ("security.fileuri.strict_origin_policy", Pref::new(false)),
-
-        // Tests don't wait for the notification button security delay
-        ("security.notification_enable_delay", Pref::new(0)),
-
         // Ensure blocklist updates don't hit the network
         ("services.settings.server", Pref::new("http://%(server)s/dummy/blocklist/")),
 
-        // Do not automatically fill sign-in forms with known usernames
-        // and passwords
-        ("signon.autofillForms", Pref::new(false)),
-
-        // Disable password capture, so that tests that include forms
-        // are not influenced by the presence of the persistent doorhanger
-        // notification
-        ("signon.rememberSignons", Pref::new(false)),
-
         // Disable first run pages
         ("startup.homepage_welcome_url", Pref::new("about:blank")),
         ("startup.homepage_welcome_url.additional", Pref::new("")),
 
         // Prevent starting into safe mode after application crashes
         ("toolkit.startup.max_resumed_crashes", Pref::new(-1)),
 
         // We want to collect telemetry, but we don't want to send in the results
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -536,17 +536,17 @@ class DesktopInstance(GeckoInstance):
         # Needed for branded builds to prevent opening a second tab on startup
         "browser.startup.homepage_override.mstone": "ignore",
         # Start with a blank page by default
         "browser.startup.page": 0,
 
         # Disable browser animations
         "toolkit.cosmeticAnimations.enabled": False,
 
-        # Do not warn on exit when multiple tabs are open
+        # Do not warn when closing all open tabs
         "browser.tabs.warnOnClose": False,
         # Do not warn when closing all other open tabs
         "browser.tabs.warnOnCloseOtherTabs": False,
         # Do not warn when multiple tabs will be opened
         "browser.tabs.warnOnOpen": False,
 
         # Disable the UI tour
         "browser.uitour.enabled": False,
--- a/testing/marionette/components/marionette.js
+++ b/testing/marionette/components/marionette.js
@@ -75,28 +75,16 @@ const RECOMMENDED_PREFS = new Map([
   // (bug 1176798, bug 1177018, bug 1210465)
   ["apz.content_response_timeout", 60000],
 
   // Indicate that the download panel has been shown once so that
   // whichever download test runs first doesn't show the popup
   // inconsistently.
   ["browser.download.panel.shown", true],
 
-  // Do not show the EULA notification.
-  //
-  // This should also be set in the profile prior to starting Firefox,
-  // as it is picked up at runtime.
-  ["browser.EULA.override", true],
-
-  // Never start the browser in offline mode
-  //
-  // This should also be set in the profile prior to starting Firefox,
-  // as it is picked up at runtime.
-  ["browser.offline", false],
-
   // Background thumbnails in particular cause grief, and disabling
   // thumbnails in general cannot hurt
   ["browser.pagethumbnails.capturing_disabled", true],
 
   // Disable safebrowsing components.
   //
   // These should also be set in the profile prior to starting Firefox,
   // as it is picked up at runtime.
@@ -115,30 +103,36 @@ const RECOMMENDED_PREFS = new Map([
   ["browser.sessionstore.resume_from_crash", false],
 
   // Don't check for the default web browser during startup.
   //
   // These should also be set in the profile prior to starting Firefox,
   // as it is picked up at runtime.
   ["browser.shell.checkDefaultBrowser", false],
 
-  // Start with a blank page (about:blank)
-  ["browser.startup.page", 0],
+  // Do not warn when quitting with multiple tabs
+  ["browser.showQuitWarning", false],
 
   // Do not redirect user when a milstone upgrade of Firefox is detected
   ["browser.startup.homepage_override.mstone", "ignore"],
 
-  // Disable browser animations
+  // Disable browser animations (tabs, fullscreen, sliding alerts)
   ["toolkit.cosmeticAnimations.enabled", false],
 
-  // Do not allow background tabs to be zombified, otherwise for tests
-  // that open additional tabs, the test harness tab itself might get
+  // Do not close the window when the last tab gets closed
+  ["browser.tabs.closeWindowWithLastTab", false],
+
+  // Do not allow background tabs to be zombified on Android, otherwise for
+  // tests that open additional tabs, the test harness tab itself might get
   // unloaded
   ["browser.tabs.disableBackgroundZombification", false],
 
+  // Do not warn when closing all open tabs
+  ["browser.tabs.warnOnClose", false],
+
   // Do not warn when closing all other open tabs
   ["browser.tabs.warnOnCloseOtherTabs", false],
 
   // Do not warn when multiple tabs will be opened
   ["browser.tabs.warnOnOpen", false],
 
   // Disable first run splash page on Windows 10
   ["browser.usedOnWindows10.introURL", ""],
@@ -147,19 +141,18 @@ const RECOMMENDED_PREFS = new Map([
   //
   // Should be set in profile.
   ["browser.uitour.enabled", false],
 
   // Turn off search suggestions in the location bar so as not to trigger
   // network connections.
   ["browser.urlbar.suggest.searches", false],
 
-  // Turn off the location bar search suggestions opt-in.  It interferes with
-  // tests that don't expect it to be there.
-  ["browser.urlbar.userMadeSearchSuggestionsChoice", true],
+  // Do not warn on quitting Firefox
+  ["browser.warnOnQuit", false],
 
   // Do not show datareporting policy notifications which can
   // interfere with tests
   [
     "datareporting.healthreport.documentServerURI",
     "http://%(server)s/dummy/healthreport/",
   ],
   ["datareporting.healthreport.logging.consoleEnabled", false],
@@ -221,16 +214,19 @@ const RECOMMENDED_PREFS = new Map([
   ["geo.wifi.scan", false],
 
   // No hang monitor
   ["hangmonitor.timeout", 0],
 
   // Show chrome errors and warnings in the error console
   ["javascript.options.showInConsole", true],
 
+  // Do not prompt with long usernames or passwords in URLs
+  ["network.http.phishy-userpass-length", 255],
+
   // Do not prompt for temporary redirects
   ["network.http.prompt-temp-redirect", false],
 
   // Disable speculative connections so they are not reported as leaking
   // when they are hanging around
   ["network.http.speculative-parallel-limit", 0],
 
   // Do not automatically switch between offline and online