Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Issue 348047: [Mac] Do not pump nested tasks in -[NSApp sendEvent:]. (Closed)

Created:
11 years, 1 month ago by Scott Hess - ex-Googler
Modified:
9 years, 6 months ago
CC:
chromium-reviews_googlegroups.com, John Grabowski
Visibility:
Public.

Description

[Closing in favor of http://codereview.chromium.org/362013 ] [Mac] Do not pump nested tasks in -[NSApp sendEvent:]. Renderers can cause UI state changes which can badly break modal event loops. For instance, if a tab closes while the user is selecting a context-menu item relating to that tab, the app can crash. When the tab-content right-click menu is up, nested tasks are not pumped. This change causes modal event loops in other areas of the UI to work the same way. The downside of this change is that Chrome events are no longer pumped in modal event loops. This means that if a context menu is up, animations and other updates will not happen, in any tab in any window. This is sad, but not as sad as sometimes crashing all tabs in all windows. This includes plug-ins, so video will pause while in a context menu (this was already true of tab content context menus). Examples of problem cases: - Last tab in a window closes while dragging the window. - Last tab in a window closes while bookmark bar context menu visible. - Last tab in a window closes while download shelf context menu visible. - Tab closes while dragging a link over the tab. - Tab closes while dragging a link from the tab. - Tab closes while back/forward context menu is open. - Tab closes while click-hold in the tab's close button. - Tab closes while closing info bar. - Tab closes while tab context menu is visible. - Probably more I'm not aware of. Many of these cases also have poor interactions with alert() panels breaking into the modal loop. For instance, if you were in a context menu and an alert() pops up on a different window. This CL removes previous fix for issues 25462 and 25465. BUG=25463, 25462, 25465, 25556, 26135, 26136, 25467, 25463 TEST=See bugs for repro cases.

Patch Set 1 #

Total comments: 5

Patch Set 2 : Mentovai's suggestions. #

Total comments: 3

Patch Set 3 : More tweaking of that other person's comments. #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+39 lines, -24 lines) Patch
M chrome/browser/chrome_application_mac.mm View 1 2 3 chunks +39 lines, -13 lines 0 comments Download
M chrome/browser/cocoa/tab_controller.mm View 1 chunk +0 lines, -11 lines 2 comments Download

Messages

Total messages: 9 (0 generated)
Scott Hess - ex-Googler
Feel free to rope anyone else into this that seems worth involving. How does Windows ...
11 years, 1 month ago (2009-11-02 21:24:41 UTC) #1
Mark Mentovai
LGTM. Can you enumerate some of the things that we're losing by doing this in ...
11 years, 1 month ago (2009-11-02 21:30:59 UTC) #2
Scott Hess - ex-Googler
Additionally, want to emphasize the alert() aspect of this. I have a collection of CLs ...
11 years, 1 month ago (2009-11-02 21:33:29 UTC) #3
Scott Hess - ex-Googler
CL message updated, let me know if it needs more love. http://codereview.chromium.org/348047/diff/1/2 File chrome/browser/chrome_application_mac.mm (right): ...
11 years, 1 month ago (2009-11-02 21:45:28 UTC) #4
Mark Mentovai
dmac might want a look too, but LGTM. http://codereview.chromium.org/348047/diff/5001/5002 File chrome/browser/chrome_application_mac.mm (left): http://codereview.chromium.org/348047/diff/5001/5002#oldcode1 Line 1: ...
11 years, 1 month ago (2009-11-02 22:06:14 UTC) #5
Scott Hess - ex-Googler
I have to keep catching model. Grrr. Someone up there is pattern-matching too much. Something ...
11 years, 1 month ago (2009-11-02 22:28:14 UTC) #6
dmac
http://codereview.chromium.org/348047/diff/6/8 File chrome/browser/cocoa/tab_controller.mm (left): http://codereview.chromium.org/348047/diff/6/8#oldcode55 Line 55: [contextMenu_ setAutoenablesItems:NO]; does it make sense just to ...
11 years, 1 month ago (2009-11-02 22:29:05 UTC) #7
dmac
On 2009/11/02 22:28:14, shess wrote: > I have to keep catching model. Grrr. Someone up ...
11 years, 1 month ago (2009-11-02 22:30:49 UTC) #8
Scott Hess - ex-Googler
11 years, 1 month ago (2009-11-02 22:35:15 UTC) #9
On 2009/11/02 22:30:49, dmac wrote:
> On 2009/11/02 22:28:14, shess wrote:
> > I have to keep catching model.  Grrr.  Someone up there is
> > pattern-matching too much.
> > 
> > Something I just added to the description - this will pause things
> > like video.  It doesn't pause audio, because that goes via different
> > channels (haha).  Does not pause video on Windows Chrome - Windows
> > also seems to pump during the right-click tab-contents menu.  Mac
> > Firefox manages to keep video going when in a context menu, too.
> > 
> > I don't know, this seems kinda killer for this CL, to me.  I can cause
> > some of the alert() jank in Windows, so maybe it's reasonable to go
> > back to addressing these cases piecemeal, and ignore the alert()
> > variants for now.
> > 
> > Probably the right long-term fix is to enumerate a set of messages
> > which will not be processed until we next reach the main event loop.
> > The renderer presumably cannot expect continued progress while waiting
> > for the results of an alert() anyhow.
> > 
> 
> I think http://code.google.com/p/chromium/issues/detail?id=26519 would
probably
> solve most of these issues wouldn't it?

Sure would, but that sounds like kind of a substantial change.  This CL is
intentially kind of a bandaid.

http://codereview.chromium.org/348047/diff/6/8
File chrome/browser/cocoa/tab_controller.mm (left):

http://codereview.chromium.org/348047/diff/6/8#oldcode55
Line 55: [contextMenu_ setAutoenablesItems:NO];
On 2009/11/02 22:29:05, dmac wrote:
> does it make sense just to call [contextMenu_ cancelTracking] instead of
leaving
> the menu open?

I had variable success with -cancelTracking.  I was finding cases where it
didn't seem to dismiss the menu.  I do not know why.

Powered by Google App Engine
This is Rietveld 408576698