2011-06-16 Vsevolod Vlasov <vsevik@chromium.org>
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Jun 2011 14:14:05 +0000 (14:14 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Jun 2011 14:14:05 +0000 (14:14 +0000)
        Reviewed by Yury Semikhatsky.

        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-16  Vsevolod Vlasov  <vsevik@chromium.org>

        Reviewed by Yury Semikhatsky.

        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:
        * workers/WorkerScriptLoader.cpp:
        (WebCore::WorkerScriptLoader::didReceiveResponse):
        (WebCore::WorkerScriptLoader::didReceiveAuthenticationCancellation):
        * workers/WorkerScriptLoader.h:
        * xml/XMLHttpRequest.cpp:
        (WebCore::XMLHttpRequest::createRequest):
        (WebCore::XMLHttpRequest::didReceiveResponse):
        (WebCore::XMLHttpRequest::didReceiveAuthenticationCancellation):
        * xml/XMLHttpRequest.h:
2011-06-16  Vsevolod Vlasov  <vsevik@chromium.org>

        Reviewed by Yury Semikhatsky.

        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):

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

39 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/inspector/network/network-xhr-async-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-xhr-async.html [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-xhr-sync-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/inspector/network/network-xhr-sync.html [new file with mode: 0644]
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/WebCore.gypi
Source/WebCore/WebCore.pro
Source/WebCore/WebCore.vcproj/WebCore.vcproj
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/fileapi/FileReaderLoader.cpp
Source/WebCore/fileapi/FileReaderLoader.h
Source/WebCore/inspector/Inspector.json
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InspectorInstrumentation.h
Source/WebCore/inspector/InspectorResourceAgent.cpp
Source/WebCore/inspector/InspectorResourceAgent.h
Source/WebCore/inspector/NetworkResourcesData.cpp [new file with mode: 0644]
Source/WebCore/inspector/NetworkResourcesData.h [new file with mode: 0644]
Source/WebCore/inspector/front-end/NetworkManager.js
Source/WebCore/inspector/front-end/NetworkPanel.js
Source/WebCore/loader/DocumentThreadableLoader.cpp
Source/WebCore/loader/DocumentThreadableLoader.h
Source/WebCore/loader/ThreadableLoaderClient.h
Source/WebCore/loader/ThreadableLoaderClientWrapper.h
Source/WebCore/loader/WorkerThreadableLoader.cpp
Source/WebCore/loader/WorkerThreadableLoader.h
Source/WebCore/notifications/Notification.cpp
Source/WebCore/notifications/Notification.h
Source/WebCore/page/EventSource.cpp
Source/WebCore/page/EventSource.h
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/WorkerScriptLoader.h
Source/WebCore/xml/XMLHttpRequest.cpp
Source/WebCore/xml/XMLHttpRequest.h
Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/src/AssociatedURLLoader.cpp

index 7751053..d5cc823 100644 (file)
@@ -1,3 +1,17 @@
+2011-06-16  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        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-16  Florian Schneider  <fschneider@chromium.org>
 
         Unreviewed.
diff --git a/LayoutTests/http/tests/inspector/network/network-xhr-async-expected.txt b/LayoutTests/http/tests/inspector/network/network-xhr-async-expected.txt
new file mode 100644 (file)
index 0000000..45e5551
--- /dev/null
@@ -0,0 +1,8 @@
+CONSOLE MESSAGE: line 13: Done.
+Tests XHR network resource type and content for asynchronous requests. Bug 61205
+
+http://127.0.0.1:8000/inspector/network/resources/resource.php
+resource.type: 5
+resource.content before requesting content: undefined
+resource.content after requesting content: Hello world
+
diff --git a/LayoutTests/http/tests/inspector/network/network-xhr-async.html b/LayoutTests/http/tests/inspector/network/network-xhr-async.html
new file mode 100644 (file)
index 0000000..32621cb
--- /dev/null
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../network-test.js"></script>
+<script>
+function loadData()
+{
+    doXHR("GET", "resources/resource.php", true, resourceLoaded);
+}
+
+function resourceLoaded()
+{
+    console.log("Done.");
+}
+
+function test()
+{
+    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.evaluateInPage("loadData()");
+
+    function step2()
+    {
+        var resource1 = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
+        InspectorTest.addResult(resource1.url);
+        InspectorTest.addResult("resource.type: " + resource1.type);
+        InspectorTest.addResult("resource.content before requesting content: " + resource1.content);
+        resource1.requestContent(step3);
+    }
+
+    function step3()
+    {
+        var resource1 = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
+        InspectorTest.addResult("resource.content after requesting content: " + resource1.content);
+
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body onload="runTest()">
+ <p>
+ Tests XHR network resource type and content for asynchronous requests.
+<a href="https://bugs.webkit.org/show_bug.cgi?id=61205">Bug 61205</a>
+</p>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/inspector/network/network-xhr-sync-expected.txt b/LayoutTests/http/tests/inspector/network/network-xhr-sync-expected.txt
new file mode 100644 (file)
index 0000000..344347c
--- /dev/null
@@ -0,0 +1,8 @@
+CONSOLE MESSAGE: line 13: Done.
+Tests XHR network resource type and content for synchronous requests. Bug 61205
+
+http://127.0.0.1:8000/inspector/network/resources/resource.php
+resource.type: 5
+resource.content before requesting content: undefined
+resource.content after requesting content: Hello world
+
diff --git a/LayoutTests/http/tests/inspector/network/network-xhr-sync.html b/LayoutTests/http/tests/inspector/network/network-xhr-sync.html
new file mode 100644 (file)
index 0000000..8f2480e
--- /dev/null
@@ -0,0 +1,46 @@
+<html>
+<head>
+<script src="../inspector-test.js"></script>
+<script src="../network-test.js"></script>
+<script>
+function loadData()
+{
+    doXHR("GET", "resources/resource.php", false, resourceLoaded);
+}
+
+function resourceLoaded()
+{
+    console.log("Done.");
+}
+
+function test()
+{
+    InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
+    InspectorTest.evaluateInPage("loadData()");
+
+    function step2()
+    {
+        var resource1 = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
+        InspectorTest.addResult(resource1.url);
+        InspectorTest.addResult("resource.type: " + resource1.type);
+        InspectorTest.addResult("resource.content before requesting content: " + resource1.content);
+        resource1.requestContent(step3);
+    }
+
+    function step3()
+    {
+        var resource1 = WebInspector.panels.network.resources[WebInspector.panels.network.resources.length - 1];
+        InspectorTest.addResult("resource.content after requesting content: " + resource1.content);
+
+        InspectorTest.completeTest();
+    }
+}
+</script>
+</head>
+<body onload="runTest()">
+ <p>
+ Tests XHR network resource type and content for synchronous requests.
+<a href="https://bugs.webkit.org/show_bug.cgi?id=61205">Bug 61205</a>
+</p>
+</body>
+</html>
index 95e9f71..c857992 100644 (file)
@@ -885,6 +885,7 @@ SET(WebCore_SOURCES
     inspector/InspectorTimelineAgent.cpp
     inspector/InspectorValues.cpp
     inspector/InspectorWorkerAgent.cpp
+    inspector/NetworkResourcesData.cpp
     inspector/PageDebuggerAgent.cpp
     inspector/ScriptArguments.cpp
     inspector/ScriptCallFrame.cpp
index 955cb26..5a3dcf2 100644 (file)
@@ -1,3 +1,112 @@
+2011-06-16  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        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:
+        * workers/WorkerScriptLoader.cpp:
+        (WebCore::WorkerScriptLoader::didReceiveResponse):
+        (WebCore::WorkerScriptLoader::didReceiveAuthenticationCancellation):
+        * workers/WorkerScriptLoader.h:
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::createRequest):
+        (WebCore::XMLHttpRequest::didReceiveResponse):
+        (WebCore::XMLHttpRequest::didReceiveAuthenticationCancellation):
+        * xml/XMLHttpRequest.h:
+
 2011-06-16  Hayato Ito  <hayato@chromium.org>
 
         Reviewed by Hajime Morita.
index 5373983..ef1fadc 100644 (file)
@@ -2009,6 +2009,8 @@ webcore_sources += \
        Source/WebCore/inspector/InspectorWorkerAgent.h \
        Source/WebCore/inspector/InspectorWorkerResource.h \
        Source/WebCore/inspector/InstrumentingAgents.h \
+       Source/WebCore/inspector/NetworkResourcesData.cpp \
+       Source/WebCore/inspector/NetworkResourcesData.h \
        Source/WebCore/inspector/PageDebuggerAgent.cpp \
        Source/WebCore/inspector/PageDebuggerAgent.h \
        Source/WebCore/inspector/ScriptArguments.cpp \
index c2a9a21..a505843 100644 (file)
             'inspector/InspectorWorkerAgent.cpp',
             'inspector/InspectorWorkerAgent.h',
             'inspector/InstrumentingAgents.h',
+            'inspector/NetworkResourcesData.cpp',
+            'inspector/NetworkResourcesData.h',
             'inspector/PageDebuggerAgent.cpp',
             'inspector/PageDebuggerAgent.h',
             'inspector/ScriptArguments.cpp',
index 098828c..9b37983 100644 (file)
@@ -839,6 +839,7 @@ SOURCES += \
     inspector/InspectorTimelineAgent.cpp \
     inspector/InspectorValues.cpp \
     inspector/InspectorWorkerAgent.cpp \
+    inspector/NetworkResourcesData.cpp \
     inspector/PageDebuggerAgent.cpp \
     inspector/ScriptArguments.cpp \
     inspector/ScriptCallFrame.cpp \
@@ -1788,6 +1789,7 @@ HEADERS += \
     inspector/InspectorTimelineAgent.h \
     inspector/InspectorWorkerAgent.h \
     inspector/InstrumentingAgents.h \
+    inspector/NetworkResourcesData.h \
     inspector/PageDebuggerAgent.h \
     inspector/ScriptGCEventListener.h \
     inspector/TimelineRecordFactory.h \
index 95a60a1..f17900b 100755 (executable)
                                >
                        </File>
                        <File
+                               RelativePath="..\inspector\NetworkResourcesData.cpp"
+                               >
+                       </File>
+                       <File
+                               RelativePath="..\inspector\NetworkResourcesData.h"
+                               >
+                       </File>
+                       <File
                                RelativePath="..\inspector\PageDebuggerAgent.cpp"
                                >
                        </File>
index ba1d489..7282252 100644 (file)
                59B597731108656B007159E8 /* BridgeJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59B597721108656B007159E8 /* BridgeJSC.cpp */; };
                59B5977511086579007159E8 /* BridgeJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59B5977411086579007159E8 /* BridgeJSC.h */; settings = {ATTRIBUTES = (Private, ); }; };
                59BC393F11054A1300FD85DB /* JavaStringJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59BC393E11054A1300FD85DB /* JavaStringJSC.h */; };
