Commit c2baad00 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

2011-06-16 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-16  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::ensureNoDataForIdentifier):
        (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 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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@89036 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7a78f9a9
2011-06-16 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-16 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Darin Adler.
......
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
<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>
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
<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>
......@@ -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
......
2011-06-16 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::ensureNoDataForIdentifier):
(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 Julien Chaffraix <jchaffraix@webkit.org>
Reviewed by Darin Adler.
......
......@@ -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 \
......
......@@ -3315,6 +3315,8 @@
'inspector/InspectorWorkerAgent.cpp',
'inspector/InspectorWorkerAgent.h',
'inspector/InstrumentingAgents.h',
'inspector/NetworkResourcesData.cpp',
'inspector/NetworkResourcesData.h',
'inspector/PageDebuggerAgent.cpp',
'inspector/PageDebuggerAgent.h',
'inspector/ScriptArguments.cpp',
......
......@@ -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 \
......
......@@ -67713,6 +67713,14 @@
RelativePath="..\inspector\InstrumentingAgents.h"
>
</File>
<File
RelativePath="..\inspector\NetworkResourcesData.cpp"
>
</File>
<File
RelativePath="..\inspector\NetworkResourcesData.h"
>
</File>
<File
RelativePath="..\inspector\PageDebuggerAgent.cpp"
>
......@@ -1449,6 +1449,8 @@
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 */; };
......@@ -7932,6 +7934,8 @@
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>"; };
......@@ -13301,6 +13305,8 @@
F3ABFE0B130E9DA000E7F7D1 /* InstrumentingAgents.h */,
1C81BA050E97348300266E07 /* JavaScriptCallFrame.idl */,
BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */,
59C27F04138D28C10079B7E2 /* NetworkResourcesData.cpp */,
59C27F06138D28CF0079B7E2 /* NetworkResourcesData.h */,
F34742DA134362F000531BC2 /* PageDebuggerAgent.cpp */,
F34742DB134362F000531BC2 /* PageDebuggerAgent.h */,
F39BE95912673BF400E0A674 /* ScriptArguments.cpp */,
......@@ -21948,6 +21954,7 @@
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 */,
......@@ -24901,6 +24908,7 @@
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 */,
......@@ -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()));
......
......@@ -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&);
......
......@@ -485,6 +485,17 @@
"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": [
......@@ -560,7 +571,7 @@
},
{
"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." },
......
......@@ -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();
......
......@@ -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)
......
......@@ -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();
......
......@@ -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
......
/*
* 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.
*/