Chromium Code Reviews| Index: chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| diff --git a/chrome/browser/ui/cocoa/browser_window_cocoa.mm b/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| index 31116d4f1b1a3370dfabfe9c0bca767f58a50207..c84f07f8f85a1c7ae94c35a117cacc923d6f9650 100644 |
| --- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm |
| @@ -170,7 +170,17 @@ void BrowserWindowCocoa::Close() { |
| if ([controller_ overlayWindow]) { |
| [controller_ deferPerformClose]; |
| } else { |
| - [window() performClose:controller_]; |
| + // Using |-performClose:| can prevent the window from actually closing if |
| + // a JavaScript beforeunload handler opens an alert during shutdown, as |
| + // documented at <http://crbug.com/118424>. Re-implement |
| + // -[NSWindow performClose:] as closely as possible to how Apple documents |
| + // it. Note that this implementation assumes that NSWindow does not |
| + // implement |-windowShouldClose:|. |
|
Mark Mentovai
2012/10/10 18:43:09
It wouldn’t be difficult to send the message to th
Robert Sesek
2012/10/11 14:13:37
Done. There's a new test for you to review, too.
|
| + id<NSWindowDelegate> delegate = [window() delegate]; |
| + if (![delegate respondsToSelector:@selector(windowShouldClose:)] || |
|
Mark Mentovai
2012/10/10 18:43:09
What is this weird bracket syntax?
Robert Sesek
2012/10/11 14:13:37
http://bukk.it/noidea-golf.gif
|
| + [delegate windowShouldClose:window()]) { |
| + [window() close]; |
| + } |
| } |
| } |