Changeset 161109 in webkit


Ignore:
Timestamp:
Dec 28, 2013 12:36:24 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Downloads are broken with the network process enabled
https://bugs.webkit.org/show_bug.cgi?id=126131

Reviewed by Martin Robinson.

The problem is that the network process crashes when trying to
convert the handle to a download, because at that point the
download has finished and the handle is NULL. This happens because
we are not implementing ResourceHandle::continueDidReceiveResponse().

  • platform/network/soup/ResourceHandleSoup.cpp:

(WebCore::nextMultipartResponsePartCallback): Call
continueAfterDidReceiveResponse() when not using async callbacks.
(WebCore::sendRequestCallback): Ditto.
(WebCore::continueAfterDidReceiveResponse): Helper function that
continues the load after didReceiveResponse.
(WebCore::ResourceHandle::continueDidReceiveResponse): Call
continueAfterDidReceiveResponse().

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r161108 r161109  
     12013-12-28  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Downloads are broken with the network process enabled
     4        https://bugs.webkit.org/show_bug.cgi?id=126131
     5
     6        Reviewed by Martin Robinson.
     7
     8        The problem is that the network process crashes when trying to
     9        convert the handle to a download, because at that point the
     10        download has finished and the handle is NULL. This happens because
     11        we are not implementing ResourceHandle::continueDidReceiveResponse().
     12
     13        * platform/network/soup/ResourceHandleSoup.cpp:
     14        (WebCore::nextMultipartResponsePartCallback): Call
     15        continueAfterDidReceiveResponse() when not using async callbacks.
     16        (WebCore::sendRequestCallback): Ditto.
     17        (WebCore::continueAfterDidReceiveResponse): Helper function that
     18        continues the load after didReceiveResponse.
     19        (WebCore::ResourceHandle::continueDidReceiveResponse): Call
     20        continueAfterDidReceiveResponse().
     21
    1222013-12-27  Daniel Bates  <dabates@apple.com>
    223
  • trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp

    r160961 r161109  
    237237static int  milisecondsSinceRequest(double requestTime);
    238238#endif
     239static void continueAfterDidReceiveResponse(ResourceHandle*);
    239240
    240241static bool gIgnoreSSLErrors = false;
     
    653654    d->m_response.updateFromSoupMessageHeaders(soup_multipart_input_stream_get_headers(d->m_multipartInputStream.get()));
    654655
     656    d->m_previousPosition = 0;
     657
    655658    if (handle->client()->usesAsyncCallbacks())
    656659        handle->client()->didReceiveResponseAsync(handle.get(), d->m_response);
    657     else
     660    else {
    658661        handle->client()->didReceiveResponse(handle.get(), d->m_response);
    659 
    660     if (handle->cancelledOrClientless()) {
    661         cleanupSoupRequestOperation(handle.get());
    662         return;
    663     }
    664 
    665     d->m_previousPosition = 0;
    666 
    667     handle->ensureReadBuffer();
    668     g_input_stream_read_async(d->m_inputStream.get(), const_cast<char*>(d->m_soupBuffer->data), d->m_soupBuffer->length,
    669         G_PRIORITY_DEFAULT, d->m_cancellable.get(), readCallback, handle.get());
     662        continueAfterDidReceiveResponse(handle.get());
     663    }
    670664}
    671665
     
    723717    }
    724718
     719    if (soupMessage && d->m_response.isMultipart())
     720        d->m_multipartInputStream = adoptGRef(soup_multipart_input_stream_new(soupMessage, inputStream.get()));
     721    else
     722        d->m_inputStream = inputStream;
     723
    725724    if (d->client()->usesAsyncCallbacks())
    726725        handle->client()->didReceiveResponseAsync(handle.get(), d->m_response);
    727     else
     726    else {
    728727        handle->client()->didReceiveResponse(handle.get(), d->m_response);
    729 
     728        continueAfterDidReceiveResponse(handle.get());
     729    }
     730}
     731
     732static void continueAfterDidReceiveResponse(ResourceHandle* handle)
     733{
    730734    if (handle->cancelledOrClientless()) {
    731         cleanupSoupRequestOperation(handle.get());
    732         return;
    733     }
    734 
    735     if (soupMessage && d->m_response.isMultipart()) {
    736         d->m_multipartInputStream = adoptGRef(soup_multipart_input_stream_new(soupMessage, inputStream.get()));
     735        cleanupSoupRequestOperation(handle);
     736        return;
     737    }
     738
     739    ResourceHandleInternal* d = handle->getInternal();
     740    if (d->m_soupMessage && d->m_multipartInputStream && !d->m_inputStream) {
    737741        soup_multipart_input_stream_next_part_async(d->m_multipartInputStream.get(), G_PRIORITY_DEFAULT,
    738             d->m_cancellable.get(), nextMultipartResponsePartCallback, handle.get());
    739         return;
    740     }
    741 
    742     d->m_inputStream = inputStream;
    743 
     742            d->m_cancellable.get(), nextMultipartResponsePartCallback, handle);
     743        return;
     744    }
     745
     746    ASSERT(d->m_inputStream);
    744747    handle->ensureReadBuffer();
    745748    g_input_stream_read_async(d->m_inputStream.get(), const_cast<char*>(d->m_soupBuffer->data), d->m_soupBuffer->length,
    746         G_PRIORITY_DEFAULT, d->m_cancellable.get(), readCallback, handle.get());
     749        G_PRIORITY_DEFAULT, d->m_cancellable.get(), readCallback, handle);
    747750}
    748751
     
    13911394    ASSERT(client());
    13921395    ASSERT(client()->usesAsyncCallbacks());
    1393     // FIXME: Implement this method if needed: https://bugs.webkit.org/show_bug.cgi?id=126114.
     1396    continueAfterDidReceiveResponse(this);
    13941397}
    13951398
Note: See TracChangeset for help on using the changeset viewer.