[webkit-dev] WebKit gobject bindings: Who is guiding their future?

Carlos Garcia Campos carlosgc at webkit.org
Mon Aug 29 05:45:50 PDT 2016


El lun, 29-08-2016 a las 07:21 -0500, Michael Catanzaro escribió:
> On Mon, 2016-08-29 at 10:16 +0200, Carlos Garcia Campos wrote:
> > 
> > We basically have a Exception member
> > in WebKitDOMObject base class that is reset for every method call,
> > and
> > set in case of exception. Then we add
> > webkit_dom_object_get_exception()
> > to query if there were a exception. That's not the GLib way, but
> > DOM
> > bindings is a special API anyway.
> 
> It would be a major usability regression for developers. :(
> 

I don't see why. Most of the code using DOM bindings simply ignores the
errors, and existing code is not going to change. I don't see any major
usability issue, neither any regression at all. Is it really a major
usability going from:

GError *error = NULL;
webkit_dom_foo_do_bar (foo, &error);
if (error) {
    handle_error();
    g_error_free (error);
}

to

webkit_dom_foo_do_bar (foo);
error = webkit_dom_foo_get_error (foo);
if (error)
    handle_error();

It even has advantages, for example if you are not interested in the
error details you can null-check the return value of get_error()
without having to worry about freeing the GError. 

I agree this is not ideal for a GObject API, but I really don't see how
this is a major problem, to be honest.

-- 
Carlos Garcia Campos


More information about the webkit-dev mailing list