Changeset 148068 in webkit


Ignore:
Timestamp:
Apr 9, 2013 5:04:55 PM (11 years ago)
Author:
ap@apple.com
Message:

REGRESSION: Blob URLs broken with NetworkProcess
https://bugs.webkit.org/show_bug.cgi?id=114320

Reviewed by Brady Eidson.

Update BlobResourceHandle to use modern resource client calls.

  • platform/network/BlobResourceHandle.cpp: (WebCore::BlobResourceHandle::readSync): Don't call notifyReceiveData if there is no data (it's especially egregious when length is -1, signaling an error). (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Use didReceiveResponseAsync when a client wants async callbacks. This is not very clean, as we don't wait for response, but should be workable for blobs. (WebCore::BlobResourceHandle::notifyResponseOnError): Ditto. (WebCore::BlobResourceHandle::notifyReceiveData): Use didReceiveBuffer (clients that only implement didReceiveData will have it automatically unwrapped).
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r148065 r148068  
     12013-04-09  Alexey Proskuryakov  <ap@apple.com>
     2
     3        REGRESSION: Blob URLs broken with NetworkProcess
     4        https://bugs.webkit.org/show_bug.cgi?id=114320
     5
     6        Reviewed by Brady Eidson.
     7
     8        Update BlobResourceHandle to use modern resource client calls.
     9
     10        * platform/network/BlobResourceHandle.cpp:
     11        (WebCore::BlobResourceHandle::readSync): Don't call notifyReceiveData if there is
     12        no data (it's especially egregious when length is -1, signaling an error).
     13        (WebCore::BlobResourceHandle::notifyResponseOnSuccess): Use didReceiveResponseAsync
     14        when a client wants async callbacks. This is not very clean, as we don't wait
     15        for response, but should be workable for blobs.
     16        (WebCore::BlobResourceHandle::notifyResponseOnError): Ditto.
     17        (WebCore::BlobResourceHandle::notifyReceiveData): Use didReceiveBuffer (clients
     18        that only implement didReceiveData will have it automatically unwrapped).
     19
    1202013-04-09  Jer Noble  <jer.noble@apple.com>
    221
  • trunk/Source/WebCore/platform/network/BlobResourceHandle.cpp

    r144770 r148068  
    4545#include "ResourceRequest.h"
    4646#include "ResourceResponse.h"
     47#include "SharedBuffer.h"
    4748#include <wtf/MainThread.h>
    4849
     
    379380        result = length - remaining;
    380381
    381     notifyReceiveData(buf, result);
     382    if (result > 0)
     383        notifyReceiveData(buf, result);
     384
    382385    if (!result)
    383386        notifyFinish();
     
    581584    if (!m_blobData->contentDisposition().isEmpty())
    582585        response.setHTTPHeaderField("Content-Disposition", m_blobData->contentDisposition());
    583     client()->didReceiveResponse(this, response);
     586
     587    // BlobResourceHandle cannot be used with downloading, and doesn't even wait for continueDidReceiveResponse.
     588    // It's currently client's responsibility to know that didReceiveResponseAsync cannot be used to convert a
     589    // load into a download or blobs.
     590    if (client()->usesAsyncCallbacks())
     591        client()->didReceiveResponseAsync(this, response);
     592    else
     593        client()->didReceiveResponse(this, response);
    584594}
    585595
     
    607617        break;
    608618    }
    609     client()->didReceiveResponse(this, response);
     619
     620    // Note that we don't wait for continueDidReceiveResponse when using didReceiveResponseAsync.
     621    // This is not formally correct, but the client has to be a no-op anyway, because blobs can't be downloaded.
     622    if (client()->usesAsyncCallbacks())
     623        client()->didReceiveResponseAsync(this, response);
     624    else
     625        client()->didReceiveResponse(this, response);
    610626}
    611627
     
    613629{
    614630    if (client())
    615         client()->didReceiveData(this, data, bytesRead, bytesRead);
     631        client()->didReceiveBuffer(this, SharedBuffer::create(data, bytesRead), bytesRead);
    616632}
    617633
Note: See TracChangeset for help on using the changeset viewer.