[Webkit-unassigned] [Bug 15891] Javascript console and dialogs are not implemented
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Nov 9 19:12:11 PST 2007
http://bugs.webkit.org/show_bug.cgi?id=15891
------- Comment #5 from christian at twotoasts.de 2007-11-09 19:12 PDT -------
(In reply to comment #4)
> + 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)) { .... }
You're right. I'll add a check to be on the safe side.
> + 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.
I don't even know why I made dialog a GtkDialog* in the first place, I'll fix
it.
>
> + 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?
Well, at first I did provide the handlers via G_STRUCT_OFFSET but this meant
that they are always executed. And we want to allow clients to override the
signals. So I left it blank here. It does work fine for me, tested with and
without signals connected by a client.
> 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?
The default handler is only executed if there are no client signals connected.
I found it a bit nicer api wise to do the magic in the background so that the
return values can actually be used.
--
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