From 773c008c675c8ef5c40efa5f05b20227d3ee1ad7 Mon Sep 17 00:00:00 2001 From: "smichaud@pobox.com" Date: Wed, 19 Mar 2008 12:43:05 -0700 Subject: [PATCH] Stop native events being processed via Gecko (via ProcessNextNativeEvent()) during native app-modal dialog. b=419668 r=josh sr=vlad --- widget/src/cocoa/nsAppShell.mm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/widget/src/cocoa/nsAppShell.mm b/widget/src/cocoa/nsAppShell.mm index 001c5a32df5..0d420336677 100644 --- a/widget/src/cocoa/nsAppShell.mm +++ b/widget/src/cocoa/nsAppShell.mm @@ -67,6 +67,7 @@ extern PRInt32 gXULModalLevel; // Present in all versions of OS X from (at least) 10.2.8 through 10.5. - (BOOL)_isRunningModal; +- (BOOL)_isRunningAppModal; @end @@ -419,7 +420,14 @@ nsAppShell::ProcessNextNativeEvent(PRBool aMayWait) NSString* currentMode = nil; if (mTerminated) - return moreEvents; + return PR_FALSE; + // We don't want any native events to be processed here (via Gecko) while + // Cocoa is displaying an app-modal dialog (as opposed to a doc-modal or + // window-modal "sheet"). Otherwise event-processing loops (Cocoa ones) + // may be "interrupted", or inappropriate events may get through to the + // browser window(s) underneath. This resolves bmo bugs 419668 and 420967. + if ([NSApp _isRunningAppModal]) + return PR_FALSE; PRBool wasRunningEventLoop = mRunningEventLoop; mRunningEventLoop = aMayWait;