+               59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */; };
+               59C27F07138D28CF0079B7E2 /* NetworkResourcesData.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */; };
                59D1C10411EB5DCF00B638C8 /* DeviceOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59D1C10311EB5DCF00B638C8 /* DeviceOrientation.cpp */; };
                59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E560A61105336600AA1258 /* JavaClassJSC.h */; };
                59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59E560A81105336F00AA1258 /* JavaClassJSC.cpp */; };
                59B597721108656B007159E8 /* BridgeJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BridgeJSC.cpp; path = bridge/jsc/BridgeJSC.cpp; sourceTree = "<group>"; };
                59B5977411086579007159E8 /* BridgeJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BridgeJSC.h; path = bridge/jsc/BridgeJSC.h; sourceTree = "<group>"; };
                59BC393E11054A1300FD85DB /* JavaStringJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaStringJSC.h; path = jsc/JavaStringJSC.h; sourceTree = "<group>"; };
+               59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkResourcesData.cpp; sourceTree = "<group>"; };
+               59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkResourcesData.h; sourceTree = "<group>"; };
                59D1C10311EB5DCF00B638C8 /* DeviceOrientation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DeviceOrientation.cpp; sourceTree = "<group>"; };
                59E560A61105336600AA1258 /* JavaClassJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaClassJSC.h; path = jsc/JavaClassJSC.h; sourceTree = "<group>"; };
                59E560A81105336F00AA1258 /* JavaClassJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaClassJSC.cpp; path = jsc/JavaClassJSC.cpp; sourceTree = "<group>"; };
                                F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */,
                                1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
                                BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
