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

Unified Diff: chrome/browser/ui/cocoa/browser_window_cocoa.mm

Issue 11090029: [Mac] In BrowserWindowCocoa::Close() do not use -[NSWindow performClose:]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9d34a898790f92020bc0e63dd6016b2a0a1592f8 100644
--- a/chrome/browser/ui/cocoa/browser_window_cocoa.mm
+++ b/chrome/browser/ui/cocoa/browser_window_cocoa.mm
@@ -170,7 +170,22 @@ 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.
+ id<NSWindowDelegate> delegate = [window() delegate];
+ SEL window_should_close = @selector(windowShouldClose:);
+ if ([delegate respondsToSelector:window_should_close]) {
+ if ([delegate windowShouldClose:window()])
+ [window() close];
+ } else if ([window() respondsToSelector:window_should_close]) {
+ if ([window() performSelector:window_should_close withObject:window()])
+ [window() close];
+ } else {
+ [window() close];
+ }
}
}
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698