Changeset 88937 in webkit


Ignore:
Timestamp:
Jun 15, 2011 8:20:27 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-06-15 Vsevolod Vlasov <vsevik@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Cache XHR content in backend, do not use initialContentSet for XHRs.
https://bugs.webkit.org/show_bug.cgi?id=61205

Added inspector backend cache for XHR content.

  • http/tests/inspector/network/network-xhr-async-expected.txt: Added.
  • http/tests/inspector/network/network-xhr-async.html: Added.
  • http/tests/inspector/network/network-xhr-sync-expected.txt: Added.
  • http/tests/inspector/network/network-xhr-sync.html: Added.

2011-06-15 Vsevolod Vlasov <vsevik@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Cache XHR content in backend, do not use initialContentSet for XHRs.
https://bugs.webkit.org/show_bug.cgi?id=61205

Added inspector backend cache for XHR content.

Tests: http/tests/inspector/network/network-xhr-async.html

http/tests/inspector/network/network-xhr-sync.html

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • fileapi/FileReaderLoader.cpp: (WebCore::FileReaderLoader::didReceiveResponse):
  • fileapi/FileReaderLoader.h:
  • inspector/Inspector.json:
  • inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didReceiveXHRResponseImpl): (WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl): (WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl):
  • inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didReceiveXHRResponse): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously):
  • inspector/InspectorResourceAgent.cpp: (WebCore::InspectorResourceAgent::willSendRequest): (WebCore::InspectorResourceAgent::didReceiveResponse): (WebCore::InspectorResourceAgent::setInitialXHRContent): (WebCore::InspectorResourceAgent::didReceiveXHRResponse): (WebCore::InspectorResourceAgent::willLoadXHRSynchronously): (WebCore::InspectorResourceAgent::didLoadXHRSynchronously): (WebCore::InspectorResourceAgent::getResourceContent): (WebCore::InspectorResourceAgent::mainFrameNavigated): (WebCore::InspectorResourceAgent::InspectorResourceAgent):
  • inspector/InspectorResourceAgent.h:
  • inspector/NetworkResourcesData.cpp: Added. (WebCore::NetworkResourcesData::ResourceData::ResourceData): (WebCore::NetworkResourcesData::ResourceData::content): (WebCore::NetworkResourcesData::ResourceData::appendContent): (WebCore::NetworkResourcesData::ResourceData::purgeContent): (WebCore::NetworkResourcesData::NetworkResourcesData): (WebCore::NetworkResourcesData::~NetworkResourcesData): (WebCore::NetworkResourcesData::resourceCreated): (WebCore::NetworkResourcesData::responseReceived): (WebCore::NetworkResourcesData::didReceiveXHRResponse): (WebCore::NetworkResourcesData::addResourceContent): (WebCore::NetworkResourcesData::isXHR): (WebCore::NetworkResourcesData::data): (WebCore::NetworkResourcesData::clear): (WebCore::NetworkResourcesData::ensureFreeSpace):
  • inspector/NetworkResourcesData.h: Added. (WebCore::NetworkResourcesData::ResourceData::identifier): (WebCore::NetworkResourcesData::ResourceData::loaderId): (WebCore::NetworkResourcesData::ResourceData::frameId): (WebCore::NetworkResourcesData::ResourceData::setFrameId): (WebCore::NetworkResourcesData::ResourceData::url): (WebCore::NetworkResourcesData::ResourceData::setUrl): (WebCore::NetworkResourcesData::ResourceData::isXHR): (WebCore::NetworkResourcesData::ResourceData::setIsXHR): (WebCore::NetworkResourcesData::ResourceData::hasContent): (WebCore::NetworkResourcesData::ResourceData::isContentPurged): (WebCore::NetworkResourcesData::ResourceData::setIsContentPurged):
  • inspector/front-end/NetworkManager.js: (WebInspector.NetworkManager.prototype.requestContent): (WebInspector.NetworkDispatcher.prototype._appendRedirect):
  • inspector/front-end/NetworkPanel.js: (WebInspector.NetworkPanel.prototype._appendResource): (WebInspector.NetworkPanel.prototype._frameNavigated):
  • loader/DocumentThreadableLoader.cpp: (WebCore::DocumentThreadableLoader::didReceiveResponse): (WebCore::DocumentThreadableLoader::receivedCancellation): (WebCore::DocumentThreadableLoader::loadRequest):
  • loader/DocumentThreadableLoader.h:
  • loader/ThreadableLoaderClient.h: (WebCore::ThreadableLoaderClient::didReceiveResponse): (WebCore::ThreadableLoaderClient::didReceiveAuthenticationCancellation):
  • loader/ThreadableLoaderClientWrapper.h: (WebCore::ThreadableLoaderClientWrapper::didReceiveResponse): (WebCore::ThreadableLoaderClientWrapper::didReceiveAuthenticationCancellation):
  • loader/WorkerThreadableLoader.cpp: (WebCore::workerContextDidReceiveResponse): (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse): (WebCore::workerContextDidReceiveAuthenticationCancellation): (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveAuthenticationCancellation):
  • loader/WorkerThreadableLoader.h:
  • notifications/Notification.cpp: (WebCore::Notification::didReceiveResponse): (WebCore::Notification::didReceiveAuthenticationCancellation):
  • notifications/Notification.h:
  • page/EventSource.cpp: (WebCore::EventSource::didReceiveResponse):
  • page/EventSource.h:
  • xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::createRequest): (WebCore::XMLHttpRequest::didReceiveResponse): (WebCore::XMLHttpRequest::didReceiveAuthenticationCancellation):
  • xml/XMLHttpRequest.h:

