File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -297,9 +297,23 @@ LRESULT IECommandExecutor::OnBrowserQuit(UINT uMsg,
297
297
delete[] str;
298
298
BrowserMap::iterator found_iterator = this ->managed_browsers_ .find (browser_id);
299
299
if (found_iterator != this ->managed_browsers_ .end ()) {
300
- this ->managed_browsers_ .erase (browser_id);
301
- if (this ->managed_browsers_ .size () == 0 ) {
302
- this ->current_browser_id_ = " " ;
300
+ // If there's still an alert window active, repost this message to
301
+ // ourselves, since the alert will be handled either automatically or
302
+ // manually by the user.
303
+ HWND alert_handle;
304
+ if (this ->IsAlertActive (found_iterator->second , &alert_handle)) {
305
+ LOG (DEBUG) << " Alert is active on closing browser window. Reposting message." ;
306
+ LPSTR message_payload = new CHAR[browser_id.size () + 1 ];
307
+ strcpy_s (message_payload, browser_id.size () + 1 , browser_id.c_str ());
308
+ ::PostMessage (this ->m_hWnd,
309
+ WD_BROWSER_QUIT,
310
+ NULL ,
311
+ reinterpret_cast <LPARAM>(message_payload));
312
+ } else {
313
+ this ->managed_browsers_ .erase (browser_id);
314
+ if (this ->managed_browsers_ .size () == 0 ) {
315
+ this ->current_browser_id_ = " " ;
316
+ }
303
317
}
304
318
} else {
305
319
LOG (WARN) << " Unable to find browser to quit with ID " << browser_id;
You can’t perform that action at this time.
0 commit comments