Commit 6fc91cc9 authored by yhirano@chromium.org's avatar yhirano@chromium.org

Show the correct resource type when XHR fails in the inspector.

Currently an XMLHttpRequest that fails without response is shown as "Other"
resource type. This CL fixes the behavior.

BUG=294676

Review URL: https://codereview.chromium.org/302093003

git-svn-id: svn://svn.chromium.org/blink/trunk@175256 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 7c48dcfd
...@@ -9,7 +9,7 @@ Bug 63712 ...@@ -9,7 +9,7 @@ Bug 63712
1 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=1&deny=yes 1 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=1&deny=yes
2 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=2 2 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=2
2 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=2 2 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=2
3 other:POST http://localhost:8000/inspector/resources/cors-target.php?id=3&deny=yes 3 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=3&deny=yes
4 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=4&deny=yes 4 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=4&deny=yes
5 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=5 5 xhr:OPTIONS http://localhost:8000/inspector/resources/cors-target.php?id=5
5 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=5 5 xhr:POST http://localhost:8000/inspector/resources/cors-target.php?id=5
......
...@@ -432,7 +432,7 @@ void InspectorResourceAgent::didFailLoading(unsigned long identifier, const Reso ...@@ -432,7 +432,7 @@ void InspectorResourceAgent::didFailLoading(unsigned long identifier, const Reso
{ {
String requestId = IdentifiersFactory::requestId(identifier); String requestId = IdentifiersFactory::requestId(identifier);
bool canceled = error.isCancellation(); bool canceled = error.isCancellation();
m_frontend->loadingFailed(requestId, currentTime(), error.localizedDescription(), canceled ? &canceled : 0); m_frontend->loadingFailed(requestId, currentTime(), InspectorPageAgent::resourceTypeJson(m_resourcesData->resourceType(requestId)), error.localizedDescription(), canceled ? &canceled : 0);
} }
void InspectorResourceAgent::scriptImported(unsigned long identifier, const String& sourceString) void InspectorResourceAgent::scriptImported(unsigned long identifier, const String& sourceString)
...@@ -454,6 +454,7 @@ void InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient(uns ...@@ -454,6 +454,7 @@ void InspectorResourceAgent::documentThreadableLoaderStartedLoadingForClient(uns
if (it == m_pendingXHRReplayData.end()) if (it == m_pendingXHRReplayData.end())
return; return;
m_resourcesData->setResourceType(IdentifiersFactory::requestId(identifier), InspectorPageAgent::XHRResource);
XHRReplayData* xhrReplayData = it->value.get(); XHRReplayData* xhrReplayData = it->value.get();
String requestId = IdentifiersFactory::requestId(identifier); String requestId = IdentifiersFactory::requestId(identifier);
m_resourcesData->setXHRReplayData(requestId, xhrReplayData); m_resourcesData->setXHRReplayData(requestId, xhrReplayData);
......
...@@ -341,16 +341,18 @@ WebInspector.NetworkDispatcher.prototype = { ...@@ -341,16 +341,18 @@ WebInspector.NetworkDispatcher.prototype = {
/** /**
* @param {!NetworkAgent.RequestId} requestId * @param {!NetworkAgent.RequestId} requestId
* @param {!NetworkAgent.Timestamp} time * @param {!NetworkAgent.Timestamp} time
* @param {!PageAgent.ResourceType} resourceType
* @param {string} localizedDescription * @param {string} localizedDescription
* @param {boolean=} canceled * @param {boolean=} canceled
*/ */
loadingFailed: function(requestId, time, localizedDescription, canceled) loadingFailed: function(requestId, time, resourceType, localizedDescription, canceled)
{ {
var networkRequest = this._inflightRequestsById[requestId]; var networkRequest = this._inflightRequestsById[requestId];
if (!networkRequest) if (!networkRequest)
return; return;
networkRequest.failed = true; networkRequest.failed = true;
networkRequest.type = WebInspector.resourceTypes[resourceType];
networkRequest.canceled = canceled; networkRequest.canceled = canceled;
networkRequest.localizedFailDescription = localizedDescription; networkRequest.localizedFailDescription = localizedDescription;
this._finishNetworkRequest(networkRequest, time, -1); this._finishNetworkRequest(networkRequest, time, -1);
......
...@@ -1252,6 +1252,7 @@ ...@@ -1252,6 +1252,7 @@
"parameters": [ "parameters": [
{ "name": "requestId", "$ref": "RequestId", "description": "Request identifier." }, { "name": "requestId", "$ref": "RequestId", "description": "Request identifier." },
{ "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." }, { "name": "timestamp", "$ref": "Timestamp", "description": "Timestamp." },
{ "name": "type", "$ref": "Page.ResourceType", "description": "Resource type." },
{ "name": "errorText", "type": "string", "description": "User friendly error message." }, { "name": "errorText", "type": "string", "description": "User friendly error message." },
{ "name": "canceled", "type": "boolean", "optional": true, "description": "True if loading was canceled." } { "name": "canceled", "type": "boolean", "optional": true, "description": "True if loading was canceled." }
] ]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment