Title: [140338] trunk/Source/WebCore
Revision
140338
Author
[email protected]
Date
2013-01-21 08:23:13 -0800 (Mon, 21 Jan 2013)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (140337 => 140338)


--- trunk/Source/WebCore/ChangeLog	2013-01-21 16:17:26 UTC (rev 140337)
+++ trunk/Source/WebCore/ChangeLog	2013-01-21 16:23:13 UTC (rev 140338)
@@ -1,3 +1,24 @@
+2013-01-21  Dan Winship  <[email protected]>
+
+        [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):
+
 2013-01-18  Andrey Kosyakov  <[email protected]>
 
         Web Inspector: data grid resize is slow

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (140337 => 140338)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-01-21 16:17:26 UTC (rev 140337)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2013-01-21 16:23:13 UTC (rev 140338)
@@ -513,7 +513,7 @@
     }
 
     GOwnPtr<GError> error;
-    gssize bytesSkipped = g_input_stream_skip_finish(d->m_inputStream.get(), asyncResult, &error.outPtr());
+    gssize bytesSkipped = g_input_stream_read_finish(d->m_inputStream.get(), asyncResult, &error.outPtr());
     if (error) {
         client->didFail(handle.get(), ResourceError::genericIOError(error.get(), d->m_soupRequest.get()));
         cleanupSoupRequestOperation(handle.get());
@@ -521,7 +521,7 @@
     }
 
     if (bytesSkipped > 0) {
-        g_input_stream_skip_async(d->m_inputStream.get(), G_MAXSSIZE, G_PRIORITY_DEFAULT,
+        g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, G_MAXSSIZE, G_PRIORITY_DEFAULT,
             d->m_cancellable.get(), redirectSkipCallback, handle.get());
         return;
     }
@@ -668,10 +668,15 @@
         return;
     }
 
+    d->m_buffer = static_cast<char*>(g_slice_alloc(READ_BUFFER_SIZE));
+
     if (soupMessage) {
         if (SOUP_STATUS_IS_REDIRECTION(soupMessage->status_code) && shouldRedirect(handle.get())) {
             d->m_inputStream = inputStream;
-            g_input_stream_skip_async(d->m_inputStream.get(), G_MAXSSIZE, G_PRIORITY_DEFAULT,
+            // We use read_async() rather than skip_async() to work around
+            // https://bugzilla.gnome.org/show_bug.cgi?id=691489 until we can
+            // depend on glib > 2.35.4
+            g_input_stream_read_async(d->m_inputStream.get(), d->m_buffer, G_MAXSSIZE, G_PRIORITY_DEFAULT,
                 d->m_cancellable.get(), redirectSkipCallback, handle.get());
             return;
         }
@@ -702,8 +707,6 @@
         return;
     }
 
-    d->m_buffer = static_cast<char*>(g_slice_alloc(READ_BUFFER_SIZE));
-
     if (soupMessage && d->m_response.isMultipart()) {
         d->m_multipartInputStream = adoptGRef(soup_multipart_input_stream_new(soupMessage, inputStream.get()));
         soup_multipart_input_stream_next_part_async(d->m_multipartInputStream.get(), G_PRIORITY_DEFAULT,
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to