Changeset 140338 in webkit


Ignore:
Timestamp:
Jan 21, 2013 8:23:13 AM (11 years ago)
Author:
danw@gnome.org
Message:

[Soup] Work around a glib bug
https://bugs.webkit.org/show_bug.cgi?id=106789

Reviewed by Martin Robinson.

In glib <= 2.35.4, g_input_stream_skip_async() applied to a
libsoup response stream will do a synchronous skip() in another
thread, which libsoup isn't expecting and doesn't have proper
locking for. Work around this until the next time we bump the glib
requirement by using read_async() (and throwing away the result)
instead of skip_async().

No new tests; fixes a race condition in existing tests with older
glib

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore::redirectSkipCallback):
(WebCore::sendRequestCallback):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r140335 r140338  
     12013-01-21  Dan Winship  <danw@gnome.org>
     2
     3        [Soup] Work around a glib bug
     4        https://bugs.webkit.org/show_bug.cgi?id=106789
     5
     6        Reviewed by Martin Robinson.
     7
     8        In glib <= 2.35.4, g_input_stream_skip_async() applied to a
     9        libsoup response stream will do a synchronous skip() in another
     10        thread, which libsoup isn't expecting and doesn't have proper
     11        locking for. Work around this until the next time we bump the glib
     12        requirement by using read_async() (and throwing away the result)
     13        instead of skip_async().
     14
     15        No new tests; fixes a race condition in existing tests with older
     16        glib
     17
     18        * platform/network/soup/ResourceHandleSoup.cpp:
     19        (WebCore::redirectSkipCallback):
     20        (WebCore::sendRequestCallback):
     21
    1222013-01-18  Andrey Kosyakov  <caseq@chromium.org>
    223
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r140154 r140338  
    514514
    515515    GOwnPtr<GError> error;
    516     gssize bytesSkipped = g_input_stream_skip_finish(d->m_inputStream.get(), asyncResult, &error.outPtr());
     516    gssize bytesSkipped = g_input_stream_read_finish(d->m_inputStream.get(), asyncResult, &error.outPtr());
    517517    if (error) {
    518518        client->didFail(handle.get(), ResourceError::genericIOError(error.get(), d->m_soupRequest.get()));
     
    522522
    523523    if (bytesSkipped > 0) {
    524         g_input_stream_skip_async(d->m_inputStream.get(), G_MAXSSIZE, G_PRIORITY_DEFAULT,
     524        g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, G_MAXSSIZE, G_PRIORITY_DEFAULT,
    525525            d->m_cancellable.get(), redirectSkipCallback, handle.get());
    526526        return;
     
    669669    }
    670670
     671    d->m_buffer = static_cast<char*>(g_slice_alloc(READ_BUFFER_SIZE));
     672
    671673    if (soupMessage) {
    672674        if (SOUP_STATUS_IS_REDIRECTION(soupMessage->status_code) && shouldRedirect(handle.get())) {
    673675            d->m_inputStream = inputStream;
    674             g_input_stream_skip_async(d->m_inputStream.get(), G_MAXSSIZE, G_PRIORITY_DEFAULT,
     676            // We use read_async() rather than skip_async() to work around
     677            // https://bugzilla.gnome.org/show_bug.cgi?id=691489 until we can
     678            // depend on glib > 2.35.4
     679            g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, G_MAXSSIZE, G_PRIORITY_DEFAULT,
    675680                d->m_cancellable.get(), redirectSkipCallback, handle.get());
    676681            return;
     
    702707        return;
    703708    }
    704 
    705     d->m_buffer = static_cast<char*>(g_slice_alloc(READ_BUFFER_SIZE));
    706709
    707710    if (soupMessage && d->m_response.isMultipart()) {
Note: See TracChangeset for help on using the changeset viewer.