Bug 1241959 - Add a description of e10s blocked status to about:support. r=jimm

--HG--
extra : commitid : 5r0m9Ql2GBC
This commit is contained in:
Felipe Gomes 2016-01-22 14:42:30 -08:00
parent 72f3b982cf
commit 8e514bfba2
6 changed files with 60 additions and 55 deletions

View File

@ -83,38 +83,21 @@ var gMainPane = {
setEventListener("e10sAutoStart", "command",
gMainPane.enableE10SChange);
let e10sCheckbox = document.getElementById("e10sAutoStart");
e10sCheckbox.checked = Services.appinfo.browserTabsRemoteAutostart;
// If e10s is blocked for some reason unrelated to prefs, we want to disable
// the checkbox.
if (!Services.appinfo.browserTabsRemoteAutostart) {
let e10sBlockedReason = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
let appinfo = Services.appinfo.QueryInterface(Ci.nsIObserver);
appinfo.observe(e10sBlockedReason, "getE10SBlocked", "")
if (e10sBlockedReason.data) {
if (e10sBlockedReason.data == "Safe mode") {
// If the only reason we're disabled is because of safe mode, then
// we want to allow the user to un-toggle the pref.
// We're relying on the nsAppRunner code only specifying "Safe mode"
// as the reason if the pref is otherwise enabled, and there are no
// other reasons to block e10s.
// Update the checkbox to reflect the pref state.
e10sCheckbox.checked = true;
} else {
e10sCheckbox.disabled = true;
let updateChannel = UpdateUtils.UpdateChannel;
// only add this label on developer channels
if (updateChannel == "default" ||
updateChannel == "nightly" ||
updateChannel == "aurora") {
e10sCheckbox.label += " (disabled: " + e10sBlockedReason.data + ")";
}
}
}
let e10sPref = document.getElementById("browser.tabs.remote.autostart");
let e10sTempPref = document.getElementById("e10sTempPref");
let e10sForceEnable = document.getElementById("e10sForceEnable");
let preffedOn = e10sPref.value || e10sTempPref.value || e10sForceEnable.value;
if (preffedOn) {
// The checkbox is checked if e10s is preffed on.
e10sCheckbox.checked = true;
// but if it's force disabled, then the checkbox is disabled.
e10sCheckbox.disabled = !Services.appinfo.browserTabsRemoteAutostart;
}
// If E10S is blocked because of safe mode, we want the checkbox to be
// enabled
#endif
#ifdef MOZ_DEV_EDITION

View File

@ -16,6 +16,9 @@
<preference id="e10sTempPref"
name="browser.tabs.remote.autostart.2"
type="bool"/>
<preference id="e10sForceEnable"
name="browser.tabs.remote.force-enable"
type="bool"/>
#endif
<!-- Startup -->

View File

@ -46,8 +46,23 @@ var snapshotFormatters = {
if (data.updateChannel)
$("updatechannel-box").textContent = data.updateChannel;
$("multiprocess-box").textContent = stringBundle().formatStringFromName("multiProcessStatus",
[data.numRemoteWindows, data.numTotalWindows, data.remoteAutoStart], 3);
let statusStrName = ".unknown";
// Whitelist of known values with string descriptions:
switch (data.autoStartStatus) {
case 0:
case 1:
case 2:
case 4:
case 5:
case 6:
case 7:
statusStrName = "." + data.autoStartStatus;
}
let statusText = stringBundle().GetStringFromName("multiProcessStatus" + statusStrName);
$("multiprocess-box").textContent = stringBundle().formatStringFromName("multiProcessWindows",
[data.numRemoteWindows, data.numTotalWindows, statusText], 3);
$("safemode-box").textContent = data.safeMode;
},

View File

@ -96,9 +96,18 @@ canSandboxContent = Content Process Sandboxing
canSandboxMedia = Media Plugin Sandboxing
# LOCALIZATION NOTE %1$S and %2$S will be replaced with the number of remote and the total number
# of windows, respectively, while %3$S will indicate whether windows are remote by default ('true'
# or 'false')
multiProcessStatus = %1$S/%2$S (default: %3$S)
# of windows, respectively, while %3$S will be replaced with one of the status strings below,
# which contains a description of the multi-process preference and status.
# Note: multiProcessStatus.3 doesn't exist because status=3 was deprecated.
multiProcessWindows = %1$S/%2$S (%3$S)
multiProcessStatus.0 = Enabled by user
multiProcessStatus.1 = Enabled by default
multiProcessStatus.2 = Disabled
multiProcessStatus.4 = Disabled by accessibility tools
multiProcessStatus.5 = Disabled by lack of graphics hardware acceleration
multiProcessStatus.6 = Disabled by unsupported text input
multiProcessStatus.7 = Disabled by add-ons
multiProcessStatus.unknown = Unknown status
asyncPanZoom = Asynchronous Pan/Zoom
apzNone = none

View File

@ -219,6 +219,16 @@ 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;
}
done(data);
},

