Bug 1188425 - Add a pref to allow insecure text input, thereby avoiding crashes at [ChildView keyDown:] in non-release builds. r=spohl a=rkothari
authorSteven Michaud <smichaud@pobox.com>
Tue, 04 Aug 2015 15:27:10 -0500
changeset 281796 5c14f816e9da
parent 281795 c292460646ac
child 281797 431772a2d682
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl, rkothari
bugs1188425
milestone41.0a2
Bug 1188425 - Add a pref to allow insecure text input, thereby avoiding crashes at [ChildView keyDown:] in non-release builds. r=spohl a=rkothari
modules/libpref/init/all.js
widget/cocoa/nsChildView.mm
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -4794,20 +4794,27 @@ pref("dom.messageChannel.enabled", true)
 
 // Disable before keyboard events and after keyboard events by default.
 pref("dom.beforeAfterKeyboardEvent.enabled", false);
 
 // Presentation API
 pref("dom.presentation.enabled", false);
 pref("dom.presentation.tcp_server.debug", false);
 
+#ifdef XP_MACOSX
 // Use raw ICU instead of CoreServices API in Unicode collation
-#ifdef XP_MACOSX
 pref("intl.collation.mac.use_icu", true);
+
+#if !defined(RELEASE_BUILD) || defined(DEBUG)
+// In non-release builds we crash by default on insecure text input (when a
+// password editor has focus but secure event input isn't enabled).  The
+// following pref, when turned on, disables this behavior.  See bug 1188425.
+pref("intl.allow-insecure-text-input", false);
 #endif
+#endif // XP_MACOSX
 
 // Enable meta-viewport support in remote APZ-enabled frames.
 pref("dom.meta-viewport.enabled", false);
 
 // MozSettings debugging prefs for each component
 pref("dom.mozSettings.SettingsDB.debug.enabled", false);
 pref("dom.mozSettings.SettingsManager.debug.enabled", false);
 pref("dom.mozSettings.SettingsRequestManager.debug.enabled", false);
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -5395,17 +5395,18 @@ static int32_t RoundUp(double aDouble)
   // otherwise why is the OS sending us a key down event?  But it's just
   // possible we're in Gecko's hidden window, so we check first.
   NSWindow *viewWindow = [self window];
   if (viewWindow && [viewWindow isKeyWindow]) {
     [viewWindow orderWindow:NSWindowAbove relativeTo:0];
   }
 
 #if !defined(RELEASE_BUILD) || defined(DEBUG)
-  if (mGeckoChild && mTextInputHandler && mTextInputHandler->IsFocused()) {
+  if (!Preferences::GetBool("intl.allow-insecure-text-input", false) &&
+      mGeckoChild && mTextInputHandler && mTextInputHandler->IsFocused()) {
 #ifdef MOZ_CRASHREPORTER
     NSWindow* window = [self window];
     NSString* info = [NSString stringWithFormat:@"\nview [%@], window [%@], window is key %i, is fullscreen %i, app is active %i",
                       self, window, [window isKeyWindow], ([window styleMask] & (1 << 14)) != 0,
                       [NSApp isActive]];
     nsAutoCString additionalInfo([info UTF8String]);
 #endif
     if (mGeckoChild->GetInputContext().IsPasswordEditor() &&