2011-06-15 Vsevolod Vlasov <vsevik@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Cache XHR content in backend, do not use initialContentSet for XHRs.
https://bugs.webkit.org/show_bug.cgi?id=61205

Added inspector backend cache for XHR content.

  • src/AssociatedURLLoader.cpp: (WebKit::AssociatedURLLoader::ClientAdapter::didReceiveResponse):
Location:
trunk
Files:
6 added
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r88936 r88937  
     12011-06-15  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Cache XHR content in backend, do not use initialContentSet for XHRs.
     6        https://bugs.webkit.org/show_bug.cgi?id=61205
     7
     8        Added inspector backend cache for XHR content.
     9
     10        * http/tests/inspector/network/network-xhr-async-expected.txt: Added.
     11        * http/tests/inspector/network/network-xhr-async.html: Added.
     12        * http/tests/inspector/network/network-xhr-sync-expected.txt: Added.
     13        * http/tests/inspector/network/network-xhr-sync.html: Added.
     14
    1152011-06-15  Pavel Podivilov  <podivilov@chromium.org>
    216
  • trunk/Source/WebCore/CMakeLists.txt

    r88798 r88937  
    886886    inspector/InspectorValues.cpp
    887887    inspector/InspectorWorkerAgent.cpp
     888    inspector/NetworkResourcesData.cpp
    888889    inspector/PageDebuggerAgent.cpp
    889890    inspector/ScriptArguments.cpp
  • trunk/Source/WebCore/ChangeLog

    r88936 r88937  
     12011-06-15  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Cache XHR content in backend, do not use initialContentSet for XHRs.
     6        https://bugs.webkit.org/show_bug.cgi?id=61205
     7
     8        Added inspector backend cache for XHR content.
     9
     10        Tests: http/tests/inspector/network/network-xhr-async.html
     11               http/tests/inspector/network/network-xhr-sync.html
     12
     13        * CMakeLists.txt:
     14        * GNUmakefile.list.am:
     15        * WebCore.gypi:
     16        * WebCore.pro:
     17        * WebCore.vcproj/WebCore.vcproj:
     18        * WebCore.xcodeproj/project.pbxproj:
     19        * fileapi/FileReaderLoader.cpp:
     20        (WebCore::FileReaderLoader::didReceiveResponse):
     21        * fileapi/FileReaderLoader.h:
     22        * inspector/Inspector.json:
     23        * inspector/InspectorInstrumentation.cpp:
     24        (WebCore::InspectorInstrumentation::didReceiveXHRResponseImpl):
     25        (WebCore::InspectorInstrumentation::willLoadXHRSynchronouslyImpl):
     26        (WebCore::InspectorInstrumentation::didLoadXHRSynchronouslyImpl):
     27        (WebCore::InspectorInstrumentation::didCommitLoadImpl):
     28        * inspector/InspectorInstrumentation.h:
     29        (WebCore::InspectorInstrumentation::didReceiveXHRResponse):
     30        (WebCore::InspectorInstrumentation::willLoadXHRSynchronously):
     31        (WebCore::InspectorInstrumentation::didLoadXHRSynchronously):
     32        * inspector/InspectorResourceAgent.cpp:
     33        (WebCore::InspectorResourceAgent::willSendRequest):
     34        (WebCore::InspectorResourceAgent::didReceiveResponse):
     35        (WebCore::InspectorResourceAgent::setInitialXHRContent):
     36        (WebCore::InspectorResourceAgent::didReceiveXHRResponse):
     37        (WebCore::InspectorResourceAgent::willLoadXHRSynchronously):
     38        (WebCore::InspectorResourceAgent::didLoadXHRSynchronously):
     39        (WebCore::InspectorResourceAgent::getResourceContent):
     40        (WebCore::InspectorResourceAgent::mainFrameNavigated):
     41        (WebCore::InspectorResourceAgent::InspectorResourceAgent):
     42        * inspector/InspectorResourceAgent.h:
     43        * inspector/NetworkResourcesData.cpp: Added.
     44        (WebCore::NetworkResourcesData::ResourceData::ResourceData):
     45        (WebCore::NetworkResourcesData::ResourceData::content):
     46        (WebCore::NetworkResourcesData::ResourceData::appendContent):
     47        (WebCore::NetworkResourcesData::ResourceData::purgeContent):
     48        (WebCore::NetworkResourcesData::NetworkResourcesData):
     49        (WebCore::NetworkResourcesData::~NetworkResourcesData):
     50        (WebCore::NetworkResourcesData::resourceCreated):
     51        (WebCore::NetworkResourcesData::responseReceived):
     52        (WebCore::NetworkResourcesData::didReceiveXHRResponse):
     53        (WebCore::NetworkResourcesData::addResourceContent):
     54        (WebCore::NetworkResourcesData::isXHR):
     55        (WebCore::NetworkResourcesData::data):
     56        (WebCore::NetworkResourcesData::clear):
     57        (WebCore::NetworkResourcesData::ensureFreeSpace):
     58        * inspector/NetworkResourcesData.h: Added.
     59        (WebCore::NetworkResourcesData::ResourceData::identifier):
     60        (WebCore::NetworkResourcesData::ResourceData::loaderId):
     61        (WebCore::NetworkResourcesData::ResourceData::frameId):
     62        (WebCore::NetworkResourcesData::ResourceData::setFrameId):
     63        (WebCore::NetworkResourcesData::ResourceData::url):
     64        (WebCore::NetworkResourcesData::ResourceData::setUrl):
     65        (WebCore::NetworkResourcesData::ResourceData::isXHR):
     66        (WebCore::NetworkResourcesData::ResourceData::setIsXHR):
     67        (WebCore::NetworkResourcesData::ResourceData::hasContent):
     68        (WebCore::NetworkResourcesData::ResourceData::isContentPurged):
     69        (WebCore::NetworkResourcesData::ResourceData::setIsContentPurged):
     70        * inspector/front-end/NetworkManager.js:
     71        (WebInspector.NetworkManager.prototype.requestContent):
     72        (WebInspector.NetworkDispatcher.prototype._appendRedirect):
     73        * inspector/front-end/NetworkPanel.js:
     74        (WebInspector.NetworkPanel.prototype._appendResource):
     75        (WebInspector.NetworkPanel.prototype._frameNavigated):
     76        * loader/DocumentThreadableLoader.cpp:
     77        (WebCore::DocumentThreadableLoader::didReceiveResponse):
     78        (WebCore::DocumentThreadableLoader::receivedCancellation):
     79        (WebCore::DocumentThreadableLoader::loadRequest):
     80        * loader/DocumentThreadableLoader.h:
     81        * loader/ThreadableLoaderClient.h:
     82        (WebCore::ThreadableLoaderClient::didReceiveResponse):
     83        (WebCore::ThreadableLoaderClient::didReceiveAuthenticationCancellation):
     84        * loader/ThreadableLoaderClientWrapper.h:
     85        (WebCore::ThreadableLoaderClientWrapper::didReceiveResponse):
     86        (WebCore::ThreadableLoaderClientWrapper::didReceiveAuthenticationCancellation):
     87        * loader/WorkerThreadableLoader.cpp:
     88        (WebCore::workerContextDidReceiveResponse):
     89        (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveResponse):
     90        (WebCore::workerContextDidReceiveAuthenticationCancellation):
     91        (WebCore::WorkerThreadableLoader::MainThreadBridge::didReceiveAuthenticationCancellation):
     92        * loader/WorkerThreadableLoader.h:
     93        * notifications/Notification.cpp:
     94        (WebCore::Notification::didReceiveResponse):
     95        (WebCore::Notification::didReceiveAuthenticationCancellation):
     96        * notifications/Notification.h:
     97        * page/EventSource.cpp:
     98        (WebCore::EventSource::didReceiveResponse):
     99        * page/EventSource.h:
     100        * xml/XMLHttpRequest.cpp:
     101        (WebCore::XMLHttpRequest::createRequest):
     102        (WebCore::XMLHttpRequest::didReceiveResponse):
     103        (WebCore::XMLHttpRequest::didReceiveAuthenticationCancellation):
     104        * xml/XMLHttpRequest.h:
     105
    11062011-06-15  Pavel Podivilov  <podivilov@chromium.org>
    2107
  • trunk/Source/WebCore/GNUmakefile.list.am

    r88800 r88937  
    20102010        Source/WebCore/inspector/InspectorWorkerResource.h \
    20112011        Source/WebCore/inspector/InstrumentingAgents.h \
     2012        Source/WebCore/inspector/NetworkResourcesData.cpp \
     2013        Source/WebCore/inspector/NetworkResourcesData.h \
    20122014        Source/WebCore/inspector/PageDebuggerAgent.cpp \
    20132015        Source/WebCore/inspector/PageDebuggerAgent.h \
  • trunk/Source/WebCore/WebCore.gypi

    r88798 r88937  
    33163316            'inspector/InspectorWorkerAgent.h',
    33173317            'inspector/InstrumentingAgents.h',
     3318            'inspector/NetworkResourcesData.cpp',
     3319            'inspector/NetworkResourcesData.h',
    33183320            'inspector/PageDebuggerAgent.cpp',
    33193321            'inspector/PageDebuggerAgent.h',
  • trunk/Source/WebCore/WebCore.pro

    r88798 r88937  
    840840    inspector/InspectorValues.cpp \
    841841    inspector/InspectorWorkerAgent.cpp \
     842    inspector/NetworkResourcesData.cpp \
    842843    inspector/PageDebuggerAgent.cpp \
    843844    inspector/ScriptArguments.cpp \
     
    17891790    inspector/InspectorWorkerAgent.h \
    17901791    inspector/InstrumentingAgents.h \
     1792    inspector/NetworkResourcesData.h \
    17911793    inspector/PageDebuggerAgent.h \
    17921794    inspector/ScriptGCEventListener.h \
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r88798 r88937  
    6771567715                        </File>
    6771667716                        <File
     67717                                RelativePath="..\inspector\NetworkResourcesData.cpp"
     67718                                >
     67719                        </File>
     67720                        <File
     67721                                RelativePath="..\inspector\NetworkResourcesData.h"
     67722                                >
     67723                        </File>
     67724                        <File
    6771767725                                RelativePath="..\inspector\PageDebuggerAgent.cpp"
    6771867726                                >
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r88905 r88937  
    14501450                59B5977511086579007159E8 /* BridgeJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59B5977411086579007159E8 /* BridgeJSC.h */; settings = {ATTRIBUTES = (Private, ); }; };
    14511451                59BC393F11054A1300FD85DB /* JavaStringJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59BC393E11054A1300FD85DB /* JavaStringJSC.h */; };
     1452                59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */; };
     1453                59C27F07138D28CF0079B7E2 /* NetworkResourcesData.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */; };
    14521454                59D1C10411EB5DCF00B638C8 /* DeviceOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59D1C10311EB5DCF00B638C8 /* DeviceOrientation.cpp */; };
    14531455                59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E560A61105336600AA1258 /* JavaClassJSC.h */; };
     
    79337935                59B5977411086579007159E8 /* BridgeJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BridgeJSC.h; path = bridge/jsc/BridgeJSC.h; sourceTree = "<group>"; };
    79347936                59BC393E11054A1300FD85DB /* JavaStringJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaStringJSC.h; path = jsc/JavaStringJSC.h; sourceTree = "<group>"; };
     7937                59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkResourcesData.cpp; sourceTree = "<group>"; };
     7938                59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkResourcesData.h; sourceTree = "<group>"; };
    79357939                59D1C10311EB5DCF00B638C8 /* DeviceOrientation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientation.cpp; sourceTree = "<group>"; };
    79367940                59E560A61105336600AA1258 /* JavaClassJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaClassJSC.h; path = jsc/JavaClassJSC.h; sourceTree = "<group>"; };
     
    1330213306                                1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
    1330313307                                BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
     13308                                59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */,
     13309                                59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */,
    1330413310                                F34742DA134362F000531BC2 /* PageDebuggerAgent.cpp */,
    1330513311                                F34742DB134362F000531BC2 /* PageDebuggerAgent.h */,
     
    2194921955                                656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */,
    2195021956                                628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */,
     21957                                59C27F07138D28CF0079B7E2 /* NetworkResourcesData.h in Headers */,
    2195121958                                1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */,
    2195221959                                BCEF43DD0E674012001C1287 /* NinePieceImage.h in Headers */,
     
    2490224909                                E12719CA0EEEC21300F61213 /* NavigatorBase.cpp in Sources */,
    2490324910                                5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */,
     24911                                59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */,
    2490424912                                1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */,
    2490524913                                1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */,
  • trunk/Source/WebCore/fileapi/FileReaderLoader.cpp

    r84260 r88937  
    124124}
    125125
    126 void FileReaderLoader::didReceiveResponse(const ResourceResponse& response)
     126void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse& response)
    127127{
    128128    if (response.httpStatusCode() != 200) {
  • trunk/Source/WebCore/fileapi/FileReaderLoader.h

    r78782 r88937  
    6767
    6868    // ThreadableLoaderClient
    69     virtual void didReceiveResponse(const ResourceResponse&);
     69    virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
    7070    virtual void didReceiveData(const char*, int);
    7171    virtual void didFinishLoading(unsigned long, double);
  • trunk/Source/WebCore/inspector/Inspector.json

    r88331 r88937  
    486486                    { "name": "enabled", "type": "boolean" }
    487487                ]
     488            },
     489            {
     490                "name": "getResourceContent",
     491                "description": "Returns content of the given resource.",
     492                "parameters": [
     493                    { "name": "identifier", "type": "number", "description": "Identifier of the resource to get content for." },
     494                    { "name": "base64Encode", "type": "boolean", "optional": true, "description": "Requests that resource content is served as base64." }
     495                ],
     496                "returns": [
     497                    { "name": "content", "type": "string", "description": "Resource content." }
     498                ]
    488499            }
    489500        ],
     
    561572            {
    562573                "name": "initialContentSet",
    563                 "description": "Fired for XMLHttpRequests when their content becomes available.",
     574                "description": "Fired for worker scripts when their content becomes available.",
    564575                "parameters": [
    565576                    { "name": "identifier", "type": "integer", "description": "Request identifier." },
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp

    r87992 r88937  
    517517}
    518518
     519void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
     520{
     521    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
     522        resourceAgent->didReceiveXHRResponse(identifier);
     523}
     524
     525void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
     526{
     527    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
     528        resourceAgent->willLoadXHRSynchronously();
     529}
     530
     531void InspectorInstrumentation::didLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
     532{
     533    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
     534        resourceAgent->didLoadXHRSynchronously();
     535}
     536
    519537void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& sourceString)
    520538{
     
    578596        if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
    579597            consoleAgent->reset();
     598
     599        if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
     600            resourceAgent->mainFrameNavigated(loader);
     601
    580602#if ENABLE(JAVASCRIPT_DEBUGGER)
    581603        if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
  • trunk/Source/WebCore/inspector/InspectorInstrumentation.h

    r87992 r88937  
    129129    static void didFailLoading(Frame*, unsigned long identifier, const ResourceError&);
    130130    static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
     131    static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
     132    static void willLoadXHRSynchronously(ScriptExecutionContext*);
     133    static void didLoadXHRSynchronously(ScriptExecutionContext*);
    131134    static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
    132135    static void domContentLoadedEventFired(Frame*, const KURL&);
     
    253256    static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, const ResourceError&);
    254257    static void resourceRetrievedByXMLHttpRequestImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
     258    static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
     259    static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
     260    static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
    255261    static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
    256262    static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*, const KURL&);
     
    776782    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
    777783        resourceRetrievedByXMLHttpRequestImpl(instrumentingAgents, identifier, sourceString, url, sendURL, sendLineNumber);
     784#endif
     785}
     786
     787inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
     788{
     789#if ENABLE(INSPECTOR)
     790    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
     791        didReceiveXHRResponseImpl(instrumentingAgents, identifier);
     792#endif
     793}
     794
     795inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
     796{
     797#if ENABLE(INSPECTOR)
     798    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
     799        willLoadXHRSynchronouslyImpl(instrumentingAgents);
     800#endif
     801}
     802
     803inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
     804{
     805#if ENABLE(INSPECTOR)
     806    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
     807        didLoadXHRSynchronouslyImpl(instrumentingAgents);
    778808#endif
    779809}
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp

    r88682 r88937  
    4949#include "InstrumentingAgents.h"
    5050#include "KURL.h"
     51#include "NetworkResourcesData.h"
    5152#include "ProgressTracker.h"
    5253#include "ResourceError.h"
     
    195196void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
    196197{
     198    m_resourcesData->resourceCreated(identifier, m_pageAgent->loaderId(loader));
     199
    197200    RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders);
    198201
     
    242245        else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == InspectorPageAgent::OtherResource)
    243246            type = InspectorPageAgent::DocumentResource;
    244     }
     247        else if (m_loadingXHRSynchronously || m_resourcesData->isXHR(identifier))
     248            type = InspectorPageAgent::XHRResource;
     249
     250        m_resourcesData->responseReceived(identifier, m_pageAgent->frameId(loader->frame()), response.url());
     251    }
     252
    245253    m_frontend->responseReceived(static_cast<int>(identifier), currentTime(), InspectorPageAgent::resourceTypeString(type), resourceResponse);
    246254    // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
     
    280288void InspectorResourceAgent::setInitialXHRContent(unsigned long identifier, const String& sourceString)
    281289{
    282     m_frontend->initialContentSet(static_cast<int>(identifier), sourceString, InspectorPageAgent::resourceTypeString(InspectorPageAgent::XHRResource));
     290    m_resourcesData->addResourceContent(identifier, sourceString);
     291}
     292
     293void InspectorResourceAgent::didReceiveXHRResponse(unsigned long identifier)
     294{
     295    m_resourcesData->didReceiveXHRResponse(identifier);
     296}
     297
     298void InspectorResourceAgent::willLoadXHRSynchronously()
     299{
     300    m_loadingXHRSynchronously = true;
     301}
     302
     303void InspectorResourceAgent::didLoadXHRSynchronously()
     304{
     305    m_loadingXHRSynchronously = false;
    283306}
    284307
     
    403426}
    404427
     428void InspectorResourceAgent::getResourceContent(ErrorString* errorString, int identifier, const bool* const optionalBase64Encode, String* content)
     429{
     430    NetworkResourcesData::ResourceData* resourceData = m_resourcesData->data(identifier);
     431    if (!resourceData) {
     432        *errorString = "No resource with given identifier found";
     433        return;
     434    }
     435
     436    if (resourceData->hasContent())
     437        *content = resourceData->content();
     438    else if (!resourceData->frameId().isNull() && !resourceData->url().isNull())
     439        m_pageAgent->getResourceContent(errorString, resourceData->frameId(), resourceData->url(), optionalBase64Encode, content);
     440    else
     441        *errorString = "No data found for resource with given identifier";
     442}
     443
     444void InspectorResourceAgent::mainFrameNavigated(DocumentLoader* loader)
     445{
     446    m_resourcesData->clear(m_pageAgent->loaderId(loader));
     447}
     448
    405449InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* state)
    406450    : m_instrumentingAgents(instrumentingAgents)
    407451    , m_pageAgent(pageAgent)
    408452    , m_state(state)
     453    , m_resourcesData(adoptPtr(new NetworkResourcesData()))
     454    , m_loadingXHRSynchronously(false)
    409455{
    410456    if (isBackgroundEventsCollectionEnabled()) {
  • trunk/Source/WebCore/inspector/InspectorResourceAgent.h

    r86959 r88937  
    3535#include "PlatformString.h"
    3636
    37 #include <wtf/OwnPtr.h>
    3837#include <wtf/PassRefPtr.h>
    3938#include <wtf/Vector.h>
     
    5049class Document;
    5150class DocumentLoader;
     51class EventsCollector;
    5252class Frame;
    5353class InspectorArray;
     
    5959class InstrumentingAgents;
    6060class KURL;
    61 class EventsCollector;
     61class NetworkResourcesData;
    6262class Page;
    6363class ResourceError;
     
    9595    void didFailLoading(unsigned long identifier, const ResourceError&);
    9696    void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
     97    void mainFrameNavigated(DocumentLoader*);
    9798    void setInitialScriptContent(unsigned long identifier, const String& sourceString);
    9899    void setInitialXHRContent(unsigned long identifier, const String& sourceString);
     100    void didReceiveXHRResponse(unsigned long identifier);
     101    void willLoadXHRSynchronously();
     102    void didLoadXHRSynchronously();
     103
    99104    void applyUserAgentOverride(String* userAgent);
    100105
     
    114119    void setUserAgentOverride(ErrorString*, const String& userAgent);
    115120    void setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject>);
    116 
     121    void getResourceContent(ErrorString*, int identifier, const bool* const base64Encode, String* content);
     122    void clearCache(ErrorString*, const String* const optionalPreservedLoaderId);
    117123
    118124private:
     
    131137    OwnPtr<InspectorFrontend::Network> m_mockFrontend;
    132138    String m_userAgentOverride;
     139    OwnPtr<NetworkResourcesData> m_resourcesData;
     140    bool m_loadingXHRSynchronously;
    133141};
    134142
  • trunk/Source/WebCore/inspector/front-end/NetworkManager.js

    r87681 r88937  
    4949            callback(!error ? content : null);
    5050        }
    51         PageAgent.getResourceContent(resource.frameId, resource.url, base64Encode, callbackWrapper);
     51        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=61363 We should separate NetworkResource (NetworkPanel resource)
     52        // from ResourceRevision (ResourcesPanel/ScriptsPanel resource) and request content accordingly.
     53        if (resource.identifier)
     54            NetworkAgent.getResourceContent(resource.identifier, base64Encode, callbackWrapper);
     55        else
     56            PageAgent.getResourceContent(resource.frameId, resource.url, base64Encode, callbackWrapper);
    5257    },
    5358
     
    264269        var originalResource = this._inflightResourcesById[identifier];
    265270        var previousRedirects = originalResource.redirects || [];
    266         originalResource.identifier = "redirected:" + identifier + "." + previousRedirects.length;
     271        delete originalResource.identifier;
    267272        delete originalResource.redirects;
    268273        this._finishResource(originalResource, time);
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r88927 r88937  
    742742    {
    743743        this._resources.push(resource);
    744         this._resourcesById[resource.identifier] = resource;
     744        if (resource.identifier)
     745            this._resourcesById[resource.identifier] = resource;
    745746        this._resourcesByURL[resource.url] = resource;
    746747
     
    779780        var loaderId = event.data.loaderId;
    780781        // Main frame committed load.
    781         if (this._preserveLogToggle.toggled)
     782        if (this._preserveLogToggle.toggled) {
     783            for (var i = 0; i < this._resources.length; ++i) {
     784                var resource = this._resources[i];
     785                if (resource.loaderId !== loaderId)
     786                    resource.identifier = null;
     787            }
    782788            return;
     789        }
    783790
    784791        // Preserve provisional load resources.
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.cpp

    r87423 r88937  
    172172void DocumentThreadableLoader::didReceiveResponse(SubresourceLoader* loader, const ResourceResponse& response)
    173173{
    174     ASSERT(m_client);
    175     ASSERT_UNUSED(loader, loader == m_loader);
     174    ASSERT(loader == m_loader);
     175    didReceiveResponse(loader->identifier(), response);
     176}
     177
     178void DocumentThreadableLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
     179{
     180    ASSERT(m_client);
    176181
    177182    String accessControlErrorDescription;
     
    199204        }
    200205
    201         m_client->didReceiveResponse(response);
     206        m_client->didReceiveResponse(identifier, response);
    202207    }
    203208}
     
    286291    ASSERT(m_client);
    287292    ASSERT_UNUSED(loader, loader == m_loader);
    288     m_client->didReceiveAuthenticationCancellation(challenge.failureResponse());
     293    m_client->didReceiveAuthenticationCancellation(loader->identifier(), challenge.failureResponse());
    289294}
    290295
     
    352357    }
    353358
    354     didReceiveResponse(0, response);
     359    didReceiveResponse(identifier, response);
    355360
    356361    const char* bytes = static_cast<const char*>(data.data());
  • trunk/Source/WebCore/loader/DocumentThreadableLoader.h

    r87423 r88937  
    8787        virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&);
    8888
     89        void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
    8990        void didFinishLoading(unsigned long identifier, double finishTime);
    9091        void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request);
  • trunk/Source/WebCore/loader/ThreadableLoaderClient.h

    r79110 r88937  
    4343        virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
    4444
    45         virtual void didReceiveResponse(const ResourceResponse&) { }
     45        virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&) { }
    4646        virtual void didReceiveData(const char*, int /*dataLength*/) { }
    4747        virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) { }
     
    5050        virtual void didFailRedirectCheck() { }
    5151
    52         virtual void didReceiveAuthenticationCancellation(const ResourceResponse&) { }
     52        virtual void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse&) { }
    5353
    5454        virtual bool isDocumentThreadableLoaderClient() { return false; }
  • trunk/Source/WebCore/loader/ThreadableLoaderClientWrapper.h

    r81567 r88937  
    6363    }
    6464
    65     void didReceiveResponse(const ResourceResponse& response)
     65    void didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
    6666    {
    6767        if (m_client)
    68             m_client->didReceiveResponse(response);
     68            m_client->didReceiveResponse(identifier, response);
    6969    }
    7070
     
    102102    }
    103103
    104     void didReceiveAuthenticationCancellation(const ResourceResponse& response)
     104    void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse& response)
    105105    {
    106106        if (m_client)
    107             m_client->didReceiveResponse(response);
     107            m_client->didReceiveResponse(identifier, response);
    108108    }
    109109
  • trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp

    r85165 r88937  
    178178}
    179179
    180 static void workerContextDidReceiveResponse(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<CrossThreadResourceResponseData> responseData)
     180static void workerContextDidReceiveResponse(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData)
    181181{
    182182    ASSERT_UNUSED(context, context->isWorkerContext());
    183183    OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData));
    184     workerClientWrapper->didReceiveResponse(*response);
    185 }
    186 
    187 void WorkerThreadableLoader::MainThreadBridge::didReceiveResponse(const ResourceResponse& response)
    188 {
    189     m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveResponse, m_workerClientWrapper, response), m_taskMode);
     184    workerClientWrapper->didReceiveResponse(identifier, *response);
     185}
     186
     187void WorkerThreadableLoader::MainThreadBridge::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
     188{
     189    m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveResponse, m_workerClientWrapper, identifier, response), m_taskMode);
    190190}
    191191
     
    249249}
    250250
    251 static void workerContextDidReceiveAuthenticationCancellation(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<CrossThreadResourceResponseData> responseData)
     251static void workerContextDidReceiveAuthenticationCancellation(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData)
    252252{
    253253    ASSERT_UNUSED(context, context->isWorkerContext());
    254254    OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData));
    255     workerClientWrapper->didReceiveAuthenticationCancellation(*response);
    256 }
    257 
    258 void WorkerThreadableLoader::MainThreadBridge::didReceiveAuthenticationCancellation(const ResourceResponse& response)
    259 {
    260     m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveAuthenticationCancellation, m_workerClientWrapper, response), m_taskMode);
     255    workerClientWrapper->didReceiveAuthenticationCancellation(identifier, *response);
     256}
     257
     258void WorkerThreadableLoader::MainThreadBridge::didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse& response)
     259{
     260    m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveAuthenticationCancellation, m_workerClientWrapper, identifier, response), m_taskMode);
    261261}
    262262
  • trunk/Source/WebCore/loader/WorkerThreadableLoader.h

    r81639 r88937  
    114114            static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*);
    115115            virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
    116             virtual void didReceiveResponse(const ResourceResponse&);
     116            virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
    117117            virtual void didReceiveData(const char*, int dataLength);
    118118            virtual void didReceiveCachedMetadata(const char*, int dataLength);
     
    120120            virtual void didFail(const ResourceError&);
    121121            virtual void didFailRedirectCheck();
    122             virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
     122            virtual void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse&);
    123123
    124124            // Only to be used on the main thread.
  • trunk/Source/WebCore/notifications/Notification.cpp

    r86325 r88937  
    182182}
    183183
    184 void Notification::didReceiveResponse(const ResourceResponse& response)
     184void Notification::didReceiveResponse(unsigned long, const ResourceResponse& response)
    185185{
    186186    int status = response.httpStatusCode();
     
    212212}
    213213
    214 void Notification::didReceiveAuthenticationCancellation(const ResourceResponse&)
     214void Notification::didReceiveAuthenticationCancellation(unsigned long, const ResourceResponse&)
    215215{
    216216    finishLoading();
  • trunk/Source/WebCore/notifications/Notification.h

    r86325 r88937  
    103103        void detachPresenter() { }
    104104
    105         virtual void didReceiveResponse(const ResourceResponse&);
     105        virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
    106106        virtual void didReceiveData(const char* data, int dataLength);
    107107        virtual void didFinishLoading(unsigned long identifier, double finishTime);
    108108        virtual void didFail(const ResourceError&);
    109109        virtual void didFailRedirectCheck();
    110         virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
     110        virtual void didReceiveAuthenticationCancellation(unsigned long, const ResourceResponse&);
    111111
    112112    private:
  • trunk/Source/WebCore/page/EventSource.cpp

    r86135 r88937  
    182182}
    183183
    184 void EventSource::didReceiveResponse(const ResourceResponse& response)
     184void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response)
    185185{
    186186    int statusCode = response.httpStatusCode();
  • trunk/Source/WebCore/page/EventSource.h

    r78782 r88937  
    9191        virtual EventTargetData* ensureEventTargetData();
    9292
    93         virtual void didReceiveResponse(const ResourceResponse&);
     93        virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
    9494        virtual void didReceiveData(const char*, int);
    9595        virtual void didFinishLoading(unsigned long, double);
  • trunk/Source/WebCore/xml/XMLHttpRequest.cpp

    r87423 r88937  
    673673            setPendingActivity(this);
    674674        }
    675     } else
     675    } else {
     676        InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
    676677        ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options);
     678        InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext());
     679    }
    677680
    678681    if (!m_exceptionCode && m_error)
     
    10331036}
    10341037
    1035 void XMLHttpRequest::didReceiveResponse(const ResourceResponse& response)
    1036 {
     1038void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
     1039{
     1040    InspectorInstrumentation::didReceiveXHRResponse(scriptExecutionContext(), identifier);
     1041
    10371042    m_response = response;
    10381043    m_responseEncoding = extractCharsetFromMediaType(m_mimeTypeOverride);
     
    10411046}
    10421047
    1043 void XMLHttpRequest::didReceiveAuthenticationCancellation(const ResourceResponse& failureResponse)
     1048void XMLHttpRequest::didReceiveAuthenticationCancellation(unsigned long, const ResourceResponse& failureResponse)
    10441049{
    10451050    m_response = failureResponse;
  • trunk/Source/WebCore/xml/XMLHttpRequest.h

    r87423 r88937  
    151151
    152152    virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
    153     virtual void didReceiveResponse(const ResourceResponse&);
     153    virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
    154154    virtual void didReceiveData(const char* data, int dataLength);
    155155    virtual void didFinishLoading(unsigned long identifier, double finishTime);
    156156    virtual void didFail(const ResourceError&);
    157157    virtual void didFailRedirectCheck();
    158     virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
     158    virtual void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse&);
    159159
    160160    String responseMIMEType() const;
  • trunk/Source/WebKit/chromium/ChangeLog

    r88922 r88937  
     12011-06-15  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Web Inspector: Cache XHR content in backend, do not use initialContentSet for XHRs.
     6        https://bugs.webkit.org/show_bug.cgi?id=61205
     7
     8        Added inspector backend cache for XHR content.
     9
     10        * src/AssociatedURLLoader.cpp:
     11        (WebKit::AssociatedURLLoader::ClientAdapter::didReceiveResponse):
     12
    1132011-06-15  Pavel Feldman  <pfeldman@chromium.org>
    214
  • trunk/Source/WebKit/chromium/src/AssociatedURLLoader.cpp

    r88523 r88937  
    6161    virtual void willSendRequest(ResourceRequest& /*newRequest*/, const ResourceResponse& /*redirectResponse*/);
    6262
    63     virtual void didReceiveResponse(const ResourceResponse&);
     63    virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
    6464    virtual void didReceiveData(const char*, int /*dataLength*/);
    6565    virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/);
     
    114114}
    115115
    116 void AssociatedURLLoader::ClientAdapter::didReceiveResponse(const ResourceResponse& response)
     116void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response)
    117117{
    118118    WrappedResourceResponse wrappedResponse(response);
Note: See TracChangeset for help on using the changeset viewer.