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

2011-03-24 Pavel Feldman <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: brush up Network agent API.
        https://bugs.webkit.org/show_bug.cgi?id=57001

        * http/tests/inspector/network/network-redirect-expected.txt: Added.
        * http/tests/inspector/network/network-redirect.html: Added.
        * inspector/timeline/timeline-network-resource-expected.txt:
        * platform/chromium/inspector/timeline/timeline-network-resource-expected.txt:
2011-03-24  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: brush up Network agent API.
        https://bugs.webkit.org/show_bug.cgi?id=57001

        * inspector/Inspector.json:
        * inspector/InspectorInstrumentation.cpp:
        (WebCore::InspectorInstrumentation::willSendRequestImpl):
        * inspector/InspectorInstrumentation.h:
        (WebCore::InspectorInstrumentation::willSendRequest):
        * inspector/InspectorResourceAgent.cpp:
        (WebCore::buildObjectForResourceRequest):
        (WebCore::buildObjectForResourceResponse):
        (WebCore::buildObjectForCachedResource):
        (WebCore::InspectorResourceAgent::willSendRequest):
        (WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest):
        (WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse):
        (WebCore::InspectorResourceAgent::setExtraHeaders):
        * inspector/InspectorResourceAgent.h:
        * inspector/TimelineRecordFactory.cpp:
        (WebCore::TimelineRecordFactory::createResourceReceiveResponseData):
        * inspector/front-end/NetworkManager.js:
        (WebInspector.NetworkDispatcher.prototype._updateResourceWithRequest):
        (WebInspector.NetworkDispatcher.prototype._updateResourceWithResponse):
        (WebInspector.NetworkDispatcher.prototype._updateResourceWithCachedResource):
        (WebInspector.NetworkDispatcher.prototype.willSendRequest):
        (WebInspector.NetworkDispatcher.prototype.didReceiveWebSocketHandshakeResponse):
        (WebInspector.NetworkDispatcher.prototype.didCloseWebSocket):
        * inspector/front-end/Resource.js:
        * inspector/front-end/TimelinePanel.js:
        (WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent):
        * loader/ResourceLoadNotifier.cpp:
        (WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest):
        (WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
        * loader/appcache/ApplicationCacheGroup.cpp:
        (WebCore::ApplicationCacheGroup::createResourceHandle):
2011-03-24  Pavel Feldman  <pfeldman@chromium.org>

        Reviewed by Yury Semikhatsky.

        Web Inspector: brush up Network agent API.
        https://bugs.webkit.org/show_bug.cgi?id=57001

        * public/WebDevToolsAgent.h:
        * src/WebDevToolsAgentImpl.cpp:
        (WebKit::WebDevToolsAgentImpl::identifierForInitialRequest):
        (WebKit::WebDevToolsAgentImpl::willSendRequest):
        * src/WebDevToolsAgentImpl.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@81861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6c7e8883
2011-03-24 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: brush up Network agent API.
https://bugs.webkit.org/show_bug.cgi?id=57001
* http/tests/inspector/network/network-redirect-expected.txt: Added.
* http/tests/inspector/network/network-redirect.html: Added.
* inspector/timeline/timeline-network-resource-expected.txt:
* platform/chromium/inspector/timeline/timeline-network-resource-expected.txt:
2011-03-24 Philippe Normand <pnormand@igalia.com>
Unreviewed, skipping 3 xmlhttprequest tests timing out on GTK, see
......
CONSOLE MESSAGE: line 15: Done.
Tests network panel redirect.
Model data:
GET: http://127.0.0.1:8000/inspector/network/resources/redirect.php?status=302 -> 302
GET: http://127.0.0.1:8000/inspector/network/resources/redirect.php?redirected=true -> 200
Grid data:
GET: http://127.0.0.1:8000/inspector/network/resources/redirect.php?status=302 -> 302
GET: http://127.0.0.1:8000/inspector/network/resources/redirect.php?redirected=true -> 200
<html>
<head>
<script src="../inspector-test.js"></script>
<script>
function loadIframe()
{
var iframe = document.createElement("iframe");
iframe.src = "resources/redirect.php?status=302";
iframe.onload = iframeLoaded;
document.body.appendChild(iframe);
}
function iframeLoaded()
{
console.log("Done.");
}
function test()
{
InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "addMessage", step2);
InspectorTest.evaluateInPage("loadIframe()");
function step2()
{
// inspector-test.js appears in network panel occasionally in Safari on
// Mac, so checking two last resources.
InspectorTest.addResult("Model data:");
var resources = WebInspector.panels.network.resources;
for (var i = resources.length - 2; i < resources.length; ++i)
printResource(resources[i]);
InspectorTest.addResult("Grid data:");
var dataGridNodes = WebInspector.panels.network._dataGrid.children;
WebInspector.panels.network.refresh();
for (var i = dataGridNodes.length - 2; i < dataGridNodes.length; ++i)
printResource(dataGridNodes[i]._resource);
InspectorTest.completeTest();
}
function printResource(resource)
{
InspectorTest.addResult(resource.requestMethod + ": " + resource.url + " -> " + resource.statusCode);
}
}
</script>
</head>
<body onload="runTest()">
<p>Tests network panel redirect.</p>
</body>
</html>
......@@ -23,7 +23,6 @@ ResourceReceiveResponse Properties:
identifier : <number>
statusCode : 0
mimeType : <string>
expectedContentLength : 213
url : <string>
}
children : <object>
......
......@@ -24,7 +24,6 @@ ResourceReceiveResponse Properties:
identifier : <number>
statusCode : 0
mimeType : <string>
expectedContentLength : 213
url : <string>
}
children : <object>
......
2011-03-24 Pavel Feldman <pfeldman@chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: brush up Network agent API.
https://bugs.webkit.org/show_bug.cgi?id=57001
* inspector/Inspector.json:
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willSendRequestImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willSendRequest):
* inspector/InspectorResourceAgent.cpp:
(WebCore::buildObjectForResourceRequest):
(WebCore::buildObjectForResourceResponse):
(WebCore::buildObjectForCachedResource):
(WebCore::InspectorResourceAgent::willSendRequest):
(WebCore::InspectorResourceAgent::willSendWebSocketHandshakeRequest):
(WebCore::InspectorResourceAgent::didReceiveWebSocketHandshakeResponse):
(WebCore::InspectorResourceAgent::setExtraHeaders):
* inspector/InspectorResourceAgent.h:
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createResourceReceiveResponseData):
* inspector/front-end/NetworkManager.js:
(WebInspector.NetworkDispatcher.prototype._updateResourceWithRequest):
(WebInspector.NetworkDispatcher.prototype._updateResourceWithResponse):
(WebInspector.NetworkDispatcher.prototype._updateResourceWithCachedResource):
(WebInspector.NetworkDispatcher.prototype.willSendRequest):
(WebInspector.NetworkDispatcher.prototype.didReceiveWebSocketHandshakeResponse):
(WebInspector.NetworkDispatcher.prototype.didCloseWebSocket):
* inspector/front-end/Resource.js:
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.FormattedRecord.prototype._generatePopupContent):
* loader/ResourceLoadNotifier.cpp:
(WebCore::ResourceLoadNotifier::assignIdentifierToInitialRequest):
(WebCore::ResourceLoadNotifier::dispatchWillSendRequest):
* loader/appcache/ApplicationCacheGroup.cpp:
(WebCore::ApplicationCacheGroup::createResourceHandle):
2011-03-11 Steve Block <steveblock@google.com>
Reviewed by Jeremy Orlow.
......@@ -215,12 +215,86 @@
},
{
"domain": "Network",
"types": [],
"types": [
{
"id": "ResourceTiming",
"type": "object",
"properties": {
"requestTime": { "type": "number" },
"proxyStart": { "type": "number" },
"proxyEnd": { "type": "number" },
"dnsStart": { "type": "number" },
"dnsEnd": { "type": "number" },
"connectStart": { "type": "number" },
"connectEnd": { "type": "number" },
"sslStart": { "type": "number" },
"sslEnd": { "type": "number" },
"sendStart": { "type": "number" },
"sendEnd": { "type": "number" },
"receiveHeadersEnd": { "type": "number" }
}
},
{
"id": "ResourceRequest",
"type": "object",
"properties": {
"url": { "type": "string" },
"method": { "type": "string" },
"headers": { "type": "object" },
"postData": { "type": "string", "optional": true }
}
},
{
"id": "ResourceResponse",
"type": "object",
"properties": {
"status": { "type": "number" },
"statusText": { "type": "string" },
"headers": { "type": "object" },
"mimeType": { "type": "string" },
"requestHeaders": { "type": "object" },
"connectionReused": { "type": "boolean" },
"connectionID": { "type": "number" },
"fromDiskCache": { "type": "boolean" },
"timing": { "$ref": "ResourceTiming", "optional": true }
}
},
{
"id": "CachedResource",
"type": "object",
"properties": {
"url": { "type": "string" },
"type": { "type": "string" },
"response": { "$ref": "ResourceResponse" },
"bodySize": { "type": "number" },
"loader": { "$ref": "DocumentLoader" }
}
},
{
"id": "DocumentLoader",
"type": "object",
"properties": {
"frameId": { "type": "string" },
"loaderId": { "type": "string" },
"url": { "type": "string" }
}
},
{
"id": "FrameResource",
"type": "object",
"properties": {
"url": { "type": "string" },
"loader": { "$ref": "DocumentLoader" },
"request": { "$ref": "ResourceRequest" },
"response": { "$ref": "ResourceResponse" }
}
}
],
"commands": [
{
"name": "enable",
"returns": [
{ "name": "resources", "$ref": "NetworkResourceTree" }
{ "name": "resources", "$ref": "FrameResourceTree" }
]
},
{
......@@ -252,22 +326,15 @@
{ "name": "frameId", "type": "string" }
]
},
{
"name": "identifierForInitialRequest",
"parameters": [
{ "name": "identifier", "type": "integer" },
{ "name": "url", "type": "string" },
{ "name": "loader", "$ref": "NetworkLoader" },
{ "name": "callStack", "type": "array", "items": { "$ref" : "DebuggerStackFrame"} }
]
},
{
"name": "willSendRequest",
"parameters": [
{ "name": "identifier", "type": "integer" },
{ "name": "loader", "$ref": "NetworkLoader" },
{ "name": "request", "$ref": "ResourceRequest" },
{ "name": "redirectResponse", "$ref": "ResourceResponse" },
{ "name": "time", "type": "number" },
{ "name": "request", "$ref": "NetworkRequest" },
{ "name": "redirectResponse", "$ref": "NetworkResponse" }
{ "name": "callStack", "type": "array", "items": { "$ref" : "DebuggerStackFrame"} }
]
},
{
......@@ -282,7 +349,7 @@
{ "name": "identifier", "type": "integer" },
{ "name": "time", "type": "number" },
{ "name": "resourceType", "type": "string" },
{ "name": "response", "$ref": "NetworkResponse" }
{ "name": "response", "$ref": "ResourceResponse" }
]
},
{
......@@ -503,7 +570,7 @@
"nodeValue": { "type": "string", "description": "<code>Node</code>'s nodeValue." },
"childNodeCount": { "type": "integer", "optional": true, "description": "Child count for <code>Container</code> nodes." },
"children": { "type": "array", "optional": true, "items": { "$ref" : "DOMNode" }, "description": "Child nodes of this node when requested with children." },
"attributes": { "type": "array", "optional": true, "items": { "type" : "string" }, "description": "Attributes of the <code>Element</code> node in the form of flat array <code>[name1, value1, name2, value2]." },
"attributes": { "type": "array", "optional": true, "items": { "type" : "string" }, "description": "Attributes of the <code>Element</code> node in the form of flat array <code>[name1, value1, name2, value2]</code>." },
"documentURL": { "type": "string", "optional": true, "description": "Document URL that <code>Document</code> or <code>FrameOwner</code> node points to." },
"publicId": { "type": "string", "optional": true, "description": "<code>DocumentType</code>'s publicId. // FIXME" },
"systemId": { "type": "string", "optional": true, "description": "<code>DocumentType</code>'s systemId. // FIXME" },
......
......@@ -385,26 +385,17 @@ void InspectorInstrumentation::didRecalculateStyleImpl(const InspectorInstrument
timelineAgent->didRecalculateStyle();
}
void InspectorInstrumentation::identifierForInitialRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
if (!inspectorAgent->enabled())
return;
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
resourceAgent->identifierForInitialRequest(identifier, request.url(), loader);
}
void InspectorInstrumentation::applyUserAgentOverrideImpl(InspectorAgent* inspectorAgent, String* userAgent)
{
inspectorAgent->applyUserAgentOverride(userAgent);
}
void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
void InspectorInstrumentation::willSendRequestImpl(InspectorAgent* inspectorAgent, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(inspectorAgent))
timelineAgent->willSendResourceRequest(identifier, request);
if (InspectorResourceAgent* resourceAgent = retrieveResourceAgent(inspectorAgent))
resourceAgent->willSendRequest(identifier, request, redirectResponse);
resourceAgent->willSendRequest(identifier, loader, request, redirectResponse);
}
void InspectorInstrumentation::markResourceAsCachedImpl(InspectorAgent* inspectorAgent, unsigned long identifier)
......
......@@ -110,8 +110,7 @@ public:
static void didRecalculateStyle(const InspectorInstrumentationCookie&);
static void applyUserAgentOverride(Frame*, String*);
static void identifierForInitialRequest(Frame*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
static void willSendRequest(Frame*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
static void willSendRequest(Frame*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
static void markResourceAsCached(Page*, unsigned long identifier);
static void didLoadResourceFromMemoryCache(Page*, DocumentLoader*, const CachedResource*);
static InspectorInstrumentationCookie willReceiveResourceData(Frame*, unsigned long identifier);
......@@ -227,8 +226,7 @@ private:
static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
static void applyUserAgentOverrideImpl(InspectorAgent*, String*);
static void identifierForInitialRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, const ResourceRequest&);
static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
static void willSendRequestImpl(InspectorAgent*, unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
static void markResourceAsCachedImpl(InspectorAgent*, unsigned long identifier);
static void didLoadResourceFromMemoryCacheImpl(InspectorAgent*, DocumentLoader*, const CachedResource*);
static InspectorInstrumentationCookie willReceiveResourceDataImpl(InspectorAgent*, unsigned long identifier);
......@@ -601,17 +599,6 @@ inline void InspectorInstrumentation::didRecalculateStyle(const InspectorInstrum
#endif
}
inline void InspectorInstrumentation::identifierForInitialRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, const ResourceRequest& request)
{
#if ENABLE(INSPECTOR)
// This notification should be procecessed even in cases there is no frontend.
if (!frame)
return;
if (InspectorAgent* ic = inspectorAgentForPage(frame->page()))
identifierForInitialRequestImpl(ic, identifier, loader, request);
#endif
}
inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, String* userAgent)
{
#if ENABLE(INSPECTOR)
......@@ -620,11 +607,11 @@ inline void InspectorInstrumentation::applyUserAgentOverride(Frame* frame, Strin
#endif
}
inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
inline void InspectorInstrumentation::willSendRequest(Frame* frame, unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
#if ENABLE(INSPECTOR)
if (InspectorAgent* ic = inspectorAgentWithFrontendForFrame(frame))
willSendRequestImpl(ic, identifier, request, redirectResponse);
willSendRequestImpl(ic, identifier, loader, request, redirectResponse);
#endif
}
......
......@@ -193,41 +193,33 @@ static PassRefPtr<InspectorObject> buildObjectForResourceRequest(const ResourceR
{
RefPtr<InspectorObject> requestObject = InspectorObject::create();
requestObject->setString("url", request.url().string());
requestObject->setString("httpMethod", request.httpMethod());
requestObject->setObject("httpHeaderFields", buildObjectForHeaders(request.httpHeaderFields()));
requestObject->setString("method", request.httpMethod());
requestObject->setObject("headers", buildObjectForHeaders(request.httpHeaderFields()));
if (request.httpBody() && !request.httpBody()->isEmpty())
requestObject->setString("requestFormData", request.httpBody()->flattenToString());
requestObject->setString("postData", request.httpBody()->flattenToString());
return requestObject;
}
static PassRefPtr<InspectorObject> buildObjectForResourceResponse(const ResourceResponse& response)
{
RefPtr<InspectorObject> responseObject = InspectorObject::create();
if (response.isNull()) {
responseObject->setBoolean("isNull", true);
if (response.isNull())
return responseObject;
}
responseObject->setString("url", response.url().string());
responseObject->setNumber("status", response.resourceLoadInfo() ? response.resourceLoadInfo()->httpStatusCode : response.httpStatusCode());
responseObject->setString("statusText", response.resourceLoadInfo() ? response.resourceLoadInfo()->httpStatusText : response.httpStatusText());
responseObject->setObject("headers", buildObjectForHeaders(response.resourceLoadInfo() ? response.resourceLoadInfo()->responseHeaders : response.httpHeaderFields()));
responseObject->setString("mimeType", response.mimeType());
responseObject->setNumber("expectedContentLength", response.expectedContentLength());
responseObject->setString("textEncodingName", response.textEncodingName());
responseObject->setString("suggestedFilename", response.suggestedFilename());
responseObject->setNumber("httpStatusCode", response.httpStatusCode());
responseObject->setString("httpStatusText", response.httpStatusText());
responseObject->setObject("httpHeaderFields", buildObjectForHeaders(response.httpHeaderFields()));
responseObject->setBoolean("connectionReused", response.connectionReused());
responseObject->setNumber("connectionID", response.connectionID());
responseObject->setBoolean("wasCached", response.wasCached());
responseObject->setBoolean("fromDiskCache", response.wasCached());
if (response.resourceLoadTiming())
responseObject->setObject("timing", buildObjectForTiming(*response.resourceLoadTiming()));
if (response.resourceLoadInfo()) {
RefPtr<InspectorObject> loadInfoObject = InspectorObject::create();
loadInfoObject->setNumber("httpStatusCode", response.resourceLoadInfo()->httpStatusCode);
loadInfoObject->setString("httpStatusText", response.resourceLoadInfo()->httpStatusText);
loadInfoObject->setObject("requestHeaders", buildObjectForHeaders(response.resourceLoadInfo()->requestHeaders));
loadInfoObject->setObject("responseHeaders", buildObjectForHeaders(response.resourceLoadInfo()->responseHeaders));
responseObject->setObject("loadInfo", loadInfoObject);
}
if (response.resourceLoadInfo())
responseObject->setObject("requestHeaders", buildObjectForHeaders(response.resourceLoadInfo()->requestHeaders));
return responseObject;
}
......@@ -286,7 +278,7 @@ static PassRefPtr<InspectorObject> buildObjectForCachedResource(DocumentLoader*
RefPtr<InspectorObject> resourceObject = InspectorObject::create();
resourceObject->setString("url", cachedResource.url());
resourceObject->setString("type", cachedResourceTypeString(cachedResource));
resourceObject->setNumber("encodedSize", cachedResource.encodedSize());
resourceObject->setNumber("bodySize", cachedResource.encodedSize());
resourceObject->setObject("response", buildObjectForResourceResponse(cachedResource.response()));
resourceObject->setObject("loader", buildObjectForDocumentLoader(loader));
return resourceObject;
......@@ -312,25 +304,7 @@ InspectorResourceAgent::~InspectorResourceAgent()
ASSERT(!m_instrumentingAgents->inspectorResourceAgent());
}
void InspectorResourceAgent::identifierForInitialRequest(unsigned long identifier, const KURL& url, DocumentLoader* loader)
{
RefPtr<InspectorObject> loaderObject = buildObjectForDocumentLoader(loader);
RefPtr<ScriptCallStack> callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
RefPtr<InspectorArray> callStackValue;
if (callStack)
callStackValue = callStack->buildInspectorArray();
else
callStackValue = InspectorArray::create();
m_frontend->identifierForInitialRequest(static_cast<int>(identifier), url.string(), loaderObject, callStackValue);
}
void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
{
m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
}
void InspectorResourceAgent::willSendRequest(unsigned long identifier, ResourceRequest& request, const ResourceResponse& redirectResponse)
void InspectorResourceAgent::willSendRequest(unsigned long identifier, DocumentLoader* loader, ResourceRequest& request, const ResourceResponse& redirectResponse)
{
RefPtr<InspectorObject> headers = m_state->getObject(ResourceAgentState::extraRequestHeaders);
......@@ -346,7 +320,15 @@ void InspectorResourceAgent::willSendRequest(unsigned long identifier, ResourceR
request.setReportLoadTiming(true);
request.setReportRawHeaders(true);
m_frontend->willSendRequest(static_cast<int>(identifier), currentTime(), buildObjectForResourceRequest(request), buildObjectForResourceResponse(redirectResponse));
RefPtr<InspectorObject> loaderObject = buildObjectForDocumentLoader(loader);
RefPtr<ScriptCallStack> callStack = createScriptCallStack(ScriptCallStack::maxCallStackSizeToCapture, true);
RefPtr<InspectorArray> callStackValue;
if (callStack)
callStackValue = callStack->buildInspectorArray();
else
callStackValue = InspectorArray::create();
m_frontend->willSendRequest(static_cast<int>(identifier), loaderObject, buildObjectForResourceRequest(request), buildObjectForResourceResponse(redirectResponse), currentTime(), callStackValue);
}
void InspectorResourceAgent::markResourceAsCached(unsigned long identifier)
......@@ -480,18 +462,18 @@ void InspectorResourceAgent::didCreateWebSocket(unsigned long identifier, const
void InspectorResourceAgent::willSendWebSocketHandshakeRequest(unsigned long identifier, const WebSocketHandshakeRequest& request)
{
RefPtr<InspectorObject> requestObject = InspectorObject::create();
requestObject->setObject("webSocketHeaderFields", buildObjectForHeaders(request.headerFields()));
requestObject->setString("webSocketRequestKey3", createReadableStringFromBinary(request.key3().value, sizeof(request.key3().value)));
requestObject->setObject("headers", buildObjectForHeaders(request.headerFields()));
requestObject->setString("requestKey3", createReadableStringFromBinary(request.key3().value, sizeof(request.key3().value)));
m_frontend->willSendWebSocketHandshakeRequest(static_cast<int>(identifier), currentTime(), requestObject);
}
void InspectorResourceAgent::didReceiveWebSocketHandshakeResponse(unsigned long identifier, const WebSocketHandshakeResponse& response)
{
RefPtr<InspectorObject> responseObject = InspectorObject::create();
responseObject->setNumber("statusCode", response.statusCode());
responseObject->setNumber("status", response.statusCode());
responseObject->setString("statusText", response.statusText());
responseObject->setObject("webSocketHeaderFields", buildObjectForHeaders(response.headerFields()));
responseObject->setString("webSocketChallengeResponse", createReadableStringFromBinary(response.challengeResponse().value, sizeof(response.challengeResponse().value)));
responseObject->setObject("headers", buildObjectForHeaders(response.headerFields()));
responseObject->setString("challengeResponse", createReadableStringFromBinary(response.challengeResponse().value, sizeof(response.challengeResponse().value)));
m_frontend->didReceiveWebSocketHandshakeResponse(static_cast<int>(identifier), currentTime(), responseObject);
}
......@@ -544,6 +526,11 @@ void InspectorResourceAgent::resourceContent(ErrorString*, const String& frameId
*success = InspectorResourceAgent::resourceContent(frame, KURL(ParsedURLString, url), content);
}
void InspectorResourceAgent::setExtraHeaders(ErrorString*, PassRefPtr<InspectorObject> headers)
{
m_state->setObject(ResourceAgentState::extraRequestHeaders, headers);
}
InspectorResourceAgent::InspectorResourceAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorState* state)
: m_instrumentingAgents(instrumentingAgents)
, m_page(page)
......
......@@ -88,8 +88,7 @@ public:
~InspectorResourceAgent();
void identifierForInitialRequest(unsigned long identifier, const KURL&, DocumentLoader*);
void willSendRequest(unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse);
void willSendRequest(unsigned long identifier, DocumentLoader*, ResourceRequest&, const ResourceResponse& redirectResponse);
void markResourceAsCached(unsigned long identifier);
void didReceiveResponse(unsigned long identifier, DocumentLoader* laoder, const ResourceResponse&);
void didReceiveContentLength(unsigned long identifier, int dataLength, int lengthReceived);
......
......@@ -144,7 +144,6 @@ PassRefPtr<InspectorObject> TimelineRecordFactory::createResourceReceiveResponse
data->setNumber("identifier", identifier);
data->setNumber("statusCode", response.httpStatusCode());
data->setString("mimeType", response.mimeType());
data->setNumber("expectedContentLength", response.expectedContentLength());
return data.release();
}
......
......@@ -90,75 +90,53 @@ WebInspector.NetworkDispatcher = function(resourceTreeModel, manager)
WebInspector.NetworkDispatcher.prototype = {
_updateResourceWithRequest: function(resource, request)
{
resource.requestMethod = request.httpMethod;
resource.requestHeaders = request.httpHeaderFields;
resource.requestFormData = request.requestFormData;
resource.requestMethod = request.method;
resource.requestHeaders = request.headers;
resource.requestFormData = request.postData;
},
_updateResourceWithResponse: function(resource, response)
{
if (resource.isNull)
if (!("status" in response))
return;
resource.mimeType = response.mimeType;
resource.expectedContentLength = response.expectedContentLength;
resource.textEncodingName = response.textEncodingName;
resource.suggestedFilename = response.suggestedFilename;
resource.statusCode = response.httpStatusCode;
resource.statusText = response.httpStatusText;
resource.statusCode = response.status;
resource.statusText = response.statusText;
resource.responseHeaders = response.headers;
// Raw request headers can be a part of response as well.
if (response.requestHeaders)
resource.requestHeaders = response.requestHeaders;
resource.responseHeaders = response.httpHeaderFields;
resource.connectionReused = response.connectionReused;
resource.connectionID = response.connectionID;
if (response.wasCached)
if (response.fromDiskCache)
resource.cached = true;
else
resource.timing = response.timing;
if (response.loadInfo) {
if (response.loadInfo.httpStatusCode)
resource.statusCode = response.loadInfo.httpStatusCode;
if (response.loadInfo.httpStatusText)
resource.statusText = response.loadInfo.httpStatusText;
resource.requestHeaders = response.loadInfo.requestHeaders;
resource.responseHeaders = response.loadInfo.responseHeaders;
}
},
_updateResourceWithCachedResource: function(resource, cachedResource)
{
resource.type = WebInspector.Resource.Type[cachedResource.type];
resource.resourceSize = cachedResource.encodedSize;
resource.resourceSize = cachedResource.bodySize;
this._updateResourceWithResponse(resource, cachedResource.response);
},
identifierForInitialRequest: function(identifier, url, loader, callStack)
{
this._startResource(this._createResource(identifier, url, loader, callStack));
},
willSendRequest: function(identifier, time, request, redirectResponse)
willSendRequest: function(identifier, loader, request, redirectResponse, time, callStack)
{