[Webkit-unassigned] [Bug 15891] Javascript console and dialogs are not implemented

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Nov 9 17:40:13 PST 2007


http://bugs.webkit.org/show_bug.cgi?id=15891


xan.lopez at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |xan.lopez at gmail.com




------- Comment #4 from xan.lopez at gmail.com  2007-11-09 17:40 PDT -------
+typedef enum {
+    WEBKIT_JAVA_SCRIPT_DIALOG_ALERT,
+    WEBKIT_JAVA_SCRIPT_DIALOG_CONFIRM,
+    WEBKIT_JAVA_SCRIPT_DIALOG_PROMPT
+ } WEBKIT_JAVA_SCRIPT_DIALOG;

WebKitJavaScriptDialog.

+    if (g_signal_has_handler_pending(m_webPage, signal, 0, TRUE)) {
+        g_signal_emit(m_webPage, signal, NULL, message.utf8().data(),
lineNumber, sourceId.utf8().data());

Mmmm, unless those UTF8 conversions are really expensive I'd say that's a bit
too much, but maybe that's just me.


+    GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(page));

This is not totally guaranteed to return a window/toplevel, check the return
value with if (GTK_WIDGET_TOPLEVEL (window)) { .... }

+    dialog = GTK_DIALOG(gtk_message_dialog_new(GTK_WINDOW(window)

In general you declare all widgets with GtkWidget * type to not do this kind of
castings.

+    webkit_page_signals[JAVA_SCRIPT_CONSOLE_MESSAGE] =
g_signal_new("java_script_console_message",
+            G_TYPE_FROM_CLASS(pageClass),
+            (GSignalFlags)(G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION),
+            0,
             ^^

You are telling g_signal_new you won't set any default handler for the signal,
and then you *do* associate them (this is for all the new signals). Use
G_STRUCT_OFFSET(WebKitPageClass, <vfunc>) here. Out of curiosity, does this
even work? No warnings printed?

Also, why did you set alert and console-message as returning void? Doesn't that
mean the default handler will be executed unless you stop the emission manually
from a callback? For console-message I suppose it's ok, but why for alert?


-- 
Configure bugmail: http://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list