summaryrefslogtreecommitdiffstats
path: root/toolkit/components/backgroundtasks/defaults
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/backgroundtasks/defaults')
-rw-r--r--toolkit/components/backgroundtasks/defaults/backgroundtasks.js58
-rw-r--r--toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js51
2 files changed, 109 insertions, 0 deletions
diff --git a/toolkit/components/backgroundtasks/defaults/backgroundtasks.js b/toolkit/components/backgroundtasks/defaults/backgroundtasks.js
new file mode 100644
index 0000000000..874c136420
--- /dev/null
+++ b/toolkit/components/backgroundtasks/defaults/backgroundtasks.js
@@ -0,0 +1,58 @@
+/* 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/. */
+
+#filter substitution;
+
+// These preferences override Gecko preferences in `greprefs.js`. Use
+// `backgroundtasks_browser.js` to override browser/-specific preferences in
+// `firefox.js`.
+
+/* global pref */
+
+pref("browser.dom.window.dump.enabled", true);
+pref("devtools.console.stdout.chrome", true);
+
+pref("browser.cache.disk.enable", false);
+pref("permissions.memory_only", true);
+
+// For testing only: used to test that backgroundtask-specific prefs are
+// processed. This just needs to be an unusual integer in the range 0..127.
+pref("test.backgroundtask_specific_pref.exitCode", 79);
+
+// Enable the browser toolbox by default. The browser toolbox is available only
+// when launching the background task with `--jsdebugger` on the command line,
+// and an attacker who can launch background task processes with arbitrary
+// parameters and execution environment can already access this functionality,
+// so there's no need to restrict access via preferences.
+pref("devtools.chrome.enabled", true);
+pref("devtools.debugger.remote-enabled", true);
+pref("devtools.debugger.prompt-connection", false);
+
+// Background tasks do not persist the cookie database: they should
+// not be using cookies for network requests.
+pref("network.cookie.noPersistentStorage", true);
+
+// Background tasks don't need to worry about perceived performance. We disable
+// fast shutdown to reduce the risk of open file handles preventing cleanup of
+// the ephemeral profile directory.
+pref("toolkit.shutdown.fastShutdownStage", 0);
+
+// Avoid a race between initializing font lists and rapid shutdown,
+// particularly on macOS. Compare Bug 1777332.
+pref("gfx.font-list-omt.enabled", false);
+
+// Prevent key#.db and cert#.db from being created in the ephemeral profile.
+pref("security.nocertdb", true);
+
+// Prevent asynchronous preference writes.
+pref("preferences.allow.omt-write", false);
+
+// Enable automatic restarts during background updates for Nightly builds.
+#ifdef NIGHTLY_BUILD
+pref("app.update.background.automaticRestartEnabled", true);
+#else
+pref("app.update.background.automaticRestartEnabled", false);
+#endif
+
+pref("defaultAgent.cppFallback.enabled", false);
diff --git a/toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js b/toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js
new file mode 100644
index 0000000000..0df5bafd1a
--- /dev/null
+++ b/toolkit/components/backgroundtasks/defaults/backgroundtasks_browser.js
@@ -0,0 +1,51 @@
+/* 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/. */
+
+#filter substitution;
+
+// These preferences override override browser/-specific preferences in
+// `firefox.js`. Use `backgroundtasks.js` to override general Gecko preferences
+// in `greprefs.js`.
+
+/* global pref */
+
+// XUL notifications make no sense in background tasks. This is only applies to
+// Windows for now.
+pref("alerts.useSystemBackend", true);
+pref("alerts.useSystemBackend.windows.notificationserver.enabled", true);
+
+// Configure Messaging Experiments for background tasks, with
+// background task-specific feature ID. The regular Firefox Desktop
+// Remote Settings collection will be used.
+pref(
+ "browser.newtabpage.activity-stream.asrouter.providers.messaging-experiments",
+ '{"id":"messaging-experiments","enabled":true,"type":"remote-experiments","featureIds":["backgroundTaskMessage"],"updateCycleInMs":3600000}'
+);
+
+// Disable all other Messaging System providers save for
+// `browser.newtabpage.activity-stream.asrouter.providers.message-groups`, which
+// is required for the system to function.
+pref("browser.newtabpage.activity-stream.asrouter.providers.cfr", "null");
+pref("browser.newtabpage.activity-stream.asrouter.providers.snippets", "null");
+pref(
+ "browser.newtabpage.activity-stream.asrouter.providers.whats-new-panel",
+ "null"
+);
+
+// The `browser.newtabpage.activity-stream.asrouter.providers.cfr` provider is
+// disabled, but belt and braces: disable extension recommendations and feature
+// recommendations. Neither of these make sense in background tasks, and they
+// could trigger telemetry.
+pref("browser.newtabpage.activity-stream.asrouter.userprefs.cfr.addons", false);
+pref(
+ "browser.newtabpage.activity-stream.asrouter.userprefs.cfr.features",
+ false
+);
+
+// Don't refresh experiments while a background task is running.
+pref("app.normandy.run_interval_seconds", 0);
+
+// Use a separate Nimbus application ID from regular Firefox Desktop.
+// This prevents enrolling in regular desktop experiments.
+pref("nimbus.appId", "firefox-desktop-background-task");