[Webkit-unassigned] [Bug 48231] Cannot close modal windows from javascript
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Mon Oct 25 10:33:09 PDT 2010
https://bugs.webkit.org/show_bug.cgi?id=48231
--- Comment #2 from Christiaan Hofman <cmhofman at gmail.com> 2010-10-25 10:33:09 PST ---
I am not sure what you mean by a test case, or "other browsers". But it is not working for any basic browser app (for instance a small extension of Apple's MiniBrowser sample) that implements the WebUIDelegate methods webViewShow:, webViewClose: webViewRunModal:, and webView:createWebViewModalDialogWithRequest: in a meaningful (and straight forward) way. For instance with this simple extension of the sample code in Apple's documentation for multiple windows"
- (WebView *)webView:(WebView *)sender createWebViewModalDialogWithRequest:(NSURLRequest *)request
{
// really the same as webViewShow:
id myDocument = [[NSDocumentController sharedDocumentController] openUntitledDocumentOfType:@"DocumentType" display:YES];
if (request)
[[[myDocument webView] mainFrame] loadRequest:request];
return [myDocument webView];
}
- (void)webViewShow:(WebView *)sender
{
id myDocument = [[NSDocumentController sharedDocumentController] documentForWindow:[sender window]];
[myDocument showWindows];
}
- (void)webViewRunModal:(WebView *)sender
{
// ivar to keep track whether we are running a modal window
isModal = YES;
[NSApp runModalForWindow:[sender window]];
}
- (void)windowWillClose:(NSNotification *)notification
{
// assume this is the window delegate, and stop running modal if necessary
if (isModal)
[NSApp stopModal];
}
Load a page that includes a showModalDialog() javascript action tied to a link or button, for instance with this simple HTML:
<html>
<a href="javascript:showModalDialog('dialog.html')">Show Modal Dialog</a>
</html>
And let the dialog (dialog.html) contain a link or button tied to the javascript close() action, for instance with this HTML:
<html>
<a href="javascript:close()">Close</a>
</html>
Really nothing else should be required to see it.
I don't know why it does work in Safari, there must be a serious workaround there, because it does not work with plain WebKit and proper delegate method implementations, and that's what matters.
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list