public Object jsxFunction_showModalDialog(final String url, final Object arguments, final String features) {
final WebWindow ww = getWebWindow();
final WebClient client = ww.getWebClient();
try {
final URL completeUrl = ((HtmlPage) getDomNodeOrDie()).getFullyQualifiedUrl(url);
final DialogWindow dialog = client.openDialogWindow(completeUrl, ww, arguments);
// TODO: Theoretically, we shouldn't return until the dialog window has been close()'ed...
// But we have to return so that the window can be close()'ed...
// Maybe we can use Rhino's continuation support to save state and restart when
// the dialog window is close()'ed? Would only work in interpreted mode, though.
final ScriptableObject jsDialog = (ScriptableObject) dialog.getScriptObject();
return jsDialog.get("returnValue", jsDialog);
}
catch (final IOException e) {
throw Context.throwAsScriptRuntimeEx(e);
}