RESOLVED INVALID Bug 40036
Make WebChromeClient::closeWindowSoon work for all RunLoop modes
https://bugs.webkit.org/show_bug.cgi?id=40036
Summary Make WebChromeClient::closeWindowSoon work for all RunLoop modes
Prasad Tammana
Reported 2010-06-01 18:19:25 PDT
performSelector:withObject:afterDelay method is being used to post the _closeWindow message to the queue. Those message will only get dispatched if the RunLoop is in NSDefaultRunLoopMode. Since RunLoop is in NSModalPanelRunLoopMode mode when a modal window is being displayed, you can't close the window. Replaced the call with the inModes version to allow the close window message to be dispatched in all RunLoop modes.
Attachments
Patch to make closeWindowSoon work in all RunLoop modes. (1.77 KB, patch)
2010-06-01 18:25 PDT, Prasad Tammana
no flags
Prasad Tammana
Comment 1 2010-06-01 18:25:49 PDT
Created attachment 57611 [details] Patch to make closeWindowSoon work in all RunLoop modes.
David Levin
Comment 2 2010-06-02 09:37:00 PDT
Darin Adler
Comment 3 2010-06-04 22:52:35 PDT
Comment on attachment 57611 [details] Patch to make closeWindowSoon work in all RunLoop modes. I don’t think this change is correct or helpful. For example, I don’t think we want to close a window and run all the code that triggers inside an NSConnectionReply modal event loop. I don’t understand the benefit side of this patch either.
Prasad Tammana
Comment 4 2010-06-07 09:36:00 PDT
(In reply to comment #3) > (From update of attachment 57611 [details]) > I don’t think this change is correct or helpful. For example, I don’t think we want to close a window and run all the code that triggers inside an NSConnectionReply modal event loop. > > I don’t understand the benefit side of this patch either. When you write a WebKit application that implements showModalDialog, you don't have a way to close the window from script. The close call ends up in the closeWindowSoon() function and the _closeWindow() doesn't get dispatched because the run loop is in NSModalPanelRunLoopMode mode. I didn't realize that dispatching these calls is inappropriate in certain modes. I could make this fix more targeted and make it to be: [m_webView performSelector:@selector(_closeWindow) withObject:nil afterDelay:0.0 inModes:[NSArray arrayWithObjects:NSDefaultRunLoopMode, NSModalPanelRunLoopMode]]; With that change the only new mode we'll be closing windows would be in NSModalPanelRunLoopMode. Does that seem like a correct change? I ran into this issue when adding showModalDialog to DumpRenderTree as part of the bug fix for - https://bugs.webkit.org/show_bug.cgi?id=35350. You'll notice I have a patch attached to that bug that includes this change. I decided to factor out this particular change into a separate patch as this is the more sensitive part of that big patch. Thanks, Prasad
Dmitry Titov
Comment 5 2010-07-19 16:06:34 PDT
Comment on attachment 57611 [details] Patch to make closeWindowSoon work in all RunLoop modes. Removing r? since the root bug 35350 has landed and it seems a different approach was selected to support showModalDialog testing. Please update if this is not so.
Prasad Tammana
Comment 6 2010-09-14 19:26:29 PDT
We don't need this change anymore.
Note You need to log in before you can comment on or make changes to this bug.