From 93c76859ec4f85fbe01207fdd4c2b0f9212c7d66 Mon Sep 17 00:00:00 2001 From: Jesse Ruderman Date: Fri, 6 Mar 2015 04:27:32 -0800 Subject: [PATCH] Bug 1140183 - Don't enter safe mode on opt/shift if environment variable MOZ_DISABLE_SAFE_MODE_KEY is set. r=ehsan --- toolkit/xre/nsAppRunner.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp index 02910c82807c..95180f488ce0 100644 --- a/toolkit/xre/nsAppRunner.cpp +++ b/toolkit/xre/nsAppRunner.cpp @@ -3304,14 +3304,17 @@ XREMain::XRE_mainInit(bool* aExitFlag) // order bit will be 1 if the key is pressed. By masking the returned short // with 0x8000 the result will be 0 if the key is not pressed and non-zero // otherwise. - if (GetKeyState(VK_SHIFT) & 0x8000 && - !(GetKeyState(VK_CONTROL) & 0x8000) && !(GetKeyState(VK_MENU) & 0x8000)) { + if ((GetKeyState(VK_SHIFT) & 0x8000) && + !(GetKeyState(VK_CONTROL) & 0x8000) && + !(GetKeyState(VK_MENU) & 0x8000) && + !EnvHasValue("MOZ_DISABLE_SAFE_MODE_KEY")) { gSafeMode = true; } #endif #ifdef XP_MACOSX - if (GetCurrentEventKeyModifiers() & optionKey) + if ((GetCurrentEventKeyModifiers() & optionKey) && + !EnvHasValue("MOZ_DISABLE_SAFE_MODE_KEY")) gSafeMode = true; #endif