Bug 1639739: Add Fission decision status to about:support. r=nika,fluent-reviewers,Gijs

Differential Revision: https://phabricator.services.mozilla.com/D92981
This commit is contained in:
Kris Maglione 2020-10-14 20:42:16 +00:00
parent 9d6aa07b4f
commit c1143c12ba
7 changed files with 66 additions and 76 deletions

View File

@ -119,20 +119,20 @@ var snapshotFormatters = {
);
} catch (e) {}
let statusTextId = "multi-process-status-unknown";
const STATUS_STRINGS = {
experimentControl: "fission-status-experiment-control",
experimentTreatment: "fission-status-experiment-treatment",
disabledByE10sEnv: "fission-status-disabled-by-e10s-env",
enabledByEnv: "fission-status-enabled-by-env",
disabledBySafeMode: "fission-status-disabled-by-safe-mode",
enabledByDefault: "fission-status-enabled-by-default",
disabledByDefault: "fission-status-disabled-by-default",
enabledByUserPref: "fission-status-enabled-by-user-pref",
disabledByUserPref: "fission-status-disabled-by-user-pref",
disabledByE10sOther: "fission-status-disabled-by-e10s-other",
};
// Whitelist of known values with string descriptions:
switch (data.autoStartStatus) {
case 0:
case 1:
case 2:
case 4:
case 6:
case 7:
case 8:
statusTextId = "multi-process-status-" + data.autoStartStatus;
break;
}
let statusTextId = STATUS_STRINGS[data.fissionDecisionStatus];
document.l10n.setAttributes(
$("multiprocess-box-process-count"),
@ -142,7 +142,15 @@ var snapshotFormatters = {
totalWindows: data.numTotalWindows,
}
);
document.l10n.setAttributes($("multiprocess-box-status"), statusTextId);
document.l10n.setAttributes(
$("fission-box-process-count"),
"fission-windows",
{
fissionWindows: data.numFissionWindows,
totalWindows: data.numTotalWindows,
}
);
document.l10n.setAttributes($("fission-box-status"), statusTextId);
if (Services.policies) {
let policiesStrId = "";

View File

@ -205,7 +205,15 @@
<td id="multiprocess-box">
<span id="multiprocess-box-process-count"/>
<span id="multiprocess-box-status"/>
</td>
</tr>
<tr>
<th class="column" data-l10n-id="app-basics-fission-support"/>
<td id="fission-box">
<span id="fission-box-process-count"/>
<span id="fission-box-status"/>
</td>
</tr>

View File

@ -64,6 +64,7 @@ app-basics-service-workers = Registered Service Workers
app-basics-profiles = Profiles
app-basics-launcher-process-status = Launcher Process
app-basics-multi-process-support = Multiprocess Windows
app-basics-fission-support = Fission Windows
app-basics-remote-processes-count = Remote Processes
app-basics-enterprise-policies = Enterprise Policies
app-basics-location-service-key-google = Google Location Service Key
@ -326,14 +327,20 @@ launcher-process-status-unknown = Unknown status
# $remoteWindows (integer) - Number of remote windows
# $totalWindows (integer) - Number of total windows
multi-process-windows = { $remoteWindows }/{ $totalWindows }
multi-process-status-0 = Enabled by user
multi-process-status-1 = Enabled by default
multi-process-status-2 = Disabled
multi-process-status-4 = Disabled by accessibility tools
multi-process-status-6 = Disabled by unsupported text input
multi-process-status-7 = Disabled by add-ons
multi-process-status-8 = Disabled forcibly
multi-process-status-unknown = Unknown status
# Variables
# $fissionWindows (integer) - Number of remote windows
# $totalWindows (integer) - Number of total windows
fission-windows = { $fissionWindows }/{ $totalWindows }
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-safe-mode = Disabled by safe mode
fission-status-enabled-by-default = Enabled by default
fission-status-disabled-by-default = Disabled by default
fission-status-enabled-by-user-pref = Enabled by user
fission-status-disabled-by-user-pref = Disabled by user
fission-status-disabled-by-e10s-other = E10s disabled
async-pan-zoom = Asynchronous Pan/Zoom
apz-none = none

View File

@ -228,11 +228,15 @@ var dataProviders = {
} catch (e) {}
data.numTotalWindows = 0;
data.numFissionWindows = 0;
data.numRemoteWindows = 0;
for (let { docShell } of Services.wm.getEnumerator("navigator:browser")) {
docShell.QueryInterface(Ci.nsILoadContext);
data.numTotalWindows++;
let remote = docShell.QueryInterface(Ci.nsILoadContext).useRemoteTabs;
if (remote) {
if (docShell.useRemoteSubframes) {
data.numFissionWindows++;
}
if (docShell.useRemoteTabs) {
data.numRemoteWindows++;
}
}
@ -246,17 +250,6 @@ var dataProviders = {
data.remoteAutoStart = Services.appinfo.browserTabsRemoteAutostart;
try {
let e10sStatus = Cc["@mozilla.org/supports-PRUint64;1"].createInstance(
Ci.nsISupportsPRUint64
);
let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
appinfo.observe(e10sStatus, "getE10SBlocked", "");
data.autoStartStatus = e10sStatus.data;
} catch (e) {
data.autoStartStatus = -1;
}
if (Services.policies) {
data.policiesStatus = Services.policies.status;
}

View File

@ -196,9 +196,6 @@ const SNAPSHOT_SCHEMA = {
type: "boolean",
required: true,
},
autoStartStatus: {
type: "number",
},
fissionAutoStart: {
type: "boolean",
},
@ -208,6 +205,9 @@ const SNAPSHOT_SCHEMA = {
numTotalWindows: {
type: "number",
},
numFissionWindows: {
type: "number",
},
numRemoteWindows: {
type: "number",
},

View File

@ -502,26 +502,16 @@ static bool gFissionAutostart = false;
static bool gFissionAutostartInitialized = false;
static nsIXULRuntime::FissionDecisionStatus gFissionDecisionStatus;
static bool gBrowserTabsRemoteAutostart = false;
static uint64_t gBrowserTabsRemoteStatus = 0;
static bool gBrowserTabsRemoteAutostartInitialized = false;
// TODO: Remove this when fissionDecisionStatus is exposed in about:support.
// If you add anything to this enum, please update about:support to reflect it
enum {
// kE10sEnabledByUser = 0, removed when ending non-e10s support
kE10sEnabledByDefault = 1,
kE10sDisabledByUser = 2,
// kE10sDisabledInSafeMode = 3, was removed in bug 1172491.
// kE10sDisabledForAccessibility = 4,
// kE10sDisabledForMacGfx = 5, was removed in bug 1068674.
// kE10sDisabledForBidi = 6, removed in bug 1309599
// kE10sDisabledForAddons = 7, removed in bug 1406212
kE10sForceDisabled = 8,
// kE10sDisabledForXPAcceleration = 9, removed in bug 1296353
// kE10sDisabledForOperatingSystem = 10, removed due to xp-eol
enum E10sStatus {
kE10sEnabledByDefault,
kE10sDisabledByUser,
kE10sForceDisabled,
};
static bool gBrowserTabsRemoteAutostart = false;
static E10sStatus gBrowserTabsRemoteStatus;
static bool gBrowserTabsRemoteAutostartInitialized = false;
namespace mozilla {
bool BrowserTabsRemoteAutostart() {
@ -542,7 +532,7 @@ bool BrowserTabsRemoteAutostart() {
bool allowSingleProcessOutsideAutomation = true;
#endif
int status = kE10sEnabledByDefault;
E10sStatus status = kE10sEnabledByDefault;
// We use "are non-local connections disabled" as a proxy for
// "are we running some kind of automated test". It would be nicer to use
// xpc::IsInAutomation(), but that depends on some prefs being set, which
@ -756,7 +746,6 @@ bool SessionHistoryInParent() {
* singleton.
*/
class nsXULAppInfo : public nsIXULAppInfo,
public nsIObserver,
#ifdef XP_WIN
public nsIWinAppHelper,
#endif
@ -771,7 +760,6 @@ class nsXULAppInfo : public nsIXULAppInfo,
NS_DECL_NSIPLATFORMINFO
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
NS_DECL_NSIOBSERVER
NS_DECL_NSICRASHREPORTER
NS_DECL_NSIFINISHDUMPINGCALLBACK
#ifdef XP_WIN
@ -782,7 +770,6 @@ class nsXULAppInfo : public nsIXULAppInfo,
NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXULRuntime)
NS_INTERFACE_MAP_ENTRY(nsIXULRuntime)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
#ifdef XP_WIN
NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
#endif
@ -1052,21 +1039,6 @@ nsXULAppInfo::GetLastAppBuildID(nsACString& aResult) {
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
// TODO: Remove this when fissionDecisionStatus is exposed in about:support.
if (!nsCRT::strcmp(aTopic, "getE10SBlocked")) {
nsCOMPtr<nsISupportsPRUint64> ret = do_QueryInterface(aSubject);
if (!ret) return NS_ERROR_FAILURE;
ret->SetData(gBrowserTabsRemoteStatus);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsXULAppInfo::GetFissionAutostart(bool* aResult) {
*aResult = FissionAutostart();

View File

@ -63,6 +63,8 @@ interface nsIXULRuntime : nsISupports
eExperimentStatusCount,
};
// NOTE: Please do not add new values to this enum without also updating the
// mapping in aboutSupport.js
cenum FissionDecisionStatus : 8 {
eFissionStatusUnknown = 0,
// Fission is disabled because the user is in the control group of a