Bug 1849972 - [remote] Sync preferences from Marionette to disable services trying to connect to remote addresses. r=webdriver-reviewers,jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D186825
This commit is contained in:
Henrik Skupin 2023-09-11 21:21:23 +00:00
parent 846855470a
commit 103010df73
4 changed files with 57 additions and 20 deletions

View File

@ -42,16 +42,16 @@ if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
// Preferences for remote control and automation can be set from several entry
// points:
// - remote/shared/RecommendedPreferences.sys.mjs
// - remote/test/puppeteer/src/node/FirefoxLauncher.ts
// - remote/test/puppeteer/packages/browsers/src/browser-data/firefox.ts
// - testing/geckodriver/src/prefs.rs
// - testing/marionette/client/marionette_driver/geckoinstance.py
//
// The preferences in `FirefoxLauncher.ts`, `prefs.rs` and `geckoinstance.py`
// will be applied before the Application starts, and should typically be used
// for preferences which cannot be updated during the lifetime of the Application.
// The preferences in `firefox.ts`, `prefs.rs` and `geckoinstance.py`
// will be applied before the application starts, and should typically be used
// for preferences which cannot be updated during the lifetime of the application.
//
// The preferences in `RecommendedPreferences.sys.mjs` are applied after
// the Application has started, which means that the application must apply this
// the application has started, which means that the application must apply this
// change dynamically and behave correctly. Note that you can also define
// protocol specific preferences (CDP, WebDriver, ...) which are merged with the
// COMMON_PREFERENCES from `RecommendedPreferences.sys.mjs`.
@ -115,14 +115,17 @@ const COMMON_PREFERENCES = new Map([
// thumbnails in general cannot hurt
["browser.pagethumbnails.capturing_disabled", true],
// Disable geolocation ping(#1)
["browser.region.network.url", ""],
// Disable safebrowsing components.
//
// These should also be set in the profile prior to starting Firefox,
// as it is picked up at runtime.
["browser.safebrowsing.blockedURIs.enabled", false],
["browser.safebrowsing.downloads.enabled", false],
["browser.safebrowsing.passwords.enabled", false],
["browser.safebrowsing.malware.enabled", false],
["browser.safebrowsing.passwords.enabled", false],
["browser.safebrowsing.phishing.enabled", false],
// Disable updates to search engines.
@ -170,11 +173,6 @@ const COMMON_PREFERENCES = new Map([
// Disable first run splash page on Windows 10
["browser.usedOnWindows10.introURL", ""],
// Disable the UI tour.
//
// Should be set in profile.
["browser.uitour.enabled", false],
// Turn off Merino suggestions in the location bar so as not to trigger
// network connections.
["browser.urlbar.merino.endpointURL", ""],
@ -186,6 +184,9 @@ const COMMON_PREFERENCES = new Map([
// Do not warn on quitting Firefox
["browser.warnOnQuit", false],
// Disable captive portal
["captivedetect.canonicalURL", ""],
// Do not show datareporting policy notifications which can
// interfere with tests
[
@ -250,12 +251,46 @@ const COMMON_PREFERENCES = new Map([
// Make sure opening about:addons will not hit the network
["extensions.getAddons.discovery.api_url", "data:, "],
// Redirect various extension update URLs
[
"extensions.blocklist.detailsURL",
"http://%(server)s/extensions-dummy/blocklistDetailsURL",
],
[
"extensions.blocklist.itemURL",
"http://%(server)s/extensions-dummy/blocklistItemURL",
],
["extensions.hotfix.url", "http://%(server)s/extensions-dummy/hotfixURL"],
[
"extensions.systemAddon.update.url",
"http://%(server)s/dummy-system-addons.xml",
],
[
"extensions.update.background.url",
"http://%(server)s/extensions-dummy/updateBackgroundURL",
],
["extensions.update.url", "http://%(server)s/extensions-dummy/updateURL"],
// Make sure opening about: addons won't hit the network
["extensions.getAddons.discovery.api_url", "data:, "],
[
"extensions.getAddons.get.url",
"http://%(server)s/extensions-dummy/repositoryGetURL",
],
[
"extensions.getAddons.search.browseURL",
"http://%(server)s/extensions-dummy/repositoryBrowseURL",
],
// Allow the application to have focus even it runs in the background
["focusmanager.testmode", true],
// Disable useragent updates
["general.useragent.updates.enabled", false],
// Disable geolocation ping(#2)
["geo.provider.network.url", ""],
// Always use network provider for geolocation tests so we bypass the
// macOS dialog raised by the corelocation provider
["geo.provider.testing", true],
@ -263,6 +298,12 @@ const COMMON_PREFERENCES = new Map([
// Do not scan Wifi
["geo.wifi.scan", false],
// Disable Firefox accounts ping
["identity.fxaccounts.auth.uri", "https://{server}/dummy/fxa"],
// Disable connectivity service pings
["network.connectivity-service.enabled", false],
// Do not prompt with long usernames or passwords in URLs
["network.http.phishy-userpass-length", 255],
@ -309,6 +350,9 @@ const COMMON_PREFERENCES = new Map([
// Prevent starting into safe mode after application crashes
["toolkit.startup.max_resumed_crashes", -1],
// Disable all telemetry pings
["toolkit.telemetry.server", "https://%(server)s/telemetry-dummy/"],
// Disable window occlusion on Windows, which can prevent webdriver commands
// such as WebDriver:FindElements from working properly (Bug 1802473).
["widget.windows.window_occlusion_tracking.enabled", false],

View File

@ -32,13 +32,6 @@ lazy_static! {
("browser.dom.window.dump.enabled", Pref::new(true)),
("devtools.console.stdout.chrome", 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)),
// Do not restore the last open set of tabs if the browser crashed
("browser.sessionstore.resume_from_crash", Pref::new(false)),

View File

@ -48,8 +48,7 @@ class GeckoInstance(object):
# Don't pull Top Sites content from the network
"browser.topsites.contile.enabled": False,
# Disable UI tour
"browser.uitour.pinnedTabUrl": "http://%(server)s/uitour-dummy/pinnedTab",
"browser.uitour.url": "http://%(server)s/uitour-dummy/tour",
"browser.uitour.enabled": False,
# Disable captive portal
"captivedetect.canonicalURL": "",
# Defensively disable data reporting systems

View File

@ -47,6 +47,7 @@ user_pref("browser.safebrowsing.downloads.enabled", false);
user_pref("browser.safebrowsing.passwords.enabled", false);
user_pref("browser.safebrowsing.malware.enabled", false);
user_pref("browser.safebrowsing.phishing.enabled", false);
user_pref("browser.safebrowsing.update.enabled", false);
// Automatically unload beforeunload alerts
user_pref("dom.disable_beforeunload", true);
// Enable implicit keyframes since the common animation interpolation test