Skip to content

Commit

Permalink
Bug 1732358 - Part 2: Add the ability to force-disable fission with a…
Browse files Browse the repository at this point in the history
…n environment variable, r=ahal,fluent-reviewers,flod,mccr8

This is required to replace the existing MOZ_FORCE_ENABLE_FISSION environment
variables in environments which use that. In the future we'll want to stop
passing any environment variable when not passing a flag to `./mach run`
however that will require changes to the default test behaviour in bug 1744091.

Differential Revision: https://phabricator.services.mozilla.com/D133006
  • Loading branch information
mystor committed Dec 13, 2021
1 parent 0d0306c commit 490e62e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ public boolean isX86() {
}

public boolean isFission() {
// NOTE: This isn't accurate, as it doesn't take into account the default
// value of the pref or environment variables like
// `MOZ_FORCE_DISABLE_FISSION`.
return getEnvVar("MOZ_FORCE_ENABLE_FISSION").equals("1");
}

Expand Down
4 changes: 4 additions & 0 deletions python/mozbuild/mozbuild/mach_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,6 +1331,8 @@ def _run_android(
'Using profile from target "{target_profile}"',
)

# FIXME: When android switches to using Fission by default,
# MOZ_FORCE_DISABLE_FISSION will need to be configured correctly.
if enable_fission:
env.append("MOZ_FORCE_ENABLE_FISSION=1")

