[webkit-dev] Support for showModalDialog in WebKit
prasadt at chromium.org
Fri May 21 11:18:01 PDT 2010
On Wed, May 19, 2010 at 6:04 PM, Darin Adler <darin at apple.com> wrote:
> On May 19, 2010, at 3:00 PM, Prasad Tammana wrote:
> > I'm trying to add support for testing scenarios in the presence of modal
> dialogs to DumpRenderTree (DRT) and I'm running into an apparent limitation
> trying to do:
> > 1) I added webViewRunModal function to DRT's UIDelegate implementation
> and invoked runModalForWindow from it.
> > 2) I added an observer for NSWindowWillCloseNotification and invoked
> abortModal from it.
> > The issue I'm running into is that the observer is not getting invoked.
> This is what I figured after debugging:
> > 1) window.close on the modal dialog ends up in
> > 2) This calls [m_webView performSelector:@selector(_closeWindow)
> withObject:nil afterDelay:0.0];
> > As per documentation, performSelector afterDelay sets a timer that'll
> only run in NSDefaultRunLoopMode, whereas the runModal sets the loop to be
> in NSModalPanelRunLoopMode and that message never gets dispatch and close()
> never gets called.
> > The only work-around I can come up with is to add an abortModal() method
> the WebKit apps are expected to do to support showModalDialog()? Or is
> there some other hook that I'm missing to make this work?
> DumpRenderTree can subclass NSApplication and do this:
> - (NSEvent *)nextEventMatchingMask:(NSUInteger)mask untilDate:(NSDate
> *)expiration inMode:(NSString *)mode dequeue:(BOOL)dequeue
> if (mode == NSModalPanelRunLoopMode)
> mode = NSDefaultRunLoopMode;
> return [super nextEventMatchingMask:mask untilDate:expiration
> inMode:mode dequeue:dequeue];
> As far as the broader question is concerned abut other applications, not
> sure of the answer.
Darin - Thanks for the response. This still doesn't seem like a clean way
for an app built on top of WebKit to support showModalDialog. This code
will affect the entire app and that doesn't seem desirable at an intuitive.
Wondering if there is a cleaner way to support showModalDialog. It'd be
great if someone could share how this is done for Safari or any other
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev