2010-11-26 Sergio Villar Senin <svillar@igalia.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Nov 2010 15:52:39 +0000 (15:52 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 26 Nov 2010 15:52:39 +0000 (15:52 +0000)
        Reviewed by Xan Lopez.

        [Gtk] ASSERT(d->m_response.isNull()) in contentSniffedCallback
        https://bugs.webkit.org/show_bug.cgi?id=50083

        ResourceHandleSoup should not listen to content-sniffed signal
        when content sniffing is not enabled. This will prevent us
        reaching an assertion on content-sniffed callback

        * platform/network/soup/ResourceHandleSoup.cpp:
        (WebCore::startHttp):
        * platform/network/soup/cache/soup-request-http.c:
        (conditional_get_ready_cb): added a comment with the
        possible fix for a pure libsoup HTTP cache.
        (send_async_cb): prevent an early object finalization adding a
        reference.
        (webkit_soup_request_http_send_async): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@72762 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/network/soup/ResourceHandleSoup.cpp
WebCore/platform/network/soup/cache/soup-request-http.c

index fd86969..f3007ed 100644 (file)
@@ -1,3 +1,23 @@
+2010-11-26  Sergio Villar Senin  <svillar@igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        [Gtk] ASSERT(d->m_response.isNull()) in contentSniffedCallback
+        https://bugs.webkit.org/show_bug.cgi?id=50083
+
+        ResourceHandleSoup should not listen to content-sniffed signal
+        when content sniffing is not enabled. This will prevent us
+        reaching an assertion on content-sniffed callback
+
+        * platform/network/soup/ResourceHandleSoup.cpp:
+        (WebCore::startHttp):
+        * platform/network/soup/cache/soup-request-http.c:
+        (conditional_get_ready_cb): added a comment with the
+        possible fix for a pure libsoup HTTP cache.
+        (send_async_cb): prevent an early object finalization adding a
+        reference.
+        (webkit_soup_request_http_send_async): Ditto.
+
 2010-11-26  Renata Hodovan  <reni@inf.u-szeged.hu>
 
         Reviewed by Antonio Gomes.
index e578a8d..c1933e3 100644 (file)
@@ -586,10 +586,11 @@ static bool startHttp(ResourceHandle* handle)
 
     if (!handle->shouldContentSniff())
         soup_message_disable_feature(soupMessage, SOUP_TYPE_CONTENT_SNIFFER);
+    else
+        g_signal_connect(soupMessage, "content-sniffed", G_CALLBACK(contentSniffedCallback), handle);
 
     g_signal_connect(soupMessage, "restarted", G_CALLBACK(restartedCallback), handle);
     g_signal_connect(soupMessage, "got-headers", G_CALLBACK(gotHeadersCallback), handle);
-    g_signal_connect(soupMessage, "content-sniffed", G_CALLBACK(contentSniffedCallback), handle);
     d->m_gotChunkHandler = g_signal_connect(soupMessage, "got-chunk", G_CALLBACK(gotChunkCallback), handle);
 
 #ifdef HAVE_LIBSOUP_2_29_90
index f157cfc..f3fe2ec 100644 (file)
@@ -151,6 +151,13 @@ conditional_get_ready_cb (SoupSession *session, SoupMessage *msg, gpointer user_
                        g_simple_async_result_set_op_res_gpointer (simple, httpstream, g_object_unref);
 
                        soup_message_got_headers (helper->original);
+
+                       /* FIXME: Uncomment this when this becomes part of libsoup
+                        * if (!soup_message_disables_feature(helper->original, SOUP_TYPE_CONTENT_SNIFFER)) {
+                        *      const gchar *content_type = soup_message_headers_get_content_type (msg->response_headers, NULL);
+                        *      soup_message_content_sniffed (helper->original, content_type, NULL);
+                        * }
+                        */
                        content_type = soup_message_headers_get_content_type (msg->response_headers, NULL);
                        soup_message_content_sniffed (helper->original, content_type, NULL);
 
@@ -215,6 +222,13 @@ send_async_cb (gpointer data)
 
                /* Issue signals  */
                soup_message_got_headers (helper->http->priv->msg);
+
+               /* FIXME: Uncomment this when this becomes part of libsoup
+                * if (!soup_message_disables_feature(helper->http->priv->msg, SOUP_TYPE_CONTENT_SNIFFER)) {
+                *      const gchar *content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
+                *      soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
+                * }
+                */
                content_type = soup_message_headers_get_content_type (helper->http->priv->msg->response_headers, NULL);
                soup_message_content_sniffed (helper->http->priv->msg, content_type, NULL);
 
@@ -225,6 +239,7 @@ send_async_cb (gpointer data)
                g_object_unref (simple);
        }
 
+       g_object_unref (helper->http);
        g_slice_free (SendAsyncHelper, helper);
 
        return FALSE;
@@ -256,7 +271,7 @@ webkit_soup_request_http_send_async (WebKitSoupRequest          *request,
                           the signals must be also emitted
                           asynchronously */
                        SendAsyncHelper *helper = g_slice_new (SendAsyncHelper);
-                       helper->http = http;
+                       helper->http = g_object_ref (http);
                        helper->callback = callback;
                        helper->user_data = user_data;
                        g_timeout_add (0, send_async_cb, helper);