Expand Down Expand Up @@ -1778,6 +1780,8 @@ def _run_desktop(

if enable_fission:
extra_env["MOZ_FORCE_ENABLE_FISSION"] = "1"
else:
extra_env["MOZ_FORCE_DISABLE_FISSION"] = "1"

if some_debugging_option:
if "INSIDE_EMACS" in os.environ:
Expand Down
2 changes: 2 additions & 0 deletions testing/mochitest/runjunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ def build_command_line(self, test_filters_file, test_filters):
env["MOZ_WEBRENDER"] = "1"
else:
env["MOZ_WEBRENDER"] = "0"
# FIXME: When android switches to using Fission by default,
# MOZ_FORCE_DISABLE_FISSION will need to be configured correctly.
if self.options.enable_fission:
env["MOZ_FORCE_ENABLE_FISSION"] = "1"
# Add additional env variables
Expand Down
1 change: 1 addition & 0 deletions toolkit/content/aboutSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ var snapshotFormatters = {
experimentTreatment: "fission-status-experiment-treatment",
disabledByE10sEnv: "fission-status-disabled-by-e10s-env",
enabledByEnv: "fission-status-enabled-by-env",
disabledByEnv: "fission-status-disabled-by-env",
disabledBySafeMode: "fission-status-disabled-by-safe-mode",
enabledByDefault: "fission-status-enabled-by-default",
disabledByDefault: "fission-status-disabled-by-default",
Expand Down
1 change: 1 addition & 0 deletions toolkit/locales/en-US/toolkit/about/aboutSupport.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ fission-status-experiment-control = Disabled by experiment
fission-status-experiment-treatment = Enabled by experiment
fission-status-disabled-by-e10s-env = Disabled by environment
fission-status-enabled-by-env = Enabled by environment
fission-status-disabled-by-env = Disabled by environment
fission-status-disabled-by-safe-mode = Disabled by safe mode
fission-status-enabled-by-default = Enabled by default
fission-status-disabled-by-default = Disabled by default
Expand Down
6 changes: 6 additions & 0 deletions toolkit/xre/nsAppRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,9 @@ static void EnsureFissionAutostartInitialized() {
} else if (EnvHasValue("MOZ_FORCE_ENABLE_FISSION")) {
gFissionAutostart = true;
gFissionDecisionStatus = nsIXULRuntime::eFissionEnabledByEnv;
} else if (EnvHasValue("MOZ_FORCE_DISABLE_FISSION")) {
gFissionAutostart = false;
gFissionDecisionStatus = nsIXULRuntime::eFissionDisabledByEnv;
} else {
// NOTE: This will take into account changes to the default due to
// `InitializeFissionExperimentStatus`.
Expand Down Expand Up @@ -1109,6 +1112,9 @@ nsXULAppInfo::GetFissionDecisionStatusString(nsACString& aResult) {
case eFissionEnabledByEnv:
aResult = "enabledByEnv";
break;
case eFissionDisabledByEnv:
aResult = "disabledByEnv";
break;
case eFissionDisabledBySafeMode:
aResult = "disabledBySafeMode";
break;
Expand Down
14 changes: 8 additions & 6 deletions toolkit/xre/test/marionette/test_fission_autostart.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Prefs:


ENV_ENABLE_FISSION = "MOZ_FORCE_ENABLE_FISSION"
ENV_DISABLE_FISSION = "MOZ_FORCE_DISABLE_FISSION"
ENV_DISABLE_E10S = "MOZ_FORCE_DISABLE_E10S"


Expand All @@ -27,12 +28,13 @@ class Prefs:
"experimentTreatment": 2,
"disabledByE10sEnv": 3,
"enabledByEnv": 4,
"disabledBySafeMode": 5,
"enabledByDefault": 6,
"disabledByDefault": 7,
"enabledByUserPref": 8,
"disabledByUserPref": 9,
"disabledByE10sOther": 10,
"disabledByEnv": 5,
"disabledBySafeMode": 6,
"enabledByDefault": 7,
"disabledByDefault": 8,
"enabledByUserPref": 9,
"disabledByUserPref": 10,
"disabledByE10sOther": 11,
}


Expand Down
21 changes: 12 additions & 9 deletions xpcom/system/nsIXULRuntime.idl
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ uint32_t GetMaxWebProcessCount();
// global value of the pref. For other use cases, you should use
// nsILoadContext::UseRemoteSubframes instead. This will also check for special
// conditions, like safe mode, which may require fission to be disabled, or
// environment variable MOZ_FORCE_ENABLE_FISSION, used by mach run to
// enable fission regardless of pref settings.
// environment variables MOZ_FORCE_ENABLE_FISSION and MOZ_FORCE_DISABLE_FISSION,
// used by mach run to enable/disable fission regardless of pref settings.
bool FissionAutostart();

// Returns whether or not we are currently enrolled in the fission experiment.
Expand Down Expand Up @@ -88,25 +88,28 @@ interface nsIXULRuntime : nsISupports
// Fission is enabled because the `MOZ_FORCE_ENABLE_FISSION` environment
// variable is set.
eFissionEnabledByEnv = 4,
// Fission is disabled because the `MOZ_FORCE_DISABLE_FISSION` environment
// variable is set.
eFissionDisabledByEnv = 5,
// Fission is disabled because the current session is running in safe
// mode.
eFissionDisabledBySafeMode = 5,
eFissionDisabledBySafeMode = 6,
// Fission is enabled because the "fission.autostart" preference is true
// by default.
eFissionEnabledByDefault = 6,
eFissionEnabledByDefault = 7,
// Fission is disabled because the "fission.autostart" preference is false
// by default.
eFissionDisabledByDefault = 7,
eFissionDisabledByDefault = 8,
// Fission is enabled because the "fission.autostart" preference was
// turned on by the user.
eFissionEnabledByUserPref = 8,
eFissionEnabledByUserPref = 9,
// Fission is enabled because the "fission.autostart" preference was
// turned on by the user.
eFissionDisabledByUserPref = 9,
eFissionDisabledByUserPref = 10,
// Fission is disabled because e10s is disabled for some other reason.
eFissionDisabledByE10sOther = 10,
eFissionDisabledByE10sOther = 11,
// Fission is enabled by a Normandy phased rollout.
eFissionEnabledByRollout = 11,
eFissionEnabledByRollout = 12,
};

/**
Expand Down

0 comments on commit 490e62e

Please sign in to comment.