Bug 1063669 - Don't enable e10s if IME is detected (r=jimm)

This commit is contained in:
Bill McCloskey 2014-09-18 10:26:33 -07:00
parent 2848670cb0
commit fd4b7d5ba2
3 changed files with 40 additions and 2 deletions

View File

@ -2287,6 +2287,7 @@ let E10SUINotification = {
if (!Services.appinfo.inSafeMode &&
!Services.appinfo.accessibilityEnabled &&
!Services.appinfo.keyboardMayHaveIME &&
e10sPromptShownCount < 5) {
Services.tm.mainThread.dispatch(() => {
try {

View File

@ -584,6 +584,28 @@ CanShowProfileManager()
#endif
}
static bool
KeyboardMayHaveIME()
{
#ifdef XP_WIN
// http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx
HKL locales[10];
int result = GetKeyboardLayoutList(10, locales);
for (int i = 0; i < result; i++) {
int kb = (unsigned)locales[i] & 0xFFFF;
if (kb == 0x0411 || // japanese
kb == 0x0412 || // korean
kb == 0x0C04 || // HK Chinese
kb == 0x0804 || kb == 0x0004 || // Hans Chinese
kb == 0x7C04 || kb == 0x0404) { //Hant Chinese
return true;
}
}
#endif
return false;
}
bool gSafeMode = false;
@ -845,6 +867,13 @@ nsXULAppInfo::GetAccessibilityEnabled(bool* aResult)
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetKeyboardMayHaveIME(bool* aResult)
{
*aResult = KeyboardMayHaveIME();
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::EnsureContentProcess()
{
@ -4541,8 +4570,9 @@ bool
mozilla::BrowserTabsRemoteAutostart()
{
if (!gBrowserTabsRemoteAutostartInitialized) {
bool hasIME = KeyboardMayHaveIME();
bool prefEnabled = Preferences::GetBool("browser.tabs.remote.autostart", false) ||
Preferences::GetBool("browser.tabs.remote.autostart.1", false);
(Preferences::GetBool("browser.tabs.remote.autostart.1", false) && !hasIME);
bool disabledForA11y = Preferences::GetBool("browser.tabs.remote.autostart.disabled-because-using-a11y", false);
gBrowserTabsRemoteAutostart = !gSafeMode && !disabledForA11y && prefEnabled;

View File

@ -25,7 +25,7 @@ bool BrowserTabsRemoteAutostart();
* stable/frozen, please contact Benjamin Smedberg.
*/
[scriptable, uuid(77550b90-3b67-11e4-916c-0800200c9a66)]
[scriptable, uuid(789073a0-3f4a-11e4-916c-0800200c9a66)]
interface nsIXULRuntime : nsISupports
{
/**
@ -104,6 +104,13 @@ interface nsIXULRuntime : nsISupports
*/
readonly attribute boolean accessibilityEnabled;
/**
* This returns a very rough approximation of whether IME is likely
* to be used for the browser session. DO NOT USE! This is temporary
* and will be removed.
*/
readonly attribute boolean keyboardMayHaveIME;
/**
* Signal the apprunner to invalidate caches on the next restart.
* This will cause components to be autoregistered and all