+                               59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */,
+                               59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */,
                                F34742DA134362F000531BC2 /* PageDebuggerAgent.cpp */,
                                F34742DB134362F000531BC2 /* PageDebuggerAgent.h */,
                                F39BE95912673BF400E0A674 /* ScriptArguments.cpp */,
                                8A309C9F123950BE00CB9204 /* NestingLevelIncrementer.h in Headers */,
                                656D37430ADBA5DE00A4554D /* NetscapePlugInStreamLoader.h in Headers */,
                                628D214C12131ED10055DCFC /* NetworkingContext.h in Headers */,
+                               59C27F07138D28CF0079B7E2 /* NetworkResourcesData.h in Headers */,
                                1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */,
                                BCEF43DD0E674012001C1287 /* NinePieceImage.h in Headers */,
                                14115B5209F84B7100CA4FC1 /* Node.h in Headers */,
                                A9C6E5A50D746458006442E9 /* Navigator.cpp in Sources */,
                                E12719CA0EEEC21300F61213 /* NavigatorBase.cpp in Sources */,
                                5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */,
+                               59C27F05138D28C10079B7E2 /* NetworkResourcesData.cpp in Sources */,
                                1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */,
                                1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */,
                                BCEF43E00E674110001C1287 /* NinePieceImage.cpp in Sources */,
index c9ef688..50ea0af 100644 (file)
@@ -123,7 +123,7 @@ void FileReaderLoader::cleanup()
     }
 }
 
-void FileReaderLoader::didReceiveResponse(const ResourceResponse& response)
+void FileReaderLoader::didReceiveResponse(unsigned long, const ResourceResponse& response)
 {
     if (response.httpStatusCode() != 200) {
         failed(httpStatusCodeToErrorCode(response.httpStatusCode()));
index 7e3f442..f699eb3 100644 (file)
@@ -66,7 +66,7 @@ public:
     void cancel();
 
     // ThreadableLoaderClient
-    virtual void didReceiveResponse(const ResourceResponse&);
+    virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
     virtual void didReceiveData(const char*, int);
     virtual void didFinishLoading(unsigned long, double);
     virtual void didFail(const ResourceError&);
index 73a0f96..c94efed 100644 (file)
                 "returns": [
                     { "name": "enabled", "type": "boolean" }
                 ]
+            },
+            {
+                "name": "getResourceContent",
+                "description": "Returns content of the given resource.",
+                "parameters": [
+                    { "name": "identifier", "type": "integer", "description": "Identifier of the resource to get content for." },
+                    { "name": "base64Encode", "type": "boolean", "optional": true, "description": "Requests that resource content is served as base64." }
+                ],
+                "returns": [
+                    { "name": "content", "type": "string", "description": "Resource content." }
+                ]
             }
         ],
         "events": [
             },
             {
                 "name": "initialContentSet",
-                "description": "Fired for XMLHttpRequests when their content becomes available.",
+                "description": "Fired for worker scripts when their content becomes available.",
                 "parameters": [
                     { "name": "identifier", "type": "integer", "description": "Request identifier." },
                     { "name": "content", "type": "string", "description": "Resource content." },
index 6c338ae..f3bb834 100644 (file)
@@ -516,6 +516,24 @@ void InspectorInstrumentation::resourceRetrievedByXMLHttpRequestImpl(Instrumenti
         resourceAgent->setInitialXHRContent(identifier, sourceString);
 }
 
+void InspectorInstrumentation::didReceiveXHRResponseImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier)
+{
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+        resourceAgent->didReceiveXHRResponse(identifier);
+}
+
+void InspectorInstrumentation::willLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
+{
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+        resourceAgent->willLoadXHRSynchronously();
+}
+
+void InspectorInstrumentation::didLoadXHRSynchronouslyImpl(InstrumentingAgents* instrumentingAgents)
+{
+    if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+        resourceAgent->didLoadXHRSynchronously();
+}
+
 void InspectorInstrumentation::scriptImportedImpl(InstrumentingAgents* instrumentingAgents, unsigned long identifier, const String& sourceString)
 {
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
@@ -577,6 +595,10 @@ void InspectorInstrumentation::didCommitLoadImpl(InstrumentingAgents* instrument
     if (loader->frame() == mainFrame) {
         if (InspectorConsoleAgent* consoleAgent = instrumentingAgents->inspectorConsoleAgent())
             consoleAgent->reset();
+
+        if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
+            resourceAgent->mainFrameNavigated(loader);
+
 #if ENABLE(JAVASCRIPT_DEBUGGER)
         if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDebuggerAgent()) {
             KURL url = inspectorAgent->inspectedURLWithoutFragment();
index e8754b7..1864ff4 100644 (file)
@@ -128,6 +128,9 @@ public:
     static void didFinishLoading(Frame*, unsigned long identifier, double finishTime);
     static void didFailLoading(Frame*, unsigned long identifier, const ResourceError&);
     static void resourceRetrievedByXMLHttpRequest(ScriptExecutionContext*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+    static void didReceiveXHRResponse(ScriptExecutionContext*, unsigned long identifier);
+    static void willLoadXHRSynchronously(ScriptExecutionContext*);
+    static void didLoadXHRSynchronously(ScriptExecutionContext*);
     static void scriptImported(ScriptExecutionContext*, unsigned long identifier, const String& sourceString);
     static void domContentLoadedEventFired(Frame*, const KURL&);
     static void loadEventFired(Frame*, const KURL&);
@@ -253,6 +256,9 @@ private:
     static void didFinishLoadingImpl(InstrumentingAgents*, unsigned long identifier, double finishTime);
     static void didFailLoadingImpl(InstrumentingAgents*, unsigned long identifier, const ResourceError&);
     static void resourceRetrievedByXMLHttpRequestImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString, const String& url, const String& sendURL, unsigned sendLineNumber);
+    static void didReceiveXHRResponseImpl(InstrumentingAgents*, unsigned long identifier);
+    static void willLoadXHRSynchronouslyImpl(InstrumentingAgents*);
+    static void didLoadXHRSynchronouslyImpl(InstrumentingAgents*);
     static void scriptImportedImpl(InstrumentingAgents*, unsigned long identifier, const String& sourceString);
     static void domContentLoadedEventFiredImpl(InstrumentingAgents*, Frame*, const KURL&);
     static void loadEventFiredImpl(InstrumentingAgents*, Frame*, const KURL&);
@@ -780,6 +786,30 @@ inline void InspectorInstrumentation::resourceRetrievedByXMLHttpRequest(ScriptEx
 #endif
 }
 
+inline void InspectorInstrumentation::didReceiveXHRResponse(ScriptExecutionContext* context, unsigned long identifier)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
+        didReceiveXHRResponseImpl(instrumentingAgents, identifier);
+#endif
+}
+
+inline void InspectorInstrumentation::willLoadXHRSynchronously(ScriptExecutionContext* context)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
+        willLoadXHRSynchronouslyImpl(instrumentingAgents);
+#endif
+}
+
+inline void InspectorInstrumentation::didLoadXHRSynchronously(ScriptExecutionContext* context)
+{
+#if ENABLE(INSPECTOR)
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForContext(context))
+        didLoadXHRSynchronouslyImpl(instrumentingAgents);
+#endif
+}
+
 inline void InspectorInstrumentation::scriptImported(ScriptExecutionContext* context, unsigned long identifier, const String& sourceString)
 {
 #if ENABLE(INSPECTOR)
index 66ba746..b680730 100644 (file)
@@ -48,6 +48,7 @@
 #include "InspectorValues.h"
 #include "InstrumentingAgents.h"
 #include "KURL.h"
+#include "NetworkResourcesData.h"
 #include "ProgressTracker.h"
 #include "ResourceError.h"
 #include "ResourceRequest.h"
@@ -194,6 +195,8 @@ InspectorResourceAgent::~InspectorResourceAgent()
 
 void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
 {
+    m_resourcesData->resourceCreated(identifier, m_pageAgent->loaderId(loader));
+
     RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders);
 
     if (headers) {
@@ -241,7 +244,12 @@ void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, Docume
             type = InspectorPageAgent::ImageResource;
         else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == InspectorPageAgent::OtherResource)
             type = InspectorPageAgent::DocumentResource;
+        else if (m_loadingXHRSynchronously || m_resourcesData->isXHR(identifier))
+            type = InspectorPageAgent::XHRResource;
+
+        m_resourcesData->responseReceived(identifier, m_pageAgent->frameId(loader->frame()), response.url());
     }
+
     m_frontend->responseReceived(static_cast<int>(identifier), currentTime(), InspectorPageAgent::resourceTypeString(type), resourceResponse);
     // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
     // as there will be no calls to didReceiveContentLength from the network stack.
@@ -279,7 +287,22 @@ void InspectorResourceAgent::setInitialScriptContent(unsigned long identifier, c
 
 void InspectorResourceAgent::setInitialXHRContent(unsigned long identifier, const String& sourceString)
 {
-    m_frontend->initialContentSet(static_cast<int>(identifier), sourceString, InspectorPageAgent::resourceTypeString(InspectorPageAgent::XHRResource));
+    m_resourcesData->addResourceContent(identifier, sourceString);
+}
+
+void InspectorResourceAgent::didReceiveXHRResponse(unsigned long identifier)
+{
+    m_resourcesData->didReceiveXHRResponse(identifier);
+}
+
+void InspectorResourceAgent::willLoadXHRSynchronously()
+{
+    m_loadingXHRSynchronously = true;
+}
+
+void InspectorResourceAgent::didLoadXHRSynchronously()
+{
+    m_loadingXHRSynchronously = false;
 }
 
 void InspectorResourceAgent::applyUserAgentOverride(String* userAgent)
@@ -402,10 +425,33 @@ void InspectorResourceAgent::initializeBackgroundCollection()
     m_mockFrontend = adoptPtr(new InspectorFrontend::Network(m_inspectorFrontendProxy.get()));
 }
 
+void InspectorResourceAgent::getResourceContent(ErrorString* errorString, unsigned long identifier, const bool* const optionalBase64Encode, String* content)
+{
+    NetworkResourcesData::ResourceData* resourceData = m_resourcesData->data(identifier);
+    if (!resourceData) {
+        *errorString = "No resource with given identifier found";
+        return;
+    }
+
+    if (resourceData->hasContent())
+        *content = resourceData->content();
+    else if (!resourceData->frameId().isNull() && !resourceData->url().isNull())
+        m_pageAgent->getResourceContent(errorString, resourceData->frameId(), resourceData->url(), optionalBase64Encode, content);
+    else
+        *errorString = "No data found for resource with given identifier";
+}
+
+void InspectorResourceAgent::mainFrameNavigated(DocumentLoader* loader)
+{
+    m_resourcesData->clear(m_pageAgent->loaderId(loader));
+}
+
 InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorState* state)
     : m_instrumentingAgents(instrumentingAgents)
     , m_pageAgent(pageAgent)
     , m_state(state)
