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
Родитель e2f9998656
Коммит 601c277e33
3 изменённых файлов: 40 добавлений и 2 удалений

Просмотреть файл

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

Просмотреть файл

@ -584,6 +584,28 @@ CanShowProfileManager()
#endif #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; bool gSafeMode = false;
@ -845,6 +867,13 @@ nsXULAppInfo::GetAccessibilityEnabled(bool* aResult)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsXULAppInfo::GetKeyboardMayHaveIME(bool* aResult)
{
*aResult = KeyboardMayHaveIME();
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsXULAppInfo::EnsureContentProcess() nsXULAppInfo::EnsureContentProcess()
{ {
@ -4541,8 +4570,9 @@ bool
mozilla::BrowserTabsRemoteAutostart() mozilla::BrowserTabsRemoteAutostart()
{ {
if (!gBrowserTabsRemoteAutostartInitialized) { if (!gBrowserTabsRemoteAutostartInitialized) {
bool hasIME = KeyboardMayHaveIME();
bool prefEnabled = Preferences::GetBool("browser.tabs.remote.autostart", false) || 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); bool disabledForA11y = Preferences::GetBool("browser.tabs.remote.autostart.disabled-because-using-a11y", false);
gBrowserTabsRemoteAutostart = !gSafeMode && !disabledForA11y && prefEnabled; gBrowserTabsRemoteAutostart = !gSafeMode && !disabledForA11y && prefEnabled;

Просмотреть файл

@ -25,7 +25,7 @@ bool BrowserTabsRemoteAutostart();
* stable/frozen, please contact Benjamin Smedberg. * stable/frozen, please contact Benjamin Smedberg.
*/ */
[scriptable, uuid(77550b90-3b67-11e4-916c-0800200c9a66)] [scriptable, uuid(789073a0-3f4a-11e4-916c-0800200c9a66)]
interface nsIXULRuntime : nsISupports interface nsIXULRuntime : nsISupports
{ {
/** /**
@ -104,6 +104,13 @@ interface nsIXULRuntime : nsISupports
*/ */
readonly attribute boolean accessibilityEnabled; 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. * Signal the apprunner to invalidate caches on the next restart.
* This will cause components to be autoregistered and all * This will cause components to be autoregistered and all