From a56c3d12a165b3b1192b845b3b967e737f68caa1 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Fri, 22 Jan 2016 14:42:04 -0800 Subject: [PATCH] Backed out changeset e7cfbfa5847c (bug 1241959) for browser_Troubleshoot.js failures --- .../components/preferences/in-content/main.js | 41 +++++++++++++------ .../preferences/in-content/main.xul | 3 -- toolkit/content/aboutSupport.js | 19 +-------- .../chrome/global/aboutSupport.properties | 15 ++----- toolkit/modules/Troubleshoot.jsm | 10 ----- toolkit/xre/nsAppRunner.cpp | 27 +++++++++--- 6 files changed, 55 insertions(+), 60 deletions(-) diff --git a/browser/components/preferences/in-content/main.js b/browser/components/preferences/in-content/main.js index 249dc229c00..bb8e906f3e3 100644 --- a/browser/components/preferences/in-content/main.js +++ b/browser/components/preferences/in-content/main.js @@ -83,21 +83,38 @@ var gMainPane = { setEventListener("e10sAutoStart", "command", gMainPane.enableE10SChange); let e10sCheckbox = document.getElementById("e10sAutoStart"); + e10sCheckbox.checked = Services.appinfo.browserTabsRemoteAutostart; - 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 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 + ")"; + } + } + } } + // If E10S is blocked because of safe mode, we want the checkbox to be + // enabled #endif #ifdef MOZ_DEV_EDITION diff --git a/browser/components/preferences/in-content/main.xul b/browser/components/preferences/in-content/main.xul index f51e3f825af..e30e92aa343 100644 --- a/browser/components/preferences/in-content/main.xul +++ b/browser/components/preferences/in-content/main.xul @@ -16,9 +16,6 @@ - #endif diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js index b3594adbb86..b7481d72623 100644 --- a/toolkit/content/aboutSupport.js +++ b/toolkit/content/aboutSupport.js @@ -46,23 +46,8 @@ var snapshotFormatters = { if (data.updateChannel) $("updatechannel-box").textContent = data.updateChannel; - 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); + $("multiprocess-box").textContent = stringBundle().formatStringFromName("multiProcessStatus", + [data.numRemoteWindows, data.numTotalWindows, data.remoteAutoStart], 3); $("safemode-box").textContent = data.safeMode; }, diff --git a/toolkit/locales/en-US/chrome/global/aboutSupport.properties b/toolkit/locales/en-US/chrome/global/aboutSupport.properties index fdd76bc2b02..143ad12da5b 100644 --- a/toolkit/locales/en-US/chrome/global/aboutSupport.properties +++ b/toolkit/locales/en-US/chrome/global/aboutSupport.properties @@ -96,18 +96,9 @@ 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 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 +# 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) asyncPanZoom = Asynchronous Pan/Zoom apzNone = none diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm index cfa7db057ff..5a86d796baf 100644 --- a/toolkit/modules/Troubleshoot.jsm +++ b/toolkit/modules/Troubleshoot.jsm @@ -219,16 +219,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; - } - done(data); }, diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 5bdefd13630..f8d3364fb23 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -995,17 +995,17 @@ nsXULAppInfo::GetProcessID(uint32_t* aResult) } static bool gBrowserTabsRemoteAutostart = false; -static uint64_t gBrowserTabsRemoteStatus = 0; +static nsString gBrowserTabsRemoteDisabledReason; static bool gBrowserTabsRemoteAutostartInitialized = false; NS_IMETHODIMP nsXULAppInfo::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "getE10SBlocked")) { - nsCOMPtr ret = do_QueryInterface(aSubject); + nsCOMPtr ret = do_QueryInterface(aSubject); if (!ret) return NS_ERROR_FAILURE; - ret->SetData(gBrowserTabsRemoteStatus); + ret->SetData(gBrowserTabsRemoteDisabledReason); return NS_OK; } @@ -4631,7 +4631,19 @@ XRE_IsContentProcess() return XRE_GetProcessType() == GeckoProcessType_Content; } -// If you add anything to this enum, please update about:support to reflect it +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 console(do_GetService("@mozilla.org/consoleservice;1")); + if (console) { + console->LogStringMessage(msg.get()); + } +} + enum { kE10sEnabledByUser = 0, kE10sEnabledByDefault = 1, @@ -4761,10 +4773,13 @@ 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; } @@ -4802,7 +4817,9 @@ mozilla::BrowserTabsRemoteAutostart() if (accelDisabled) { gBrowserTabsRemoteAutostart = false; + status = kE10sDisabledForMacGfx; + LogE10sBlockedReason("Hardware acceleration is disabled"); } } #endif // defined(XP_MACOSX) @@ -4814,8 +4831,6 @@ 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,