+    , m_resourcesData(adoptPtr(new NetworkResourcesData()))
+    , m_loadingXHRSynchronously(false)
 {
     if (isBackgroundEventsCollectionEnabled()) {
         initializeBackgroundCollection();
index 1f39a8b..06a12bb 100644 (file)
@@ -34,7 +34,6 @@
 #include "InspectorFrontend.h"
 #include "PlatformString.h"
 
-#include <wtf/OwnPtr.h>
 #include <wtf/PassRefPtr.h>
 #include <wtf/Vector.h>
 
@@ -49,6 +48,7 @@ namespace WebCore {
 class CachedResource;
 class Document;
 class DocumentLoader;
+class EventsCollector;
 class Frame;
 class InspectorArray;
 class InspectorFrontend;
@@ -58,7 +58,7 @@ class InspectorPageAgent;
 class InspectorState;
 class InstrumentingAgents;
 class KURL;
-class EventsCollector;
+class NetworkResourcesData;
 class Page;
 class ResourceError;
 class ResourceRequest;
@@ -94,8 +94,13 @@ public:
     void didFinishLoading(unsigned long identifier, double finishTime);
     void didFailLoading(unsigned long identifier, const ResourceError&);
     void didLoadResourceFromMemoryCache(DocumentLoader*, const CachedResource*);
+    void mainFrameNavigated(DocumentLoader*);
     void setInitialScriptContent(unsigned long identifier, const String& sourceString);
     void setInitialXHRContent(unsigned long identifier, const String& sourceString);
+    void didReceiveXHRResponse(unsigned long identifier);
+    void willLoadXHRSynchronously();
+    void didLoadXHRSynchronously();
+
     void applyUserAgentOverride(String* userAgent);
 
 #if ENABLE(WEB_SOCKETS)
@@ -113,7 +118,8 @@ public:
     void disable(ErrorString*);
     void setUserAgentOverride(ErrorString*, const String& userAgent);
     void setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject>);
-
+    void getResourceContent(ErrorString*, unsigned long identifier, const bool* const base64Encode, String* content);
+    void clearCache(ErrorString*, const String* const optionalPreservedLoaderId);
 
 private:
     InspectorResourceAgent(InstrumentingAgents*, InspectorPageAgent*, InspectorState*);
@@ -130,6 +136,8 @@ private:
     OwnPtr<InspectorFrontendProxy> m_inspectorFrontendProxy;
     OwnPtr<InspectorFrontend::Network> m_mockFrontend;
     String m_userAgentOverride;
+    OwnPtr<NetworkResourcesData> m_resourcesData;
+    bool m_loadingXHRSynchronously;
 };
 
 } // namespace WebCore
