diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/profiles | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
27 files changed, 1211 insertions, 0 deletions
diff --git a/testing/profiles/base/extensions/README.txt b/testing/profiles/base/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/base/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/base/user.js b/testing/profiles/base/user.js new file mode 100644 index 0000000000..ed25f8b1d1 --- /dev/null +++ b/testing/profiles/base/user.js @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// This is useful for testing a pref on try. +/* globals user_pref */ +// ensure webrender is set (and we don't need MOZ_WEBRENDER env variable) +user_pref("gfx.webrender.all", true); +user_pref("dom.input_events.security.minNumTicks", 0); +user_pref("dom.input_events.security.minTimeElapsedInMS", 0); diff --git a/testing/profiles/common/extensions/README.txt b/testing/profiles/common/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/common/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/common/user.js b/testing/profiles/common/user.js new file mode 100644 index 0000000000..49f6683ba4 --- /dev/null +++ b/testing/profiles/common/user.js @@ -0,0 +1,92 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Common preferences file used by both unittest and perf harnesses. +/* globals user_pref */ +user_pref("app.update.checkInstallTime", false); +user_pref("app.update.disabledForTesting", true); +user_pref("browser.chrome.guess_favicon", false); +user_pref("browser.dom.window.dump.enabled", true); +user_pref("devtools.console.stdout.chrome", true); +// asrouter expects a plain object or null +user_pref("browser.newtabpage.activity-stream.asrouter.providers.cfr", "null"); +user_pref("browser.newtabpage.activity-stream.asrouter.providers.snippets", "null"); +user_pref("browser.newtabpage.activity-stream.asrouter.providers.message-groups", "null"); +user_pref("browser.newtabpage.activity-stream.asrouter.providers.whats-new-panel", "null"); +user_pref("browser.newtabpage.activity-stream.asrouter.providers.messaging-experiments", "null"); +user_pref("browser.newtabpage.activity-stream.feeds.system.topstories", false); +user_pref("browser.newtabpage.activity-stream.feeds.snippets", false); +user_pref("browser.newtabpage.activity-stream.tippyTop.service.endpoint", ""); +user_pref("browser.newtabpage.activity-stream.discoverystream.config", "[]"); + +// For Activity Stream firstrun page, use an empty string to avoid fetching. +user_pref("browser.newtabpage.activity-stream.fxaccounts.endpoint", ""); +// Background thumbnails in particular cause grief, and disabling thumbnails +// in general can't hurt - we re-enable them when tests need them. +user_pref("browser.pagethumbnails.capturing_disabled", true); +// Tell the search service we are running in the US. This also has the desired +// side-effect of preventing our geoip lookup. +user_pref("browser.search.region", "US"); +// disable infobar for tests +user_pref("browser.search.removeEngineInfobar.enabled", false); +// Disable webapp updates. Yes, it is supposed to be an integer. +user_pref("browser.webapps.checkForUpdates", 0); +// We do not wish to display datareporting policy notifications as it might +// cause other tests to fail. Tests that wish to test the notification functionality +// should explicitly disable this pref. +user_pref("datareporting.policy.dataSubmissionPolicyBypassNotification", true); +user_pref("dom.max_chrome_script_run_time", 0); +user_pref("dom.max_script_run_time", 0); // no slow script dialogs +user_pref("dom.send_after_paint_to_content", true); +// Only load extensions from the application and user profile +// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION +user_pref("extensions.enabledScopes", 5); +user_pref("extensions.experiments.enabled", true); +// Turn off extension updates so they don't bother tests +user_pref("extensions.update.enabled", false); +// Prevent network access for recommendations by default. The payload is {"results":[]}. +user_pref("extensions.getAddons.discovery.api_url", "data:;base64,eyJyZXN1bHRzIjpbXX0%3D"); +// Treat WebExtension API/schema warnings as errors. +user_pref("extensions.webextensions.warnings-as-errors", true); +// Disable useragent updates. +user_pref("general.useragent.updates.enabled", false); +user_pref("hangmonitor.timeout", 0); // no hang monitor +user_pref("media.gmp-manager.updateEnabled", false); +// Don't do network connections for mitm priming +user_pref("security.certerrors.mitm.priming.enabled", false); +// Enable some dangerous features for test code. :-( +user_pref("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true); +user_pref("xpinstall.signatures.required", false); +// Prevent Remote Settings to issue non local connections. +user_pref("services.settings.server", "data:,#remote-settings-dummy/v1"); +// Ensure autoplay is enabled for all platforms. +user_pref("media.autoplay.default", 0); // 0=Allowed, 1=Blocked, 2=Prompt +user_pref("media.autoplay.blocking_policy", 0); +user_pref("media.autoplay.ask-permission", false); +user_pref("media.autoplay.block-webaudio", false); +user_pref("media.allowed-to-play.enabled", true); +// Ensure media can always play without delay +user_pref("media.block-autoplay-until-in-foreground", false); +user_pref("toolkit.telemetry.coverage.endpoint.base", "http://localhost"); +// Don't ask for a request in testing unless explicitly set this as true. +user_pref("media.geckoview.autoplay.request", false); +user_pref("geo.provider.network.compare.url", ""); +user_pref("browser.region.network.url", ""); +// Do not unload tabs on low memory when testing +user_pref("browser.tabs.unloadOnLowMemory", false); +// Don't pull Top Sites content from the network +user_pref("browser.topsites.contile.enabled", false); +// Default Glean to "record but don't report" mode. Docs: +// https://firefox-source-docs.mozilla.org/toolkit/components/glean/dev/preferences.html +user_pref("telemetry.fog.test.localhost_port", -1); +// Disable overlay scrollbars on GTK for testing. A bunch of tests (specially +// mochitests) assume scrollbars take space. We disable them on macOS (where +// overlay is also the default) at the system level as well, so this is +// probably ok. +// +// We test the relevant overlay scrollbar code-paths on Android. +user_pref("widget.gtk.overlay-scrollbars.enabled", false); +// Generally, we don't want daily idle tasks run during tests. Specific tests +// can re-enable if needed. +user_pref("idle.lastDailyNotification", -1); diff --git a/testing/profiles/geckoview-junit/user.js b/testing/profiles/geckoview-junit/user.js new file mode 100644 index 0000000000..76def90c6b --- /dev/null +++ b/testing/profiles/geckoview-junit/user.js @@ -0,0 +1,10 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Base preferences file used by the mochitest +/* globals user_pref */ +/* eslint quotes: 0 */ + +// Always run in e10s +user_pref("browser.tabs.remote.autostart", true); diff --git a/testing/profiles/mochitest/user.js b/testing/profiles/mochitest/user.js new file mode 100644 index 0000000000..346cde98ee --- /dev/null +++ b/testing/profiles/mochitest/user.js @@ -0,0 +1,18 @@ +// Base preferences file used by the mochitest +/* globals user_pref */ +/* eslint quotes: 0 */ + +// Don't restore the last open set of tabs if the browser has crashed +// or if the profile folder is re-used after an exit(0) fast shutdown. +user_pref("browser.sessionstore.resume_from_crash", false); + +// Better stacks for errors. +user_pref("javascript.options.asyncstack_capture_debuggee_only", false); + +// Don't enable paint suppression when the background is unknown. While paint +// is suppressed, synthetic click events and co. go to the old page, which can +// be confusing for tests that send click events before the first paint. +user_pref("nglayout.initialpaint.unsuppress_with_no_background", true); + +// Disable prefers-reduced-motion to ensure that smooth scrolls can be tested. +user_pref("general.smoothScroll", true); diff --git a/testing/profiles/moz.build b/testing/profiles/moz.build new file mode 100644 index 0000000000..579b510d4d --- /dev/null +++ b/testing/profiles/moz.build @@ -0,0 +1,26 @@ +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +profile_files = [ + "base/*", + "common/*", + "geckoview-junit/*", + "mochitest/*", + "perf/*", + "profiles.json", + "profileserver/*", + "reftest/*", + "unittest-features/*", + "unittest-required/*", + "web-platform/*", +] + +TEST_HARNESS_FILES.reftest.profile_data += profile_files +TEST_HARNESS_FILES.testing.mochitest.profile_data += profile_files +TEST_HARNESS_FILES["web-platform"].prefs += profile_files + +with Files("**"): + BUG_COMPONENT = ("Testing", "General") diff --git a/testing/profiles/perf/extensions/README.txt b/testing/profiles/perf/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/perf/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/perf/user.js b/testing/profiles/perf/user.js new file mode 100644 index 0000000000..997fa11791 --- /dev/null +++ b/testing/profiles/perf/user.js @@ -0,0 +1,97 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Base preferences file used by performance harnesses +/* globals user_pref */ +user_pref("app.normandy.api_url", "https://127.0.0.1/selfsupport-dummy/"); +user_pref("browser.EULA.override", true); +user_pref("browser.addon-watch.interval", -1); // Deactivate add-on watching +// Disable Bookmark backups by default. +user_pref("browser.bookmarks.max_backups", 0); +user_pref("browser.cache.disk.smart_size.enabled", false); +user_pref("browser.contentHandlers.types.0.uri", "http://127.0.0.1/rss?url=%s"); +user_pref("browser.contentHandlers.types.1.uri", "http://127.0.0.1/rss?url=%s"); +user_pref("browser.contentHandlers.types.2.uri", "http://127.0.0.1/rss?url=%s"); +user_pref("browser.contentHandlers.types.3.uri", "http://127.0.0.1/rss?url=%s"); +user_pref("browser.contentHandlers.types.4.uri", "http://127.0.0.1/rss?url=%s"); +user_pref("browser.contentHandlers.types.5.uri", "http://127.0.0.1/rss?url=%s"); +user_pref("browser.link.open_newwindow", 2); +user_pref("browser.newtabpage.activity-stream.default.sites", ""); +user_pref("browser.newtabpage.activity-stream.telemetry", false); +user_pref("browser.reader.detectedFirstArticle", true); +user_pref("browser.safebrowsing.blockedURIs.enabled", false); +user_pref("browser.safebrowsing.downloads.enabled", false); +user_pref("browser.safebrowsing.downloads.remote.url", "http://127.0.0.1/safebrowsing-dummy/downloads"); +user_pref("browser.safebrowsing.malware.enabled", false); +user_pref("browser.safebrowsing.passwords.enabled", false); +user_pref("browser.safebrowsing.phishing.enabled", false); +user_pref("browser.safebrowsing.provider.google.gethashURL", "http://127.0.0.1/safebrowsing-dummy/gethash"); +user_pref("browser.safebrowsing.provider.google.updateURL", "http://127.0.0.1/safebrowsing-dummy/update"); +user_pref("browser.safebrowsing.provider.google4.gethashURL", "http://127.0.0.1/safebrowsing4-dummy/gethash"); +user_pref("browser.safebrowsing.provider.google4.updateURL", "http://127.0.0.1/safebrowsing4-dummy/update"); +user_pref("browser.safebrowsing.provider.mozilla.gethashURL", "http://127.0.0.1/safebrowsing-dummy/gethash"); +user_pref("browser.safebrowsing.provider.mozilla.updateURL", "http://127.0.0.1/safebrowsing-dummy/update"); +user_pref("browser.shell.checkDefaultBrowser", false); +user_pref("browser.startup.couldRestoreSession.count", -1); +user_pref("browser.tabs.remote.autostart", true); +user_pref("browser.warnOnQuit", false); +user_pref("datareporting.healthreport.documentServerURI", "http://127.0.0.1/healthreport/"); +user_pref("devtools.chrome.enabled", false); +user_pref("devtools.debugger.remote-enabled", false); +user_pref("devtools.theme", "light"); +user_pref("devtools.timeline.enabled", false); +user_pref("dom.allow_scripts_to_close_windows", true); +user_pref("dom.disable_open_during_load", false); +user_pref("dom.disable_window_flip", true); +user_pref("dom.disable_window_move_resize", true); +user_pref("dom.push.connection.enabled", false); +user_pref("extensions.autoDisableScopes", 10); +user_pref("extensions.blocklist.enabled", false); +user_pref("extensions.checkCompatibility", false); +user_pref("extensions.getAddons.get.url", "http://127.0.0.1/extensions-dummy/repositoryGetURL"); +user_pref("extensions.getAddons.search.browseURL", "http://127.0.0.1/extensions-dummy/repositoryBrowseURL"); +user_pref("extensions.hotfix.url", "http://127.0.0.1/extensions-dummy/hotfixURL"); +user_pref("extensions.systemAddon.update.url", "http://127.0.0.1/dummy-system-addons.xml"); +user_pref("extensions.update.background.url", "http://127.0.0.1/extensions-dummy/updateBackgroundURL"); +user_pref("extensions.update.notifyUser", false); +user_pref("extensions.update.url", "http://127.0.0.1/extensions-dummy/updateURL"); +user_pref("identity.fxaccounts.auth.uri", "https://127.0.0.1/fxa-dummy/"); +user_pref("identity.fxaccounts.migrateToDevEdition", false); +user_pref("media.capturestream_hints.enabled", true); +user_pref("media.gmp-manager.url", "http://127.0.0.1/gmpmanager-dummy/update.xml"); +// Don't block old libavcodec libraries when testing, because our test systems +// cannot easily be upgraded. +user_pref("media.libavcodec.allow-obsolete", true); +user_pref("media.navigator.enabled", true); +user_pref("media.navigator.permission.disabled", true); +user_pref("media.peerconnection.enabled", true); +// Set places maintenance far in the future (the maximum time possible in an +// int32_t) to avoid it kicking in during tests. The maintenance can take a +// relatively long time which may cause unnecessary intermittents and slow down +// tests. This, like many things, will stop working correctly in 2038. +user_pref("places.database.lastMaintenance", 2147483647); +user_pref("privacy.reduceTimerPrecision", false); // Bug 1445243 - reduces precision of tests +user_pref("privacy.trackingprotection.annotate_channels", false); +user_pref("privacy.trackingprotection.enabled", false); +user_pref("privacy.trackingprotection.introURL", "http://127.0.0.1/trackingprotection/tour"); +user_pref("privacy.trackingprotection.pbmode.enabled", false); +user_pref("security.enable_java", false); +user_pref("security.fileuri.strict_origin_policy", false); +user_pref("toolkit.telemetry.server", "https://127.0.0.1/telemetry-dummy/"); +user_pref("telemetry.fog.test.localhost_port", -1); +// The telemetry system sometimes uses a separate program to send telemetry +// pings, particularly in the case when Firefox is shutting down. The prefs above +// prevent telemetry from being sent anywhere useful, but even so the process would +// still be launched. Because performance tests start and stop the browser in rapid +// succession, the pingsender calls from the previous test can run simultaneously with +// the next test, increasing the system resource load and skewing the +// results. So we just silently skip the pingsender invocation during perf tests. +user_pref("toolkit.telemetry.testing.suppressPingsender", true); +user_pref("startup.homepage_welcome_url", ""); +user_pref("startup.homepage_welcome_url.additional", ""); +// Ensures that system principal triggered about:blank load within the current +// process to avoid performing process switches in the middle of warm load +// tests (bug 1725270). Can be removed once non-about:blank intermediate pages +// are used instead (bug 1724261). +user_pref("browser.tabs.remote.systemTriggeredAboutBlankAnywhere", true); diff --git a/testing/profiles/profile b/testing/profiles/profile new file mode 100755 index 0000000000..7ca300a0bd --- /dev/null +++ b/testing/profiles/profile @@ -0,0 +1,301 @@ +#!/bin/sh +# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: + +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +# The beginning of this script is both valid shell and valid python, +# such that the script starts with the shell and is reexecuted python +'''which' mach > /dev/null 2>&1 && exec mach python "$0" "$@" || +echo "mach not found, either add it to your \$PATH or run this script via ./mach python testing/profiles/profile"; exit # noqa +''' + +"""This script can be used to: + + 1) Show all preferences for a given suite + 2) Diff preferences between two suites or profiles + 3) Sort preference files alphabetically for a given profile + +To use, either make sure that `mach` is on your $PATH, or run: + $ ./mach python testing/profiles/profile <args> + +For more details run: + $ ./profile -- --help +""" + +import json +import os +import sys +from argparse import ArgumentParser +from itertools import chain + +from mozprofile import Profile +from mozprofile.prefs import Preferences + +here = os.path.abspath(os.path.dirname(__file__)) + +try: + import jsondiff +except ImportError: + from mozbuild.base import MozbuildObject + build = MozbuildObject.from_environment(cwd=here) + build.virtualenv_manager.install_pip_package("jsondiff") + import jsondiff + + +FORMAT_STRINGS = { + 'names': ( + '{pref}', + '{pref}', + ), + 'pretty': ( + '{pref}: {value}', + '{pref}: {value_a} => {value_b}' + ), +} + + +def read_prefs(profile, pref_files=None): + """Read and return all preferences set in the given profile. + + :param profile: Profile name relative to this `here`. + :returns: A dictionary of preferences set in the profile. + """ + pref_files = pref_files or Profile.preference_file_names + prefs = {} + for name in pref_files: + path = os.path.join(here, profile, name) + if not os.path.isfile(path): + continue + + try: + prefs.update(Preferences.read_json(path)) + except ValueError: + prefs.update(Preferences.read_prefs(path)) + return prefs + + +def get_profiles(key): + """Return a list of profile names for key.""" + with open(os.path.join(here, 'profiles.json'), 'r') as fh: + profiles = json.load(fh) + + if '+' in key: + keys = key.split('+') + else: + keys = [key] + + names = set() + for key in keys: + if key in profiles: + names.update(profiles[key]) + elif os.path.isdir(os.path.join(here, key)): + names.add(key) + + if not names: + raise ValueError('{} is not a recognized suite or profile'.format(key)) + return names + + +def read(key): + """Read preferences relevant to either a profile or suite. + + :param key: Can either be the name of a profile, or the name of + a suite as defined in suites.json. + """ + prefs = {} + for profile in get_profiles(key): + prefs.update(read_prefs(profile)) + return prefs + + +def format_diff(diff, fmt, limit_key): + """Format a diff.""" + indent = ' ' + if limit_key: + diff = {limit_key: diff[limit_key]} + indent = '' + + if fmt == 'json': + print(json.dumps(diff, sort_keys=True, indent=2)) + return 0 + + lines = [] + for key, prefs in sorted(diff.items()): + if not limit_key: + lines.append("{}:".format(key)) + + for pref, value in sorted(prefs.items()): + context = {'pref': pref, 'value': repr(value)} + + if isinstance(value, list): + context['value_a'] = repr(value[0]) + context['value_b'] = repr(value[1]) + text = FORMAT_STRINGS[fmt][1].format(**context) + else: + text = FORMAT_STRINGS[fmt][0].format(**context) + + lines.append('{}{}'.format(indent, text)) + lines.append('') + print('\n'.join(lines).strip()) + + +def diff(a, b, fmt, limit_key): + """Diff two profiles or suites. + + :param a: The first profile or suite name. + :param b: The second profile or suite name. + """ + prefs_a = read(a) + prefs_b = read(b) + res = jsondiff.diff(prefs_a, prefs_b, syntax='symmetric') + if not res: + return 0 + + if isinstance(res, list) and len(res) == 2: + res = { + jsondiff.Symbol('delete'): res[0], + jsondiff.Symbol('insert'): res[1], + } + + # Post process results to make them JSON compatible and a + # bit more clear. Also calculate identical prefs. + results = {} + results['change'] = {k: v for k, v in res.items() if not isinstance(k, jsondiff.Symbol)} + + symbols = [(k, v) for k, v in res.items() if isinstance(k, jsondiff.Symbol)] + results['insert'] = {k: v for sym, pref in symbols for k, v in pref.items() + if sym.label == 'insert'} + results['delete'] = {k: v for sym, pref in symbols for k, v in pref.items() + if sym.label == 'delete'} + + same = set(prefs_a.keys()) - set(chain(*results.values())) + results['same'] = {k: v for k, v in prefs_a.items() if k in same} + return format_diff(results, fmt, limit_key) + + +def read_with_comments(path): + with open(path, 'r') as fh: + lines = fh.readlines() + + result = [] + buf = [] + for line in lines: + line = line.strip() + if not line: + continue + + if line.startswith('//'): + buf.append(line) + continue + + if buf: + result.append(buf + [line]) + buf = [] + continue + + result.append([line]) + return result + + +def sort_file(path): + """Sort the given pref file alphabetically, preserving preceding comments + that start with '//'. + + :param path: Path to the preference file to sort. + """ + result = read_with_comments(path) + result = sorted(result, key=lambda x: x[-1]) + result = chain(*result) + + with open(path, 'w') as fh: + fh.write('\n'.join(result) + '\n') + + +def sort(profile): + """Sort all prefs in the given profile alphabetically. This will preserve + comments on preceding lines. + + :param profile: The name of the profile to sort. + """ + pref_files = Profile.preference_file_names + + for name in pref_files: + path = os.path.join(here, profile, name) + if os.path.isfile(path): + sort_file(path) + + +def show(suite): + """Display all prefs set in profiles used by the given suite. + + :param suite: The name of the suite to show preferences for. This must + be a key in suites.json. + """ + for k, v in sorted(read(suite).items()): + print("{}: {}".format(k, repr(v))) + + +def rm(profile, pref_file): + if pref_file == '-': + lines = sys.stdin.readlines() + else: + with open(pref_file, 'r') as fh: + lines = fh.readlines() + + lines = [l.strip() for l in lines if l.strip()] + if not lines: + return + + def filter_line(content): + return not any(line in content[-1] for line in lines) + + path = os.path.join(here, profile, 'user.js') + contents = read_with_comments(path) + contents = filter(filter_line, contents) + contents = chain(*contents) + with open(path, 'w') as fh: + fh.write('\n'.join(contents)) + + +def cli(args=sys.argv[1:]): + parser = ArgumentParser() + subparsers = parser.add_subparsers(dest='func') + subparsers.required = True + + diff_parser = subparsers.add_parser('diff') + diff_parser.add_argument('a', metavar='A', + help="Path to the first profile or suite name to diff.") + diff_parser.add_argument('b', metavar='B', + help="Path to the second profile or suite name to diff.") + diff_parser.add_argument('-f', '--format', dest='fmt', default='pretty', + choices=['pretty', 'json', 'names'], + help="Format to dump diff in (default: pretty)") + diff_parser.add_argument('-k', '--limit-key', default=None, + choices=['change', 'delete', 'insert', 'same'], + help="Restrict diff to the specified key.") + diff_parser.set_defaults(func=diff) + + sort_parser = subparsers.add_parser('sort') + sort_parser.add_argument('profile', help="Path to profile to sort preferences.") + sort_parser.set_defaults(func=sort) + + show_parser = subparsers.add_parser('show') + show_parser.add_argument('suite', help="Name of suite to show arguments for.") + show_parser.set_defaults(func=show) + + rm_parser = subparsers.add_parser('rm') + rm_parser.add_argument('profile', help="Name of the profile to remove prefs from.") + rm_parser.add_argument('--pref-file', default='-', help="File containing a list of pref " + "substrings to delete (default: stdin)") + rm_parser.set_defaults(func=rm) + + args = vars(parser.parse_args(args)) + func = args.pop('func') + func(**args) + + +if __name__ == '__main__': + sys.exit(cli()) diff --git a/testing/profiles/profiles.json b/testing/profiles/profiles.json new file mode 100644 index 0000000000..d52864ded1 --- /dev/null +++ b/testing/profiles/profiles.json @@ -0,0 +1,41 @@ +{ + "geckoview-junit": [ + "base", + "common", + "unittest-required", + "unittest-features", + "geckoview-junit" + ], + "mochitest": [ + "base", + "common", + "unittest-required", + "unittest-features", + "mochitest" + ], + "profileserver": [ + "base", + "common", + "unittest-required", + "unittest-features", + "profileserver" + ], + "raptor": ["base", "common", "perf", "raptor"], + "reftest": ["base", "common", "reftest"], + "talos": ["base", "common", "perf"], + "valgrind": [ + "base", + "common", + "unittest-required", + "unittest-features", + "valgrind" + ], + "xpcshell": ["base", "xpcshell"], + "web-platform-tests": [ + "base", + "common", + "unittest-required", + "unittest-features", + "web-platform" + ] +} diff --git a/testing/profiles/profileserver/extensions/README.txt b/testing/profiles/profileserver/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/profileserver/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/profileserver/user.js b/testing/profiles/profileserver/user.js new file mode 100644 index 0000000000..b1a46af982 --- /dev/null +++ b/testing/profiles/profileserver/user.js @@ -0,0 +1,11 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Preferences file for profileserver. +/* globals user_pref */ +// Turn off budget throttling for the profile server +user_pref("dom.timeout.enable_budget_timer_throttling", false); +// TODO: Bug 1795750 - Re-enable this pref when we have a new version of the +// Quitter XPI with a simpler version format. +user_pref("extensions.webextensions.warnings-as-errors", false); diff --git a/testing/profiles/raptor-android/extensions/README.txt b/testing/profiles/raptor-android/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/raptor-android/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/raptor-android/user.js b/testing/profiles/raptor-android/user.js new file mode 100644 index 0000000000..62081bfe2d --- /dev/null +++ b/testing/profiles/raptor-android/user.js @@ -0,0 +1,16 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Preferences file used by the raptor harness exclusively on android +/* globals user_pref */ + +// disk cache smart size is enabled in shipped apps +user_pref("browser.cache.disk.smart_size.enabled", true); + +// Raptor's manifest.json contains the "geckoProfiler" permission, which is +// not supported on Android. Ignore the warning about the unknown permission. +user_pref("extensions.webextensions.warnings-as-errors", false); +// disable telemetry bug 1639148 +user_pref("toolkit.telemetry.server", ""); +user_pref("telemetry.fog.test.localhost_port", -1); diff --git a/testing/profiles/raptor/extensions/README.txt b/testing/profiles/raptor/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/raptor/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/raptor/user.js b/testing/profiles/raptor/user.js new file mode 100644 index 0000000000..dc82a29def --- /dev/null +++ b/testing/profiles/raptor/user.js @@ -0,0 +1,53 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Preferences file used by the raptor harness +/* globals user_pref */ +// prevents normandy from running updates during the tests +user_pref("app.normandy.enabled", false); + +user_pref("dom.performance.time_to_non_blank_paint.enabled", true); +user_pref("dom.performance.time_to_contentful_paint.enabled", true); +user_pref("dom.performance.time_to_dom_content_flushed.enabled", true); +user_pref("dom.performance.time_to_first_interactive.enabled", true); + +// required for geckoview logging +user_pref("geckoview.console.enabled", true); + +// required to prevent non-local access to push.services.mozilla.com +user_pref("dom.push.connection.enabled", false); + +// get the console logging out of the webext into the stdout +user_pref("browser.dom.window.dump.enabled", true); +user_pref("devtools.console.stdout.chrome", true); +user_pref("devtools.console.stdout.content", true); + +// prevent pages from opening after a crash +user_pref("browser.sessionstore.resume_from_crash", false); + +// disable the background hang monitor +user_pref("toolkit.content-background-hang-monitor.disabled", true); + +// disable async stacks to match release builds +// https://developer.mozilla.org/en-US/docs/Mozilla/Benchmarking#Async_Stacks +user_pref('javascript.options.asyncstack', false); + +// disable Firefox Telemetry (and some other things too) +// https://bugzilla.mozilla.org/show_bug.cgi?id=1533879 +user_pref('datareporting.healthreport.uploadEnabled', false); + +// Telemetry initialization happens on a delay, that may elapse exactly in the +// middle of some raptor tests. While it doesn't do a lot of expensive work, it +// causes some I/O and thread creation, that can add noise to performance +// profiles we use to analyze performance regressions. +// https://bugzilla.mozilla.org/show_bug.cgi?id=1706180 +user_pref('toolkit.telemetry.initDelay', 99999999); + +// disable autoplay for raptor tests +user_pref('media.autoplay.default', 5); +user_pref('media.autoplay.ask-permission', true); +user_pref('media.autoplay.blocking_policy', 1); +user_pref('media.autoplay.block-webaudio', true); +user_pref('media.allowed-to-play.enabled', false); +user_pref('media.block-autoplay-until-in-foreground', true); diff --git a/testing/profiles/reftest/extensions/README.txt b/testing/profiles/reftest/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/reftest/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/reftest/user.js b/testing/profiles/reftest/user.js new file mode 100644 index 0000000000..2ac6af5a47 --- /dev/null +++ b/testing/profiles/reftest/user.js @@ -0,0 +1,109 @@ +// Preference file for the reftest harness. +/* globals user_pref */ +// Make sure Shield doesn't hit the network. +user_pref("app.normandy.api_url", "https://localhost/selfsupport-dummy/"); +user_pref("app.update.staging.enabled", false); +user_pref("app.update.url.android", ""); +user_pref("browser.safebrowsing.blockedURIs.enabled", false); +user_pref("browser.safebrowsing.downloads.enabled", false); +user_pref("browser.safebrowsing.downloads.remote.url", "http://127.0.0.1/safebrowsing-dummy/gethash"); +user_pref("browser.safebrowsing.malware.enabled", false); +user_pref("browser.safebrowsing.passwords.enabled", false); +// Likewise for safebrowsing. +user_pref("browser.safebrowsing.phishing.enabled", false); +user_pref("browser.safebrowsing.provider.google.gethashURL", "http://127.0.0.1/safebrowsing-dummyg/gethash"); +user_pref("browser.safebrowsing.provider.google.updateURL", "http://127.0.0.1/safebrowsing-dummyg/update"); +user_pref("browser.safebrowsing.provider.google4.gethashURL", "http://127.0.0.1/safebrowsing-dummyg4/gethash"); +user_pref("browser.safebrowsing.provider.google4.updateURL", "http://127.0.0.1/safebrowsing-dummyg4/update"); +user_pref("browser.safebrowsing.provider.mozilla.gethashURL", "http://127.0.0.1/safebrowsing-dummym/gethash"); +user_pref("browser.safebrowsing.provider.mozilla.updateURL", "http://127.0.0.1/safebrowsing-dummym/update"); +// use about:blank, not browser.startup.homepage +user_pref("browser.startup.page", 0); +// Since our tests are 800px wide, set the assume-designed-for width of all +// pages to be 800px (instead of the default of 980px). This ensures that +// in our 800px window we don't zoom out by default to try to fit the +// assumed 980px content. +user_pref("browser.viewport.desktopWidth", 800); +user_pref("datareporting.healthreport.uploadEnabled", false); +// Don't forcibly kill content processes after a timeout +user_pref("dom.ipc.tabs.shutdownTimeoutSecs", 0); +// For mochitests, we're more interested in testing the behavior of in- +// content XBL bindings, so we set this pref to true. In reftests, we're +// more interested in testing the behavior of XBL as it works in chrome, +// so we want this pref to be false. +user_pref("dom.use_xbl_scopes_for_remote_xul", false); +user_pref("extensions.autoDisableScopes", 0); +// Disable blocklist updates so we don't have them reported as leaks +user_pref("extensions.blocklist.enabled", false); +user_pref("extensions.getAddons.cache.enabled", false); +user_pref("extensions.getAddons.get.url", "http://localhost/extensions-dummy/repositoryGetURL"); +user_pref("extensions.systemAddon.update.url", "http://localhost/dummy-system-addons.xml"); +user_pref("gfx.color_management.force_srgb", true); +user_pref("gfx.color_management.mode", 2); +user_pref("gfx.logging.level", 1); +// Disable downscale-during-decode, since it makes reftests more difficult. +user_pref("image.downscale-during-decode.enabled", false); +// We do the capturing the reftest results with sync decoding +// so we want to be consistent. +user_pref("image.decode-sync.enabled", true); +// Disable interruptible reflow since (1) it's normally not going to +// happen, but (2) it might happen if we somehow end up with both +// pending user events and clock skew. So to avoid having to change +// MakeProgress to deal with waiting for interruptible reflows to +// complete for a rare edge case, we just disable interruptible +// reflow so that that rare edge case doesn't lead to reftest +// failures. +user_pref("layout.interruptible-reflow.enabled", false); +// Disable the fade out (over time) of overlay scrollbars, since we +// can't guarantee taking both reftest snapshots at the same point +// during the fade. +user_pref("layout.testing.overlay-scrollbars.always-visible", true); +// The broken image icon doesn't block the load event and thus there's no easy +// way to guarantee it's loaded by the time we take the reftest screenshot. +user_pref("layout.image.eager_broken_image_icon", true); +user_pref("media.gmp-manager.url.override", "http://localhost/dummy-gmp-manager.xml"); +user_pref("media.openUnsupportedTypeWithExternalApp", false); +// Reftests load a lot of URLs very quickly. This puts avoidable and +// unnecessary I/O pressure on the Places DB (measured to be in the +// gigabytes). +user_pref("places.history.enabled", false); +user_pref("privacy.trackingprotection.annotate_channels", false); +user_pref("privacy.trackingprotection.enabled", false); +user_pref("privacy.trackingprotection.pbmode.enabled", false); +// Disable all recommended Remote Protocol preferences for Gecko tests. +// The prefs recommended by Remote Protocol are typically geared towards +// consumer automation; not vendor testing. +user_pref("remote.prefs.recommended", false); +// Checking whether two files are the same is slow on Windows. +// Setting this pref makes tests run much faster there. Reftests also +// rely on this to load downloadable fonts (which are restricted to same +// origin policy by default) from outside their directory. +user_pref("security.fileuri.strict_origin_policy", false); +user_pref("startup.homepage_override_url", ""); +user_pref("startup.homepage_welcome_url", ""); +user_pref("startup.homepage_welcome_url.additional", ""); +// A fake bool pref for "@supports -moz-bool-pref" sanify test. +user_pref("testing.supports.moz-bool-pref", false); +// Ensure that telemetry is disabled, so we don't connect to the telemetry +// server in the middle of the tests. +user_pref("toolkit.telemetry.enabled", false); +user_pref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy/"); +user_pref("telemetry.fog.test.localhost_port", -1); +user_pref("ui.caretBlinkTime", -1); +user_pref("ui.caretWidth", 1); +user_pref("ui.prefersReducedMotion", 0); +user_pref("ui.systemUsesDarkTheme", 0); +user_pref("ui.useAccessibilityTheme", 0); +user_pref("ui.windowForeground", ""); +user_pref("ui.windowBackground", ""); +// Turn off the Push service. +user_pref("dom.push.serverURL", ""); +// Disable intermittent telemetry collection +user_pref("toolkit.telemetry.initDelay", 99999999); +// Setting this pref to true for usercss reftests, since it relies on userContent.css +user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", true); +// Use a light color-scheme unless explicitly overriden. +user_pref("layout.css.prefers-color-scheme.content-override", 1); +// Force OffscreenCanvas support +user_pref("gfx.offscreencanvas.enabled", true); +user_pref("dom.workers.requestAnimationFrame", true); diff --git a/testing/profiles/unittest-features/extensions/README.txt b/testing/profiles/unittest-features/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/unittest-features/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/unittest-features/user.js b/testing/profiles/unittest-features/user.js new file mode 100644 index 0000000000..f4c349a4b1 --- /dev/null +++ b/testing/profiles/unittest-features/user.js @@ -0,0 +1,28 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Base preferences file for enabling unittest features. +// Not enabling these features cause many unittests that +// expect these prefs to be set to fail. +// Ideally, tests depending on these prefs should be setting +// the prefs themselves in their manifests... +// NOTE: Setting prefs to enable unittests to run at all +// should occur in unittest-required/user.js, not here! +/* globals user_pref */ +// Enable w3c touch events for testing +user_pref("dom.w3c_touch_events.enabled", 1); +// Enable CSS initial-letter for testing +user_pref("layout.css.initial-letter.enabled", true); +// Enable Media Source Extensions for testing +user_pref("media.mediasource.mp4.enabled", true); +user_pref("media.mediasource.webm.enabled", true); +user_pref("media.av1.enabled", true); +user_pref("media.eme.enabled", true); +user_pref("dom.forms.datetime.others", true); +// Enable Gamepad +user_pref("dom.gamepad.enabled", true); +user_pref("dom.gamepad.non_standard_events.enabled", true); +// Enable form autofill feature testing. +user_pref("extensions.formautofill.addresses.available", "on"); +user_pref("extensions.formautofill.creditCards.available", "on"); diff --git a/testing/profiles/unittest-required/extensions/README.txt b/testing/profiles/unittest-required/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/unittest-required/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/unittest-required/user.js b/testing/profiles/unittest-required/user.js new file mode 100644 index 0000000000..5c63e9be20 --- /dev/null +++ b/testing/profiles/unittest-required/user.js @@ -0,0 +1,241 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Base preferences file to allow unittests to run successfully. +// NOTE: Toggling prefs for testing features should happen in +// unittest-features/user.js or in harness/test manifests, not here! +/* globals user_pref */ +user_pref("accessibility.typeaheadfind.autostart", false); +// Make sure Shield doesn't hit the network. +user_pref("app.normandy.api_url", ""); +// Make sure the notification permission migration test doesn't hit the network. +user_pref("app.support.baseURL", "http://{server}/support-dummy/"); +user_pref("app.update.staging.enabled", false); +user_pref("app.update.url.android", ""); +// 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. See bug 1176798, bug 1177018, +// bug 1210465. +user_pref("apz.content_response_timeout", 60000); +user_pref("browser.EULA.override", true); +// Disable Bookmark backups by default. +user_pref("browser.bookmarks.max_backups", 0); +user_pref("browser.console.showInPanel", true); +// Don't connect to Yahoo! for RSS feed tests. +// en-US only uses .types.0.uri, but set all of them just to be sure. +user_pref("browser.contentHandlers.types.0.uri", "http://test1.example.org/rss?url=%s"); +user_pref("browser.contentHandlers.types.1.uri", "http://test1.example.org/rss?url=%s"); +user_pref("browser.contentHandlers.types.2.uri", "http://test1.example.org/rss?url=%s"); +user_pref("browser.contentHandlers.types.3.uri", "http://test1.example.org/rss?url=%s"); +user_pref("browser.contentHandlers.types.4.uri", "http://test1.example.org/rss?url=%s"); +user_pref("browser.contentHandlers.types.5.uri", "http://test1.example.org/rss?url=%s"); +// Indicate that the download panel has been shown once so that whichever +// download test runs first doesn't show the popup inconsistently. +user_pref("browser.download.panel.shown", true); +user_pref("browser.newtabpage.activity-stream.default.sites", ""); +user_pref("browser.newtabpage.activity-stream.telemetry", false); +// Point the url-classifier to the local testing server for fast failures +user_pref("browser.safebrowsing.downloads.remote.url", "http://{server}/safebrowsing-dummy/update"); +user_pref("browser.safebrowsing.provider.google.gethashURL", "http://{server}/safebrowsing-dummy/gethash"); +user_pref("browser.safebrowsing.provider.google.updateURL", "http://{server}/safebrowsing-dummy/update"); +user_pref("browser.safebrowsing.provider.google4.gethashURL", "http://{server}/safebrowsing4-dummy/gethash"); +user_pref("browser.safebrowsing.provider.google4.updateURL", "http://{server}/safebrowsing4-dummy/update"); +user_pref("browser.safebrowsing.provider.mozilla.gethashURL", "http://{server}/safebrowsing-dummy/gethash"); +user_pref("browser.safebrowsing.provider.mozilla.updateURL", "http://{server}/safebrowsing-dummy/update"); +user_pref("browser.search.suggest.timeout", 10000); // use a 10s suggestion timeout in tests +user_pref("browser.shell.checkDefaultBrowser", false); +user_pref("browser.startup.page", 0); // use about:blank, not browser.startup.homepage +// Don't show a delay when hiding the audio indicator during tests +user_pref("browser.tabs.delayHidingAudioPlayingIconMS", 0); +// Don't allow background tabs to be zombified, otherwise for tests that +// open additional tabs, the test harness tab itself might get unloaded. +user_pref("browser.tabs.disableBackgroundZombification", true); +// Don't use auto-enabled e10s +user_pref("browser.tabs.remote.autostart", false); +// Make sure Translation won't hit the network. +user_pref("browser.translation.bing.authURL", "http://{server}/browser/browser/components/translation/test/bing.sjs"); +user_pref("browser.translation.bing.translateArrayURL", "http://{server}/browser/browser/components/translation/test/bing.sjs"); +user_pref("browser.translation.engine", "Bing"); +user_pref("browser.translation.yandex.translateURLOverride", "http://{server}/browser/browser/components/translation/test/yandex.sjs"); +user_pref("browser.ui.layout.tablet", 0); // force tablet UI off +// Ensure UITour won't hit the network +user_pref("browser.uitour.pinnedTabUrl", "http://{server}/uitour-dummy/pinnedTab"); +user_pref("browser.uitour.url", "http://{server}/uitour-dummy/tour"); +// Turn off Merino suggestions in the location bar so as not to trigger network +// connections. +user_pref("browser.urlbar.merino.endpointURL", ""); +user_pref("browser.urlbar.speculativeConnect.enabled", false); +// Turn off search suggestions in the location bar so as not to trigger network +// connections. +user_pref("browser.urlbar.suggest.searches", false); +user_pref("browser.urlbar.usepreloadedtopurls.enabled", false); +// URIFixup whitelist +user_pref("browser.fixup.domainsuffixwhitelist.test", true); +user_pref("browser.warnOnQuit", false); +// Enable webapps testing mode, which bypasses native installation. +user_pref("browser.webapps.testing", true); +user_pref("captivedetect.canonicalURL", "http://{server}/captive-detect/success.txt"); +// Enable android logcat for better diagnostics on beta/release +user_pref("consoleservice.logcat", true); +// Point Firefox Health Report at a local server. We don't care if it actually +// works. It just can't hit the default production endpoint. +user_pref("datareporting.healthreport.documentServerURI", "http://{server}/healthreport/"); +user_pref("datareporting.healthreport.uploadEnabled", false); +user_pref("devtools.browsertoolbox.panel", "jsdebugger"); +user_pref("devtools.debugger.remote-port", 6023); +user_pref("devtools.testing", true); +user_pref("dom.allow_scripts_to_close_windows", true); +user_pref("dom.disable_open_during_load", false); +user_pref("dom.ipc.reportProcessHangs", true); // process hang monitor +// Don't forceably kill content processes after a timeout +user_pref("dom.ipc.tabs.shutdownTimeoutSecs", 0); +user_pref("dom.min_background_timeout_value", 1000); +user_pref("dom.popup_maximum", -1); +user_pref("dom.block_multiple_popups", false); +// Prevent connection to the push server for tests. +user_pref("dom.push.connection.enabled", false); +user_pref("dom.successive_dialog_time_limit", 0); +// In the default configuration, we bypass XBL scopes (a security feature) for +// domains whitelisted for remote XUL, so that intranet apps and such continue +// to work without major rewrites. However, we also use the whitelist mechanism +// to run our XBL tests in automation, in which case we really want to be testing +// the configuration that we ship to users without special whitelisting. So we +// use an additional pref here to allow automation to use the "normal" behavior. +user_pref("dom.use_xbl_scopes_for_remote_xul", true); +user_pref("extensions.autoDisableScopes", 0); +user_pref("extensions.blocklist.detailsURL", "http://{server}/extensions-dummy/blocklistDetailsURL"); +user_pref("extensions.blocklist.itemURL", "http://{server}/extensions-dummy/blocklistItemURL"); +// XPI extensions are required for test harnesses to load +user_pref("extensions.defaultProviders.enabled", true); +// Disable metadata caching for installed add-ons by default +user_pref("extensions.getAddons.cache.enabled", false); +// Make sure AddonRepository won't hit the network +user_pref("extensions.getAddons.get.url", "http://{server}/extensions-dummy/repositoryGetURL"); +user_pref("extensions.getAddons.search.browseURL", "http://{server}/extensions-dummy/repositoryBrowseURL"); +user_pref("extensions.hotfix.url", "http://{server}/extensions-dummy/hotfixURL"); +// Disable intalling any distribution add-ons +user_pref("extensions.installDistroAddons", false); +// Disable Screenshots by default for now +user_pref("extensions.screenshots.disabled", true); +user_pref("extensions.systemAddon.update.url", "http://{server}/dummy-system-addons.xml"); +user_pref("extensions.systemAddon.update.enabled", false); +user_pref("extensions.update.background.url", "http://{server}/extensions-dummy/updateBackgroundURL"); +// Point update checks to the local testing server for fast failures +user_pref("extensions.update.url", "http://{server}/extensions-dummy/updateURL"); +user_pref("findbar.highlightAll", false); +user_pref("findbar.modalHighlight", false); +// Existing tests assume there is no font size inflation. +user_pref("font.size.inflation.emPerLine", 0); +user_pref("font.size.inflation.minTwips", 0); +user_pref("general.useragent.updates.url", "https://example.com/0/%APP_ID%"); +// Always use network provider for geolocation tests +// so we bypass the OSX dialog raised by the corelocation provider +user_pref("geo.provider.testing", true); +user_pref("geo.provider.network.logging.enabled", true); +user_pref("geo.provider.network.scan", false); +user_pref("geo.provider.network.timeToWaitBeforeSending", 2000); +user_pref("geo.provider.network.url", "http://{server}/tests/dom/tests/mochitest/geolocation/network_geolocation.sjs"); +user_pref("gfx.color_management.force_srgb", true); +user_pref("gfx.logging.level", 1); +// We don't want to hit the real Firefox Accounts server for tests. We don't +// actually need a functioning FxA server, so just set it to something that +// resolves and accepts requests, even if they all fail. +user_pref("identity.fxaccounts.auth.uri", "https://{server}/fxa-dummy/"); +// Ditto for all the FxA content root URI. +user_pref("identity.fxaccounts.remote.root", "https://{server}/"); +// Make sure CSS error reporting is enabled for tests +user_pref("layout.css.report_errors", true); +// Disable spammy layout warnings because they pollute test logs +user_pref("layout.spammy_warnings.enabled", false); +user_pref("media.cache_size", 1000); +user_pref("media.dormant-on-pause-timeout-ms", 0); // Enter dormant immediately without waiting for timeout. +// Set the number of shmems the PChromiumCDM protocol pre-allocates to 0, +// so that we test the case where we under-estimate how many shmems we need +// to send decoded video frames from the CDM to Gecko. +user_pref("media.eme.chromium-api.video-shmems", 0); +// Make sure GMPInstallManager won't hit the network. +user_pref("media.gmp-manager.url.override", "http://{server}/dummy-gmp-manager.xml"); +user_pref("media.hls.server.url", "http://{server}/tests/dom/media/test/hls"); +// Don't block old libavcodec libraries when testing, because our test systems +// cannot easily be upgraded. +user_pref("media.libavcodec.allow-obsolete", true); +user_pref("media.memory_cache_max_size", 32); +user_pref("media.memory_caches_combined_limit_kb", 256); +user_pref("media.openUnsupportedTypeWithExternalApp", false); +user_pref("media.preload.auto", 3); // auto = enough +user_pref("media.preload.default", 2); // default = metadata +user_pref("media.preload.default.cellular", 2); // default = metadata +user_pref("media.suspend-bkgnd-video.enabled", false); +user_pref("media.test.dumpDebugInfo", true); +user_pref("media.volume_scale", "0.01"); +// Enable speech synth test service, and disable built in platform services. +user_pref("media.webspeech.synth.test", true); +user_pref("network.http.prompt-temp-redirect", false); +// Disable speculative connections so they aren't reported as leaking when they're hanging around. +user_pref("network.http.speculative-parallel-limit", 0); +user_pref("network.manage-offline-status", false); +// We know the SNTP request will fail, since localhost isn't listening on +// port 135. The default number of retries (10) is excessive, but retrying +// at least once will mean that codepath is still tested in automation. +user_pref("network.sntp.maxRetryCount", 1); +// Make sure SNTP requests don't hit the network +user_pref("network.sntp.pools", "{server}"); +// Set places maintenance far in the future (the maximum time possible in an +// int32_t) to avoid it kicking in during tests. The maintenance can take a +// relatively long time which may cause unnecessary intermittents and slow down +// tests. This, like many things, will stop working correctly in 2038. +user_pref("places.database.lastMaintenance", 2147483647); +user_pref("privacy.trackingprotection.introURL", "http://{server}/trackingprotection/tour"); +// Disable all recommended Remote Protocol preferences for Gecko tests. +// The prefs recommended by Remote Protocol are typically geared towards +// consumer automation; not vendor testing. +user_pref("remote.prefs.recommended", false); +user_pref("security.default_personal_cert", "Select Automatically"); // Need to client auth test be w/o any dialogs +// Existing tests don't wait for the notification button security delay +user_pref("security.notification_enable_delay", 0); +// Ensure blocklist updates don't hit the network +user_pref("services.settings.server", "data:,#remote-settings-dummy/v1"); +user_pref("shell.checkDefaultClient", false); +// Disable password capture, so that mochitests that include forms aren't +// influenced by the presence of the persistent doorhanger notification. +user_pref("signon.rememberSignons", false); +user_pref("startup.homepage_welcome_url", "about:blank"); +user_pref("startup.homepage_welcome_url.additional", ""); +user_pref("test.mousescroll", true); +// Don't send 'bhr' ping during tests, otherwise the testing framework might +// wait on the pingsender to finish and slow down tests. +user_pref("toolkit.telemetry.bhrPing.enabled", false); +// Don't send the 'first-shutdown' during tests, otherwise tests expecting +// main and subsession pings will fail. +user_pref("toolkit.telemetry.firstShutdownPing.enabled", false); +// Don't send 'new-profile' ping on new profiles during tests, otherwise the testing framework +// might wait on the pingsender to finish and slow down tests. +user_pref("toolkit.telemetry.newProfilePing.enabled", false); +// We want to collect telemetry, but we don't want to send in the results. +user_pref("toolkit.telemetry.server", "https://{server}/telemetry-dummy/"); +user_pref("telemetry.fog.test.localhost_port", -1); +// Don't send the 'shutdown' ping using the pingsender on the first session using +// the 'pingsender' process. Valgrind marks the process as leaky (e.g. see bug 1364068 +// for the 'new-profile' ping) but does not provide enough information +// to suppress the leak. Running locally does not reproduce the issue, +// so disable this until we rewrite the pingsender in Rust (bug 1339035). +user_pref("toolkit.telemetry.shutdownPingSender.enabledFirstSession", false); +// A couple of preferences with default values to test that telemetry preference +// watching is working. +user_pref("toolkit.telemetry.test.pref1", true); +user_pref("toolkit.telemetry.test.pref2", false); +// Disable the caret blinking so we get stable snapshot +user_pref("ui.caretBlinkTime", -1); +user_pref("webextensions.tests", true); +// Disable intermittent telemetry collection +user_pref("toolkit.telemetry.initDelay", 99999999); + +// We use data: to tell the Quitter extension to quit. +user_pref("security.data_uri.block_toplevel_data_uri_navigations", false); + +// We use data: to tell the Quitter extension to quit. +user_pref("security.data_uri.block_toplevel_data_uri_navigations", false); + diff --git a/testing/profiles/valgrind/user.js b/testing/profiles/valgrind/user.js new file mode 100644 index 0000000000..6db3c1669a --- /dev/null +++ b/testing/profiles/valgrind/user.js @@ -0,0 +1,9 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Preferences file for valgrind. +/* globals user_pref */ +// TODO: Bug 1795750 - Re-enable this pref when we have a new version of the +// Quitter XPI with a simpler version format. +user_pref("extensions.webextensions.warnings-as-errors", false); diff --git a/testing/profiles/web-platform/extensions/README.txt b/testing/profiles/web-platform/extensions/README.txt new file mode 100644 index 0000000000..9ec618a6aa --- /dev/null +++ b/testing/profiles/web-platform/extensions/README.txt @@ -0,0 +1,2 @@ +Dropping extensions here will get them installed in all test harnesses +that make use of this profile. diff --git a/testing/profiles/web-platform/user.js b/testing/profiles/web-platform/user.js new file mode 100644 index 0000000000..03ca52acb6 --- /dev/null +++ b/testing/profiles/web-platform/user.js @@ -0,0 +1,92 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Base preferences file for web-platform-tests. +/* globals user_pref */ +// Don't use the new tab page but about:blank for opened tabs +user_pref("browser.newtabpage.enabled", false); +// Don't restore the last open set of tabs if the browser has crashed +user_pref("browser.sessionstore.resume_from_crash", false); +// Disable session restore infobar. +user_pref("browser.startup.couldRestoreSession.count", -1); +// Don't show the Bookmarks Toolbar on any tab (the above pref that +// disables the New Tab Page ends up showing the toolbar on about:blank). +user_pref("browser.toolbars.bookmarks.visibility", "never"); +// Expose TestUtils interface +user_pref("dom.testing.testutils.enabled", true); +// Only install add-ons from the profile and the application scope +// Also ensure that those are not getting disabled. +// see: https://developer.mozilla.org/en/Installing_extensions +user_pref("extensions.autoDisableScopes", 10); +// Don't open a dialog to show available add-on updates +user_pref("extensions.update.notifyUser", false); +// Enable test mode to run multiple tests in parallel +user_pref("focusmanager.testmode", true); +// Enable fake media streams for getUserMedia +user_pref("media.navigator.streams.fake", true); +// Disable permission prompt for getUserMedia +user_pref("media.navigator.permission.disabled", true); +// Enable pre-fetching of resources +user_pref("network.preload", true); +// Enable direct connection +user_pref("network.proxy.type", 0); +// Web-platform-tests load a lot of URLs very quickly. This puts avoidable and +// unnecessary I/O pressure on the Places DB (measured to be in the +// gigabytes). +user_pref("places.history.enabled", false); +// Suppress automatic safe mode after crashes +user_pref("toolkit.startup.max_resumed_crashes", -1); +// Run the font loader task eagerly for more predictable behavior +user_pref("gfx.font_loader.delay", 0); +// Disable antialiasing for the Ahem font. +user_pref("gfx.font_rendering.ahem_antialias_none", true); +// Disable antiphishing popup +user_pref("network.http.phishy-userpass-length", 255); +// Disable safebrowsing components +user_pref("browser.safebrowsing.blockedURIs.enabled", false); +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 +// function assumes this is available. +user_pref("dom.animations-api.implicit-keyframes.enabled", true); +// Disable high DPI +user_pref("layout.css.devPixelsPerPx", "1.0") +// Enable the parallel styling code. +user_pref("layout.css.stylo-threads", 4) +// sometime wpt runs test even before the document becomes visible, which would +// delay video.play() and cause play() running in wrong order. +user_pref("media.block-autoplay-until-in-foreground", false); +// Disable dark scrollbars as it can be semi-transparent that many reftests +// don't expect. +user_pref("widget.disable-dark-scrollbar", true); +// Don't enable paint suppression when the background is unknown. While paint +// is suppressed, synthetic click events and co. go to the old page, which can +// be confusing for tests that send click events before the first paint. +user_pref("nglayout.initialpaint.unsuppress_with_no_background", true); +user_pref("media.block-autoplay-until-in-foreground", false); +// Force a light color scheme unless explicitly overriden by pref. +user_pref("layout.css.prefers-color-scheme.content-override", 1); +// Force OffscreenCanvas support +user_pref("gfx.offscreencanvas.enabled", true); +user_pref("dom.workers.requestAnimationFrame", true); +// A lot of tests use the Reporting API for observing things +user_pref("dom.reporting.enabled", true); +user_pref("layout.css.font-loading-api.workers.enabled", true); +// Enable WebDriver BiDi experimental commands and events during tests. +user_pref("remote.experimental.enabled", true); +// Disable always partitioning storage with the Storage Access API +user_pref("privacy.partition.always_partition_third_party_non_cookie_storage", false); +// Disable OCSP checks in WPT (webtransport triggers these occasionally) +user_pref("security.OCSP.enabled", 0); +// Disable download of intermediate certificates. +user_pref("security.remote_settings.intermediates.enabled", false); +// Disable prefers-reduced-motion to ensure that smooth scrolls can be tested. +user_pref("general.smoothScroll", true); +// Disable captive portal service +user_pref("network.captive-portal-service.enabled", false); diff --git a/testing/profiles/xpcshell/user.js b/testing/profiles/xpcshell/user.js new file mode 100644 index 0000000000..2eb84b9d0b --- /dev/null +++ b/testing/profiles/xpcshell/user.js @@ -0,0 +1,37 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// Base preferences file used by the xpcshell harness +/* globals user_pref */ +/* eslint quotes: 0 */ +user_pref("app.normandy.api_url", "https://%(server)s/selfsupport-dummy/"); +user_pref("browser.safebrowsing.downloads.remote.url", "https://%(server)s/safebrowsing-dummy"); +user_pref("extensions.systemAddon.update.url", "http://%(server)s/dummy-system-addons.xml"); +// Treat WebExtension API/schema warnings as errors. +user_pref("extensions.webextensions.warnings-as-errors", true); +// Always use network provider for geolocation tests +// so we bypass the OSX dialog raised by the corelocation provider +user_pref("geo.provider.testing", true); +user_pref("browser.region.network.url", ""); +user_pref("geo.provider.network.compare.url", ""); +user_pref("media.gmp-manager.updateEnabled", false); +user_pref("media.gmp-manager.url.override", "http://%(server)s/dummy-gmp-manager.xml"); +user_pref("toolkit.telemetry.server", "https://%(server)s/telemetry-dummy"); +user_pref("telemetry.fog.test.localhost_port", -1); +// Prevent Remote Settings to issue non local connections. +user_pref("services.settings.server", "data:,#remote-settings-dummy/v1"); +// Prevent intermediate preloads to be downloaded on Remote Settings polling. +user_pref("security.remote_settings.intermediates.enabled", false); +// The process priority manager only shifts priorities when it has at least +// one active tab. xpcshell tabs don't have any active tabs, which would mean +// all processes would run at low priority, which is not desirable, so we +// disable the process priority manager entirely here. +user_pref("dom.ipc.processPriorityManager.enabled", false); +// Bug 455077 - Ensure we use sRGB as the output profile for test consistency. +user_pref("gfx.color_management.force_srgb", true); +user_pref("gfx.color_management.mode", 1); +// Don't enable remote tiles on new-tab pages in xpcshell +user_pref("browser.topsites.contile.enabled", false); +user_pref("security.turn_off_all_security_so_that_viruses_can_take_over_this_computer", true); +user_pref("preferences.force-disable.check.once.policy", true); |