View File

@ -995,17 +995,17 @@ nsXULAppInfo::GetProcessID(uint32_t* aResult)
}
static bool gBrowserTabsRemoteAutostart = false;
static nsString gBrowserTabsRemoteDisabledReason;
static uint64_t gBrowserTabsRemoteStatus = 0;
static bool gBrowserTabsRemoteAutostartInitialized = false;
NS_IMETHODIMP
nsXULAppInfo::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) {
if (!nsCRT::strcmp(aTopic, "getE10SBlocked")) {
nsCOMPtr<nsISupportsString> ret = do_QueryInterface(aSubject);
nsCOMPtr<nsISupportsPRUint64> ret = do_QueryInterface(aSubject);
if (!ret)
return NS_ERROR_FAILURE;
ret->SetData(gBrowserTabsRemoteDisabledReason);
ret->SetData(gBrowserTabsRemoteStatus);
return NS_OK;
}
@ -4631,19 +4631,7 @@ XRE_IsContentProcess()
return XRE_GetProcessType() == GeckoProcessType_Content;
}
static void
LogE10sBlockedReason(const char *reason) {
gBrowserTabsRemoteDisabledReason.Assign(NS_ConvertASCIItoUTF16(reason));
nsAutoString msg(NS_LITERAL_STRING("==================\nE10s has been blocked from running because:\n"));
msg.Append(gBrowserTabsRemoteDisabledReason);
msg.AppendLiteral("\n==================\n");
nsCOMPtr<nsIConsoleService> console(do_GetService("@mozilla.org/consoleservice;1"));
if (console) {
console->LogStringMessage(msg.get());
}
}
// If you add anything to this enum, please update about:support to reflect it
enum {
kE10sEnabledByUser = 0,
kE10sEnabledByDefault = 1,
@ -4773,13 +4761,10 @@ mozilla::BrowserTabsRemoteAutostart()
if (e10sAllowed && prefEnabled) {
if (disabledForA11y) {
status = kE10sDisabledForAccessibility;
LogE10sBlockedReason("An accessibility tool is or was active. See bug 1198459.");
} else if (disabledForBidi) {
status = kE10sDisabledForBidi;
LogE10sBlockedReason("Disabled for RTL locales due to broken bidi detection.");
} else if (addonsCanDisable && disabledByAddons) {
status = kE10sDisabledForAddons;
LogE10sBlockedReason("3rd party add-ons are installed and enabled.");
} else {
gBrowserTabsRemoteAutostart = true;
}
@ -4817,9 +4802,7 @@ mozilla::BrowserTabsRemoteAutostart()
if (accelDisabled) {
gBrowserTabsRemoteAutostart = false;
status = kE10sDisabledForMacGfx;
LogE10sBlockedReason("Hardware acceleration is disabled");
}
}
#endif // defined(XP_MACOSX)
@ -4831,6 +4814,8 @@ mozilla::BrowserTabsRemoteAutostart()
status = kE10sEnabledByUser;
}
gBrowserTabsRemoteStatus = status;
mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_STATUS, status);
if (Preferences::GetBool("browser.enabledE10SFromPrompt", false)) {
mozilla::Telemetry::Accumulate(mozilla::Telemetry::E10S_STILL_ACCEPTED_FROM_PROMPT,