diff --git a/Source/WebCore/inspector/NetworkResourcesData.cpp b/Source/WebCore/inspector/NetworkResourcesData.cpp
new file mode 100644 (file)
index 0000000..a72d86f
--- /dev/null
@@ -0,0 +1,165 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "NetworkResourcesData.h"
+
+#if ENABLE(INSPECTOR)
+
+namespace {
+// 10MB
+static int maximumResourcesContentSize = 10 * 1000 * 1000;
+}
+
+namespace WebCore {
+
+// ResourceData
+NetworkResourcesData::ResourceData::ResourceData(unsigned long identifier, const String& loaderId)
+    : m_identifier(identifier)
+    , m_loaderId(loaderId)
+    , m_hasContent(false)
+    , m_isXHR(false)
+    , m_isContentPurged(false)
+{
+}
+
+String NetworkResourcesData::ResourceData::content()
+{
+    return m_hasContent ? m_contentBuilder.toString() : String();
+}
+
+void NetworkResourcesData::ResourceData::appendContent(const String& content)
+{
+    m_contentBuilder.append(content);
+    m_hasContent = true;
+}
+
+unsigned NetworkResourcesData::ResourceData::purgeContent()
+{
+    unsigned length = m_contentBuilder.toStringPreserveCapacity().length();
+    m_contentBuilder.clear();
+    m_isContentPurged = true;
+    m_hasContent = false;
+    return length;
+}
+
+// NetworkResourcesData
+NetworkResourcesData::NetworkResourcesData()
+    : m_contentSize(0)
+{
+}
+
+NetworkResourcesData::~NetworkResourcesData()
+{
+    clear();
+}
+
+void NetworkResourcesData::resourceCreated(unsigned long identifier, const String& loaderId)
+{
+    ASSERT(!m_identifierToResourceDataMap.get(identifier));
+    m_identifierToResourceDataMap.set(identifier, new ResourceData(identifier, loaderId));
+}
+
+void NetworkResourcesData::responseReceived(unsigned long identifier, const String& frameId, const String& url)
+{
+    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
+    if (!resourceData)
+        return;
+    resourceData->setFrameId(frameId);
+    resourceData->setUrl(url);
+}
+
+void NetworkResourcesData::didReceiveXHRResponse(unsigned long identifier)
+{
+    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
+    if (!resourceData)
+        return;
+    resourceData->setIsXHR(true);
+}
+
+void NetworkResourcesData::addResourceContent(unsigned long identifier, const String& content)
+{
+    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
+    if (!resourceData)
+        return;
+    if (resourceData->isContentPurged())
+        return;
+    if (ensureFreeSpace(content.length()) && !resourceData->isContentPurged()) {
+        if (!resourceData->hasContent())
+            m_resourceDataDeque.append(resourceData);
+        resourceData->appendContent(content);
+        m_contentSize += content.length();
+    }
+}
+
+bool NetworkResourcesData::isXHR(unsigned long identifier)
+{
+    ResourceData* resourceData = m_identifierToResourceDataMap.get(identifier);
+    if (!resourceData)
+        return false;
+    return resourceData->isXHR();
+}
+
+NetworkResourcesData::ResourceData* NetworkResourcesData::data(unsigned long identifier)
+{
+    return m_identifierToResourceDataMap.get(identifier);
+}
+
+void NetworkResourcesData::clear(const String& preservedLoaderId)
+{
+    m_resourceDataDeque.clear();
+
+    ResourceDataMap preservedMap;
+
+    ResourceDataMap::iterator it;
+    ResourceDataMap::iterator end = m_identifierToResourceDataMap.end();
+    for (it = m_identifierToResourceDataMap.begin(); it != end; ++it) {
+        ResourceData* resourceData = it->second;
+        if (!preservedLoaderId.isNull() && resourceData->loaderId() == preservedLoaderId)
+            preservedMap.set(it->first, it->second);
+        else
+            delete resourceData;
+    }
+    m_identifierToResourceDataMap.swap(preservedMap);
+}
+
+bool NetworkResourcesData::ensureFreeSpace(int size)
+{
+    if (size > maximumResourcesContentSize)
+        return false;
+
+    while (size > maximumResourcesContentSize - m_contentSize) {
+        ResourceData* resourceData = m_resourceDataDeque.takeFirst();
+        m_contentSize -= resourceData->purgeContent();
+    }
+    return true;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
diff --git a/Source/WebCore/inspector/NetworkResourcesData.h b/Source/WebCore/inspector/NetworkResourcesData.h
new file mode 100644 (file)
index 0000000..fff85f2
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * Copyright (C) 2011 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
+ * OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef NetworkResourcesData_h
+#define NetworkResourcesData_h
+
+#include <wtf/Deque.h>
+#include <wtf/HashMap.h>
+#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
+
+#if ENABLE(INSPECTOR)
+
+namespace WebCore {
+
+class NetworkResourcesData {
+public:
+    class ResourceData {
+    public:
+        ResourceData(unsigned long identifier, const String& loaderId);
+
+        unsigned long identifier() const { return m_identifier; }
+        String loaderId() const { return m_loaderId; }
+
+        String frameId() const { return m_frameId; }
+        void setFrameId(String frameId) { m_frameId = frameId; }
+
+        String url() const { return m_url; }
+        void setUrl(String url) { m_url = url; }
+
+        bool isXHR() const { return m_isXHR; }
+        void setIsXHR(bool isXHR) { m_isXHR = isXHR; }
+
+        bool hasContent() const { return m_hasContent; }
+        String content();
+        void appendContent(const String&);
+
+        bool isContentPurged() const { return m_isContentPurged; }
+        void setIsContentPurged(bool isContentPurged) { m_isContentPurged = isContentPurged; }
+        unsigned purgeContent();
+
+    private:
+        unsigned long m_identifier;
+        String m_loaderId;
+        String m_frameId;
+        String m_url;
+        bool m_hasContent;
+        StringBuilder m_contentBuilder;
+        bool m_isXHR;
+        bool m_isContentPurged;
+    };
+
+    NetworkResourcesData();
+
+    ~NetworkResourcesData();
+
+    void resourceCreated(unsigned long identifier, const String& loaderId);
+    void responseReceived(unsigned long identifier, const String& frameId, const String& url);
+    void didReceiveXHRResponse(unsigned long identifier);
+    void addResourceContent(unsigned long identifier, const String& content);
+
+    bool isXHR(unsigned long identifier);
+    ResourceData* data(unsigned long identifier);
+    void clear(const String& preservedLoaderId = String());
+
+private:
+    bool ensureFreeSpace(int size);
+
+    Deque<ResourceData*> m_resourceDataDeque;
+
+    typedef HashMap<unsigned long, ResourceData*> ResourceDataMap;
+    ResourceDataMap m_identifierToResourceDataMap;
+    int m_contentSize;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INSPECTOR)
+
+#endif // !defined(NetworkResourcesData_h)
index 6a4baa4..9d2ba5a 100644 (file)
@@ -48,7 +48,12 @@ WebInspector.NetworkManager.prototype = {
         {
             callback(!error ? content : null);
         }
-        PageAgent.getResourceContent(resource.frameId, resource.url, base64Encode, callbackWrapper);
+        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=61363 We should separate NetworkResource (NetworkPanel resource) 
+        // from ResourceRevision (ResourcesPanel/ScriptsPanel resource) and request content accordingly.
+        if (resource.identifier)
+            NetworkAgent.getResourceContent(resource.identifier, base64Encode, callbackWrapper);
+        else
+            PageAgent.getResourceContent(resource.frameId, resource.url, base64Encode, callbackWrapper);
     },
 
     inflightResourceForURL: function(url)
@@ -263,7 +268,7 @@ WebInspector.NetworkDispatcher.prototype = {
     {
         var originalResource = this._inflightResourcesById[identifier];
         var previousRedirects = originalResource.redirects || [];
-        originalResource.identifier = "redirected:" + identifier + "." + previousRedirects.length;
+        delete originalResource.identifier;
         delete originalResource.redirects;
         this._finishResource(originalResource, time);
         var newResource = this._createResource(identifier, originalResource.frameId, originalResource.loaderId,
index 6fe728f..974d5b6 100644 (file)
@@ -741,7 +741,8 @@ WebInspector.NetworkPanel.prototype = {
     _appendResource: function(resource)
     {
         this._resources.push(resource);
-        this._resourcesById[resource.identifier] = resource;
+        if (resource.identifier)
+            this._resourcesById[resource.identifier] = resource;
         this._resourcesByURL[resource.url] = resource;
 
         // Pull all the redirects of the main resource upon commit load.
@@ -778,8 +779,14 @@ WebInspector.NetworkPanel.prototype = {
 
         var loaderId = event.data.loaderId;
         // Main frame committed load.
-        if (this._preserveLogToggle.toggled)
+        if (this._preserveLogToggle.toggled) {
+            for (var i = 0; i < this._resources.length; ++i) {
+                var resource = this._resources[i];
+                if (resource.loaderId !== loaderId)
+                    resource.identifier = null;
+            }
             return;
+        }
 
         // Preserve provisional load resources.
         var resourcesToPreserve = [];
index 804c3e7..0e8b375 100644 (file)
@@ -171,8 +171,13 @@ void DocumentThreadableLoader::didSendData(SubresourceLoader* loader, unsigned l
 
 void DocumentThreadableLoader::didReceiveResponse(SubresourceLoader* loader, const ResourceResponse& response)
 {
+    ASSERT(loader == m_loader);
+    didReceiveResponse(loader->identifier(), response);
+}
+
+void DocumentThreadableLoader::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
+{
     ASSERT(m_client);
-    ASSERT_UNUSED(loader, loader == m_loader);
 
     String accessControlErrorDescription;
     if (m_actualRequest) {
@@ -198,7 +203,7 @@ void DocumentThreadableLoader::didReceiveResponse(SubresourceLoader* loader, con
             }
         }
 
-        m_client->didReceiveResponse(response);
+        m_client->didReceiveResponse(identifier, response);
     }
 }
 
@@ -285,7 +290,7 @@ void DocumentThreadableLoader::receivedCancellation(SubresourceLoader* loader, c
 {
     ASSERT(m_client);
     ASSERT_UNUSED(loader, loader == m_loader);
-    m_client->didReceiveAuthenticationCancellation(challenge.failureResponse());
+    m_client->didReceiveAuthenticationCancellation(loader->identifier(), challenge.failureResponse());
 }
 
 void DocumentThreadableLoader::preflightSuccess()
@@ -351,7 +356,7 @@ void DocumentThreadableLoader::loadRequest(const ResourceRequest& request, Secur
         return;
     }
 
-    didReceiveResponse(0, response);
+    didReceiveResponse(identifier, response);
 
     const char* bytes = static_cast<const char*>(data.data());
     int len = static_cast<int>(data.size());
index 5949667..24001a2 100644 (file)
@@ -86,6 +86,7 @@ namespace WebCore {
         virtual void didReceiveAuthenticationChallenge(SubresourceLoader*, const AuthenticationChallenge&);
         virtual void receivedCancellation(SubresourceLoader*, const AuthenticationChallenge&);
 
+        void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
         void didFinishLoading(unsigned long identifier, double finishTime);
         void makeSimpleCrossOriginAccessRequest(const ResourceRequest& request);
         void makeCrossOriginAccessRequestWithPreflight(const ResourceRequest& request);
index b9976bc..3c7d5ed 100644 (file)
@@ -42,14 +42,14 @@ namespace WebCore {
     public:
         virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/) { }
 
-        virtual void didReceiveResponse(const ResourceResponse&) { }
+        virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&) { }
         virtual void didReceiveData(const char*, int /*dataLength*/) { }
         virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/) { }
         virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/) { }
         virtual void didFail(const ResourceError&) { }
         virtual void didFailRedirectCheck() { }
 
-        virtual void didReceiveAuthenticationCancellation(const ResourceResponse&) { }
+        virtual void didReceiveAuthenticationCancellation(unsigned long /*identifier*/, const ResourceResponse&) { }
 
         virtual bool isDocumentThreadableLoaderClient() { return false; }
 
index d765fa0..730e1b5 100644 (file)
@@ -62,10 +62,10 @@ public:
             m_client->didSendData(bytesSent, totalBytesToBeSent);
     }
 
-    void didReceiveResponse(const ResourceResponse& response)
+    void didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
     {
         if (m_client)
-            m_client->didReceiveResponse(response);
+            m_client->didReceiveResponse(identifier, response);
     }
 
     void didReceiveData(const char* data, int dataLength)
@@ -101,10 +101,10 @@ public:
             m_client->didFailRedirectCheck();
     }
 
-    void didReceiveAuthenticationCancellation(const ResourceResponse& response)
+    void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse& response)
     {
         if (m_client)
-            m_client->didReceiveResponse(response);
+            m_client->didReceiveResponse(identifier, response);
     }
 
 protected:
index 097c625..96f51c3 100644 (file)
@@ -177,16 +177,16 @@ void WorkerThreadableLoader::MainThreadBridge::didSendData(unsigned long long by
     m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidSendData, m_workerClientWrapper, bytesSent, totalBytesToBeSent), m_taskMode);
 }
 
-static void workerContextDidReceiveResponse(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<CrossThreadResourceResponseData> responseData)
+static void workerContextDidReceiveResponse(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData)
 {
     ASSERT_UNUSED(context, context->isWorkerContext());
     OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData));
-    workerClientWrapper->didReceiveResponse(*response);
+    workerClientWrapper->didReceiveResponse(identifier, *response);
 }
 
-void WorkerThreadableLoader::MainThreadBridge::didReceiveResponse(const ResourceResponse& response)
+void WorkerThreadableLoader::MainThreadBridge::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
 {
-    m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveResponse, m_workerClientWrapper, response), m_taskMode);
+    m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveResponse, m_workerClientWrapper, identifier, response), m_taskMode);
 }
 
 static void workerContextDidReceiveData(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<Vector<char> > vectorData)
