Bug 1382649 - Unset dom.ipc.processCount pref value should be taken as a user opt-in value if browser.preferences.defaultPerformanceSettings.enabled is false. r=mrbkap
MozReview-Commit-ID: 5zSix0koTc4
--- a/browser/extensions/e10srollout/bootstrap.js
+++ b/browser/extensions/e10srollout/bootstrap.js
@@ -69,16 +69,17 @@ const PREF_E10S_OPTED_IN = "browse
const PREF_E10S_FORCE_ENABLED = "browser.tabs.remote.force-enable";
const PREF_E10S_FORCE_DISABLED = "browser.tabs.remote.force-disable";
const PREF_TOGGLE_E10S = "browser.tabs.remote.autostart.2";
const PREF_E10S_ADDON_POLICY = "extensions.e10s.rollout.policy";
const PREF_E10S_ADDON_BLOCKLIST = "extensions.e10s.rollout.blocklist";
const PREF_E10S_HAS_NONEXEMPT_ADDON = "extensions.e10s.rollout.hasAddon";
const PREF_E10S_MULTI_OPTOUT = "dom.ipc.multiOptOut";
const PREF_E10S_PROCESSCOUNT = "dom.ipc.processCount";
+const PREF_USE_DEFAULT_PERF_SETTINGS = "browser.preferences.defaultPerformanceSettings.enabled";
const PREF_E10S_MULTI_ADDON_BLOCKS = "extensions.e10sMultiBlocksEnabling";
const PREF_E10S_MULTI_BLOCKED_BY_ADDONS = "extensions.e10sMultiBlockedByAddons";
function startup() {
// In theory we only need to run this once (on install()), but
// it's better to also run it on every startup. If the user has
// made manual changes to the prefs, this will keep the data
// reported more accurate.
@@ -254,17 +255,18 @@ function setCohort(cohortName) {
Services.appinfo.QueryInterface(Ci.nsICrashReporter).annotateCrashReport("E10SCohort", cohortName);
}
} catch (e) {}
}
function optedIn() {
let e10s = Preferences.get(PREF_E10S_OPTED_IN, false) ||
Preferences.get(PREF_E10S_FORCE_ENABLED, false);
- let multi = Preferences.isSet(PREF_E10S_PROCESSCOUNT);
+ let multi = Preferences.isSet(PREF_E10S_PROCESSCOUNT) ||
+ !Preferences.get(PREF_USE_DEFAULT_PERF_SETTINGS, true);
return { e10s, multi };
}
function optedOut() {
// Users can also opt-out by toggling back the pref to false.
// If they reset the pref instead they might be re-enabled if
// they are still part of the threshold.
let e10s = Preferences.get(PREF_E10S_FORCE_DISABLED, false) ||
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -5177,21 +5177,26 @@ GetMaxWebProcessCount()
// introducing multiple prefs a la the autostart.N prefs.
if (Preferences::GetInt("dom.ipc.multiOptOut", 0) >=
nsIXULRuntime::E10S_MULTI_EXPERIMENT) {
return 1;
}
const char* optInPref = "dom.ipc.processCount";
uint32_t optInPrefValue = Preferences::GetInt(optInPref, 1);
-
- // If the user has set dom.ipc.processCount, respect their decision
- // regardless of add-ons that might affect their experience or experiment
- // cohort.
- if (Preferences::HasUserValue(optInPref)) {
+ const char* useDefaultPerformanceSettings =
+ "browser.preferences.defaultPerformanceSettings.enabled";
+ bool useDefaultPerformanceSettingsValue =
+ Preferences::GetBool(useDefaultPerformanceSettings, true);
+
+ // If the user has set dom.ipc.processCount, or if they have opt out of
+ // default performances settings from about:preferences, respect their
+ // decision regardless of add-ons that might affect their experience or
+ // experiment cohort.
+ if (Preferences::HasUserValue(optInPref) || !useDefaultPerformanceSettingsValue) {
return std::max(1u, optInPrefValue);
}
#ifdef RELEASE_OR_BETA
// For our rollout on Release and Beta, we set this pref from the
// e10srollout extension. On Nightly, we don't touch the pref at all,
// allowing stale values to disable e10s-multi for certain users.
if (Preferences::HasUserValue("dom.ipc.processCount.web")) {