| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 resource.timing = response.timing; | 108 resource.timing = response.timing; |
| 109 }, | 109 }, |
| 110 | 110 |
| 111 _updateResourceWithCachedResource: function(resource, cachedResource) | 111 _updateResourceWithCachedResource: function(resource, cachedResource) |
| 112 { | 112 { |
| 113 resource.type = WebInspector.Resource.Type[cachedResource.type]; | 113 resource.type = WebInspector.Resource.Type[cachedResource.type]; |
| 114 resource.resourceSize = cachedResource.bodySize; | 114 resource.resourceSize = cachedResource.bodySize; |
| 115 this._updateResourceWithResponse(resource, cachedResource.response); | 115 this._updateResourceWithResponse(resource, cachedResource.response); |
| 116 }, | 116 }, |
| 117 | 117 |
| 118 _isNull: function(response) |
| 119 { |
| 120 return response && !response.status && !response.mimeType && !Object.key
s(response.headers).length; |
| 121 }, |
| 122 |
| 118 requestWillBeSent: function(identifier, frameId, loaderId, documentURL, requ
est, time, stackTrace, redirectResponse) | 123 requestWillBeSent: function(identifier, frameId, loaderId, documentURL, requ
est, time, stackTrace, redirectResponse) |
| 119 { | 124 { |
| 120 var resource = this._inflightResourcesById[identifier]; | 125 var resource = this._inflightResourcesById[identifier]; |
| 121 if (resource) { | 126 if (resource) { |
| 127 // FIXME: move this check to the backend. |
| 128 if (this._isNull(redirectResponse)) |
| 129 return; |
| 122 this.responseReceived(identifier, time, "Other", redirectResponse); | 130 this.responseReceived(identifier, time, "Other", redirectResponse); |
| 123 resource = this._appendRedirect(identifier, time, request.url); | 131 resource = this._appendRedirect(identifier, time, request.url); |
| 124 } else | 132 } else |
| 125 resource = this._createResource(identifier, frameId, loaderId, reque
st.url, documentURL, stackTrace); | 133 resource = this._createResource(identifier, frameId, loaderId, reque
st.url, documentURL, stackTrace); |
| 126 this._updateResourceWithRequest(resource, request); | 134 this._updateResourceWithRequest(resource, request); |
| 127 resource.startTime = time; | 135 resource.startTime = time; |
| 128 | 136 |
| 129 this._startResource(resource); | 137 this._startResource(resource); |
| 130 }, | 138 }, |
| 131 | 139 |
| 132 resourceMarkedAsCached: function(identifier) | 140 resourceMarkedAsCached: function(identifier) |
| 133 { | 141 { |
| 134 var resource = this._inflightResourcesById[identifier]; | 142 var resource = this._inflightResourcesById[identifier]; |
| 135 if (!resource) | 143 if (!resource) |
| 136 return; | 144 return; |
| 137 | 145 |
| 138 resource.cached = true; | 146 resource.cached = true; |
| 139 this._updateResource(resource); | 147 this._updateResource(resource); |
| 140 }, | 148 }, |
| 141 | 149 |
| 142 responseReceived: function(identifier, time, resourceType, response) | 150 responseReceived: function(identifier, time, resourceType, response) |
| 143 { | 151 { |
| 152 // FIXME: move this check to the backend. |
| 153 if (this._isNull(response)) |
| 154 return; |
| 155 |
| 144 var resource = this._inflightResourcesById[identifier]; | 156 var resource = this._inflightResourcesById[identifier]; |
| 145 if (!resource) | 157 if (!resource) |
| 146 return; | 158 return; |
| 147 | 159 |
| 148 resource.responseReceivedTime = time; | 160 resource.responseReceivedTime = time; |
| 149 resource.type = WebInspector.Resource.Type[resourceType]; | 161 resource.type = WebInspector.Resource.Type[resourceType]; |
| 150 | 162 |
| 151 this._updateResourceWithResponse(resource, response); | 163 this._updateResourceWithResponse(resource, response); |
| 152 | 164 |
| 153 this._updateResource(resource); | 165 this._updateResource(resource); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 _createResource: function(identifier, frameId, loaderId, url, documentURL, s
tackTrace) | 330 _createResource: function(identifier, frameId, loaderId, url, documentURL, s
tackTrace) |
| 319 { | 331 { |
| 320 var resource = new WebInspector.Resource(identifier, url); | 332 var resource = new WebInspector.Resource(identifier, url); |
| 321 resource.documentURL = documentURL; | 333 resource.documentURL = documentURL; |
| 322 resource.frameId = frameId; | 334 resource.frameId = frameId; |
| 323 resource.loaderId = loaderId; | 335 resource.loaderId = loaderId; |
| 324 resource.stackTrace = stackTrace; | 336 resource.stackTrace = stackTrace; |
| 325 return resource; | 337 return resource; |
| 326 } | 338 } |
| 327 } | 339 } |
| OLD | NEW |