@@ -248,16 +248,16 @@ void WorkerThreadableLoader::MainThreadBridge::didFailRedirectCheck()
     m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidFailRedirectCheck, m_workerClientWrapper), m_taskMode);
 }
 
-static void workerContextDidReceiveAuthenticationCancellation(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, PassOwnPtr<CrossThreadResourceResponseData> responseData)
+static void workerContextDidReceiveAuthenticationCancellation(ScriptExecutionContext* context, RefPtr<ThreadableLoaderClientWrapper> workerClientWrapper, unsigned long identifier, PassOwnPtr<CrossThreadResourceResponseData> responseData)
 {
     ASSERT_UNUSED(context, context->isWorkerContext());
     OwnPtr<ResourceResponse> response(ResourceResponse::adopt(responseData));
-    workerClientWrapper->didReceiveAuthenticationCancellation(*response);
+    workerClientWrapper->didReceiveAuthenticationCancellation(identifier, *response);
 }
 
-void WorkerThreadableLoader::MainThreadBridge::didReceiveAuthenticationCancellation(const ResourceResponse& response)
+void WorkerThreadableLoader::MainThreadBridge::didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse& response)
 {
-    m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveAuthenticationCancellation, m_workerClientWrapper, response), m_taskMode);
+    m_loaderProxy.postTaskForModeToWorkerContext(createCallbackTask(&workerContextDidReceiveAuthenticationCancellation, m_workerClientWrapper, identifier, response), m_taskMode);
 }
 
 } // namespace WebCore
