[Webkit-unassigned] [Bug 19656] [SOUP] The gio code should call didFail() instead of didFinishLoading() in case of error

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Aug 2 01:11:00 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=19656


eric at webkit.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #21819|review?                     |review-
               Flag|                            |




------- Comment #2 from eric at webkit.org  2008-08-02 01:11 PDT -------
(From update of attachment 21819)
We really should have a GOwnPtr which knows how to call g_free on the
associated pointer.  In that case:
      gchar* uri = g_file_get_uri (d->m_gfile);
 519         ResourceError resourceError("webkit-network-error",
ERROR_TRANSPORT, uri, String::fromUTF8(error->message));
 520         g_free(uri);

would not need the g_free line.  Stupid c-style memory management.  Bleh.  (No
offense to your code, I just have a general hatred towards languages and APIs
which make it easy for you to stab yourself in the foot, or leak memory.)

WebKit style does not have a space between the function name and the (
+        gchar* uri = g_file_get_uri (d->m_gfile);

So we make 2 copies of the buffer just to send this URI off to ResourceError. 
Is it possible to avoid this?

You should consider adding an inline function which created the resource error
from the gfile handle and returned it to you.   That would eliminate 6 lines of
copy-paste code.

Then these calls just become:

client->didFail(handle, networkErrorForFile(d->m_gfile, error));

static inline ResourceError networkErrorForFile(gfile* file, gerror* error)
{
    gchar* uri = g_file_get_uri(d->m_gfile);
    ResourceError resourceError("webkit-network-error", ERROR_TRANSPORT, uri,
String::fromUTF8(error->message));
    g_free(uri);
   return resourceError;
}

r- for the style errors.  And I would encourage you to use a static inline to
eliminate this copy-paste code.


-- 
Configure bugmail: https://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