Changeset 225708 in webkit


Ignore:
Timestamp:
Dec 8, 2017, 2:57:30 PM (7 years ago)
Author:
Joseph Pecoraro
Message:

ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
https://bugs.webkit.org/show_bug.cgi?id=180506

Reviewed by Brian Burg.

No test as this only happens inside a ServiceWorker inspector which
we don't yet have a way to test. In a Page Inspector, the
CacheStorage.add network request already behaves as expected.

  • inspector/NetworkResourcesData.cpp:

(WebCore::NetworkResourcesData::responseReceived):
(WebCore::shouldBufferResourceData):

  • inspector/NetworkResourcesData.h:

(WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
(WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
Provide a way to force buffering in NetworkResourceData.

  • inspector/agents/InspectorNetworkAgent.cpp:

(WebCore::InspectorNetworkAgent::didReceiveResponse):

  • inspector/agents/InspectorNetworkAgent.h:
  • inspector/agents/page/PageNetworkAgent.h:
  • inspector/agents/worker/WorkerNetworkAgent.h:

Enable force buffering in a Worker Network Agent.

Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r225707 r225708  
     12017-12-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        ServiceWorker Inspector: Should be able to see image content from CacheStorage.add(url) network request
     4        https://bugs.webkit.org/show_bug.cgi?id=180506
     5
     6        Reviewed by Brian Burg.
     7
     8        No test as this only happens inside a ServiceWorker inspector which
     9        we don't yet have a way to test. In a Page Inspector, the
     10        CacheStorage.add network request already behaves as expected.
     11
     12        * inspector/NetworkResourcesData.cpp:
     13        (WebCore::NetworkResourcesData::responseReceived):
     14        (WebCore::shouldBufferResourceData):
     15        * inspector/NetworkResourcesData.h:
     16        (WebCore::NetworkResourcesData::ResourceData::forceBufferData const):
     17        (WebCore::NetworkResourcesData::ResourceData::setForceBufferData):
     18        Provide a way to force buffering in NetworkResourceData.
     19
     20        * inspector/agents/InspectorNetworkAgent.cpp:
     21        (WebCore::InspectorNetworkAgent::didReceiveResponse):
     22        * inspector/agents/InspectorNetworkAgent.h:
     23        * inspector/agents/page/PageNetworkAgent.h:
     24        * inspector/agents/worker/WorkerNetworkAgent.h:
     25        Enable force buffering in a Worker Network Agent.
     26
    1272017-12-08  Daniel Bates  <dabates@apple.com>
    228
  • trunk/Source/WebCore/inspector/NetworkResourcesData.cpp

    r225546 r225708  
    151151}
    152152
    153 void NetworkResourcesData::responseReceived(const String& requestId, const String& frameId, const ResourceResponse& response, InspectorPageAgent::ResourceType type)
     153void NetworkResourcesData::responseReceived(const String& requestId, const String& frameId, const ResourceResponse& response, InspectorPageAgent::ResourceType type, bool forceBufferData)
    154154{
    155155    ResourceData* resourceData = resourceDataForRequestId(requestId);
     
    161161    resourceData->setHTTPStatusCode(response.httpStatusCode());
    162162    resourceData->setType(type);
     163    resourceData->setForceBufferData(forceBufferData);
    163164
    164165    if (InspectorNetworkAgent::shouldTreatAsText(response.mimeType()))
     
    206207static bool shouldBufferResourceData(const NetworkResourcesData::ResourceData& resourceData)
    207208{
     209    if (resourceData.forceBufferData())
     210        return true;
     211
    208212    if (resourceData.decoder())
    209213        return true;
  • trunk/Source/WebCore/inspector/NetworkResourcesData.h

    r225546 r225708  
    8888        void setCachedResource(CachedResource* cachedResource) { m_cachedResource = cachedResource; }
    8989
     90        bool forceBufferData() const { return m_forceBufferData; }
     91        void setForceBufferData(bool force) { m_forceBufferData = force; }
     92
    9093    private:
    9194        bool hasData() const { return m_dataBuffer; }
     
    108111        bool m_isContentEvicted { false };
    109112        bool m_base64Encoded { false };
     113        bool m_forceBufferData { false };
    110114    };
    111115
     
    115119    void resourceCreated(const String& requestId, const String& loaderId, InspectorPageAgent::ResourceType);
    116120    void resourceCreated(const String& requestId, const String& loaderId, CachedResource&);
    117     void responseReceived(const String& requestId, const String& frameId, const ResourceResponse&, InspectorPageAgent::ResourceType);
     121    void responseReceived(const String& requestId, const String& frameId, const ResourceResponse&, InspectorPageAgent::ResourceType, bool forceBufferData);
    118122    void setResourceType(const String& requestId, InspectorPageAgent::ResourceType);
    119123    InspectorPageAgent::ResourceType resourceType(const String& requestId);
  • trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp

    r225546 r225708  
    451451    String loaderId = loaderIdentifier(loader);
    452452
    453     m_resourcesData->responseReceived(requestId, frameId, response, type);
     453    m_resourcesData->responseReceived(requestId, frameId, response, type, shouldForceBufferingNetworkResourceData());
    454454
    455455    m_frontendDispatcher->responseReceived(requestId, frameId, loaderId, timestamp(), InspectorPageAgent::resourceTypeJSON(type), resourceResponse);
  • trunk/Source/WebCore/inspector/agents/InspectorNetworkAgent.h

    r225546 r225708  
    124124    virtual void setResourceCachingDisabled(bool) = 0;
    125125    virtual ScriptExecutionContext* scriptExecutionContext(ErrorString&, const String& frameId) = 0;
     126    virtual bool shouldForceBufferingNetworkResourceData() const = 0;
    126127
    127128private:
  • trunk/Source/WebCore/inspector/agents/page/PageNetworkAgent.h

    r225263 r225708  
    4343    void setResourceCachingDisabled(bool) final;
    4444    ScriptExecutionContext* scriptExecutionContext(ErrorString&, const String& frameId) final;
     45    bool shouldForceBufferingNetworkResourceData() const final { return false; }
    4546
    4647    InspectorPageAgent* m_pageAgent { nullptr };
  • trunk/Source/WebCore/inspector/agents/worker/WorkerNetworkAgent.h

    r225263 r225708  
    4343    void setResourceCachingDisabled(bool) final;
    4444    ScriptExecutionContext* scriptExecutionContext(ErrorString&, const String& frameId) final;
     45    bool shouldForceBufferingNetworkResourceData() const final { return true; }
    4546
    4647    WorkerGlobalScope& m_workerGlobalScope;
Note: See TracChangeset for help on using the changeset viewer.