index 7685eed..9f45e93 100644 (file)
@@ -113,13 +113,13 @@ namespace WebCore {
             static void mainThreadCreateLoader(ScriptExecutionContext*, MainThreadBridge*, PassOwnPtr<CrossThreadResourceRequestData>, ThreadableLoaderOptions, const String& outgoingReferrer);
             static void mainThreadCancel(ScriptExecutionContext*, MainThreadBridge*);
             virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
-            virtual void didReceiveResponse(const ResourceResponse&);
+            virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
             virtual void didReceiveData(const char*, int dataLength);
             virtual void didReceiveCachedMetadata(const char*, int dataLength);
             virtual void didFinishLoading(unsigned long identifier, double finishTime);
             virtual void didFail(const ResourceError&);
             virtual void didFailRedirectCheck();
-            virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
+            virtual void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse&);
 
             // Only to be used on the main thread.
             RefPtr<ThreadableLoader> m_mainThreadLoader;
index 2d16909..308dbb1 100644 (file)
@@ -181,7 +181,7 @@ void Notification::stopLoading()
     m_loader->cancel();
 }
 
-void Notification::didReceiveResponse(const ResourceResponse& response)
+void Notification::didReceiveResponse(unsigned long, const ResourceResponse& response)
 {
     int status = response.httpStatusCode();
     if (status && (status < 200 || status > 299)) {
@@ -211,7 +211,7 @@ void Notification::didFailRedirectCheck()
     finishLoading();
 }
 
-void Notification::didReceiveAuthenticationCancellation(const ResourceResponse&)
+void Notification::didReceiveAuthenticationCancellation(unsigned long, const ResourceResponse&)
 {
     finishLoading();
 }
index 72d71f4..aa2f090 100644 (file)
@@ -102,12 +102,12 @@ namespace WebCore {
         // Deprecated. Use functions from NotificationCenter.
         void detachPresenter() { }
 
-        virtual void didReceiveResponse(const ResourceResponse&);
+        virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
         virtual void didReceiveData(const char* data, int dataLength);
         virtual void didFinishLoading(unsigned long identifier, double finishTime);
         virtual void didFail(const ResourceError&);
         virtual void didFailRedirectCheck();
-        virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
+        virtual void didReceiveAuthenticationCancellation(unsigned long, const ResourceResponse&);
 
     private:
         Notification(const KURL&, ScriptExecutionContext*, ExceptionCode&, PassRefPtr<NotificationCenter>);
index 020d464..3f0ae37 100644 (file)
@@ -181,7 +181,7 @@ ScriptExecutionContext* EventSource::scriptExecutionContext() const
     return ActiveDOMObject::scriptExecutionContext();
 }
 
-void EventSource::didReceiveResponse(const ResourceResponse& response)
+void EventSource::didReceiveResponse(unsigned long, const ResourceResponse& response)
 {
     int statusCode = response.httpStatusCode();
     bool mimeTypeIsValid = response.mimeType() == "text/event-stream";
index 3385d90..dea91af 100644 (file)
@@ -90,7 +90,7 @@ namespace WebCore {
         virtual EventTargetData* eventTargetData();
         virtual EventTargetData* ensureEventTargetData();
 
-        virtual void didReceiveResponse(const ResourceResponse&);
+        virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
         virtual void didReceiveData(const char*, int);
         virtual void didFinishLoading(unsigned long, double);
         virtual void didFail(const ResourceError&);
index c7a57e5..f941f60 100644 (file)
@@ -111,7 +111,7 @@ PassOwnPtr<ResourceRequest> WorkerScriptLoader::createResourceRequest()
     return request.release();
 }
     
-void WorkerScriptLoader::didReceiveResponse(const ResourceResponse& response)
+void WorkerScriptLoader::didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse& response)
 {
     if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode()) {
         m_failed = true;
@@ -168,7 +168,7 @@ void WorkerScriptLoader::didFailRedirectCheck()
     notifyError();
 }
 
-void WorkerScriptLoader::didReceiveAuthenticationCancellation(const ResourceResponse&)
+void WorkerScriptLoader::didReceiveAuthenticationCancellation(unsigned long /*identifier*/, const ResourceResponse&)
 {
     notifyError();
 }
index dd84313..3b08e49 100644 (file)
@@ -66,12 +66,12 @@ namespace WebCore {
         bool failed() const { return m_failed; }
         unsigned long identifier() const { return m_identifier; }
 
-        virtual void didReceiveResponse(const ResourceResponse&);
+        virtual void didReceiveResponse(unsigned long /*identifier*/, const ResourceResponse&);
         virtual void didReceiveData(const char* data, int dataLength);
         virtual void didFinishLoading(unsigned long identifier, double);
         virtual void didFail(const ResourceError&);
         virtual void didFailRedirectCheck();
-        virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
+        virtual void didReceiveAuthenticationCancellation(unsigned long /*identifier*/, const ResourceResponse&);
 
     private:
         friend class WTF::RefCounted<WorkerScriptLoader>;
index d73d11c..6634167 100644 (file)
@@ -672,8 +672,11 @@ void XMLHttpRequest::createRequest(ExceptionCode& ec)
             // and they are referenced by the JavaScript wrapper.
             setPendingActivity(this);
         }
-    } else
+    } else {
+        InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext());
         ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options);
