[webkit-dev] Support for showModalDialog in WebKit

Prasad Tammana prasadt at chromium.org
Wed May 19 15:00:49 PDT 2010

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
of WebKit support for showModalDialog JavaScript function.  Here is what I'm
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 WebChromeClient::closeWindowSoon()
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 to
LayoutTestController and make it available to JavaScript.  Is that what the
WebKit apps are expected to do to support showModalDialog()?  Or is there
some other hook that I'm missing to make this work?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100519/596bd935/attachment.html>

More information about the webkit-dev mailing list