+        InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext());
+    }
 
     if (!m_exceptionCode && m_error)
         m_exceptionCode = XMLHttpRequestException::NETWORK_ERR;
@@ -1032,15 +1035,17 @@ void XMLHttpRequest::didSendData(unsigned long long bytesSent, unsigned long lon
     }
 }
 
-void XMLHttpRequest::didReceiveResponse(const ResourceResponse& response)
+void XMLHttpRequest::didReceiveResponse(unsigned long identifier, const ResourceResponse& response)
 {
+    InspectorInstrumentation::didReceiveXHRResponse(scriptExecutionContext(), identifier);
+
     m_response = response;
     m_responseEncoding = extractCharsetFromMediaType(m_mimeTypeOverride);
     if (m_responseEncoding.isEmpty())
         m_responseEncoding = response.textEncodingName();
 }
 
-void XMLHttpRequest::didReceiveAuthenticationCancellation(const ResourceResponse& failureResponse)
+void XMLHttpRequest::didReceiveAuthenticationCancellation(unsigned long, const ResourceResponse& failureResponse)
 {
     m_response = failureResponse;
 }
index b07ca2b..f5f9357 100644 (file)
@@ -150,12 +150,12 @@ private:
 #endif
 
     virtual void didSendData(unsigned long long bytesSent, unsigned long long totalBytesToBeSent);
-    virtual void didReceiveResponse(const ResourceResponse&);
+    virtual void didReceiveResponse(unsigned long identifier, const ResourceResponse&);
     virtual void didReceiveData(const char* data, int dataLength);
     virtual void didFinishLoading(unsigned long identifier, double finishTime);
     virtual void didFail(const ResourceError&);
     virtual void didFailRedirectCheck();
-    virtual void didReceiveAuthenticationCancellation(const ResourceResponse&);
+    virtual void didReceiveAuthenticationCancellation(unsigned long identifier, const ResourceResponse&);
 
     String responseMIMEType() const;
     bool responseIsXML() const;
index 711ae08..b2346ca 100644 (file)
@@ -1,3 +1,15 @@
+2011-06-16  Vsevolod Vlasov  <vsevik@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        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):
+
 2011-06-16  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Eric Seidel.
index 0fd4067..098a24b 100644 (file)
@@ -60,7 +60,7 @@ public:
     virtual void didSendData(unsigned long long /*bytesSent*/, unsigned long long /*totalBytesToBeSent*/);
     virtual void willSendRequest(ResourceRequest& /*newRequest*/, const ResourceResponse& /*redirectResponse*/);
 
-    virtual void didReceiveResponse(const ResourceResponse&);
+    virtual void didReceiveResponse(unsigned long, const ResourceResponse&);
     virtual void didReceiveData(const char*, int /*dataLength*/);
     virtual void didReceiveCachedMetadata(const char*, int /*dataLength*/);
     virtual void didFinishLoading(unsigned long /*identifier*/, double /*finishTime*/);
@@ -113,7 +113,7 @@ void AssociatedURLLoader::ClientAdapter::didSendData(unsigned long long bytesSen
     m_client->didSendData(m_loader, bytesSent, totalBytesToBeSent);
 }
 
-void AssociatedURLLoader::ClientAdapter::didReceiveResponse(const ResourceResponse& response)
+void AssociatedURLLoader::ClientAdapter::didReceiveResponse(unsigned long, const ResourceResponse& response)
 {
     WrappedResourceResponse wrappedResponse(response);
     m_client->didReceiveResponse(m_loader, wrappedResponse);