| 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (!networkRequest.mimeType) | 224 if (!networkRequest.mimeType) |
| 225 return true; // Might be not known for cached resources with null re
sponses. | 225 return true; // Might be not known for cached resources with null re
sponses. |
| 226 | 226 |
| 227 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes) | 227 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes) |
| 228 return networkRequest.type.name() in WebInspector.NetworkManager._MI
METypes[networkRequest.mimeType]; | 228 return networkRequest.type.name() in WebInspector.NetworkManager._MI
METypes[networkRequest.mimeType]; |
| 229 | 229 |
| 230 return false; | 230 return false; |
| 231 }, | 231 }, |
| 232 | 232 |
| 233 /** | 233 /** |
| 234 * @param {WebInspector.NetworkRequest} networkRequest | |
| 235 * @param {?NetworkAgent.CachedResource} cachedResource | |
| 236 */ | |
| 237 _updateNetworkRequestWithCachedResource: function(networkRequest, cachedReso
urce) | |
| 238 { | |
| 239 networkRequest.type = WebInspector.resourceTypes[cachedResource.type]; | |
| 240 networkRequest.resourceSize = cachedResource.bodySize; | |
| 241 this._updateNetworkRequestWithResponse(networkRequest, cachedResource.re
sponse); | |
| 242 }, | |
| 243 | |
| 244 /** | |
| 245 * @param {NetworkAgent.Response} response | 234 * @param {NetworkAgent.Response} response |
| 246 * @return {boolean} | 235 * @return {boolean} |
| 247 */ | 236 */ |
| 248 _isNull: function(response) | 237 _isNull: function(response) |
| 249 { | 238 { |
| 250 if (!response) | 239 if (!response) |
| 251 return true; | 240 return true; |
| 252 return !response.status && !response.mimeType && (!response.headers || !
Object.keys(response.headers).length); | 241 return !response.status && !response.mimeType && (!response.headers || !
Object.keys(response.headers).length); |
| 253 }, | 242 }, |
| 254 | 243 |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 return; | 361 return; |
| 373 | 362 |
| 374 networkRequest.failed = true; | 363 networkRequest.failed = true; |
| 375 networkRequest.canceled = canceled; | 364 networkRequest.canceled = canceled; |
| 376 networkRequest.localizedFailDescription = localizedDescription; | 365 networkRequest.localizedFailDescription = localizedDescription; |
| 377 this._finishNetworkRequest(networkRequest, time); | 366 this._finishNetworkRequest(networkRequest, time); |
| 378 }, | 367 }, |
| 379 | 368 |
| 380 /** | 369 /** |
| 381 * @param {NetworkAgent.RequestId} requestId | 370 * @param {NetworkAgent.RequestId} requestId |
| 382 * @param {PageAgent.FrameId} frameId | |
| 383 * @param {NetworkAgent.LoaderId} loaderId | |
| 384 * @param {string} documentURL | |
| 385 * @param {NetworkAgent.Timestamp} time | |
| 386 * @param {NetworkAgent.Initiator} initiator | |
| 387 * @param {NetworkAgent.CachedResource} cachedResource | |
| 388 */ | |
| 389 requestServedFromMemoryCache: function(requestId, frameId, loaderId, documen
tURL, time, initiator, cachedResource) | |
| 390 { | |
| 391 var networkRequest = this._createNetworkRequest(requestId, frameId, load
erId, cachedResource.url, documentURL, initiator); | |
| 392 this._updateNetworkRequestWithCachedResource(networkRequest, cachedResou
rce); | |
| 393 networkRequest.cached = true; | |
| 394 networkRequest.requestMethod = "GET"; | |
| 395 this._startNetworkRequest(networkRequest); | |
| 396 networkRequest.startTime = networkRequest.responseReceivedTime = time; | |
| 397 this._finishNetworkRequest(networkRequest, time); | |
| 398 }, | |
| 399 | |
| 400 /** | |
| 401 * @param {NetworkAgent.RequestId} requestId | |
| 402 * @param {string} requestURL | 371 * @param {string} requestURL |
| 403 */ | 372 */ |
| 404 webSocketCreated: function(requestId, requestURL) | 373 webSocketCreated: function(requestId, requestURL) |
| 405 { | 374 { |
| 406 var networkRequest = new WebInspector.NetworkRequest(requestId, requestU
RL, "", "", ""); | 375 var networkRequest = new WebInspector.NetworkRequest(requestId, requestU
RL, "", "", ""); |
| 407 networkRequest.type = WebInspector.resourceTypes.WebSocket; | 376 networkRequest.type = WebInspector.resourceTypes.WebSocket; |
| 408 this._startNetworkRequest(networkRequest); | 377 this._startNetworkRequest(networkRequest); |
| 409 }, | 378 }, |
| 410 | 379 |
| 411 /** | 380 /** |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 var networkRequest = new WebInspector.NetworkRequest(requestId, url, doc
umentURL, frameId, loaderId); | 551 var networkRequest = new WebInspector.NetworkRequest(requestId, url, doc
umentURL, frameId, loaderId); |
| 583 networkRequest.initiator = initiator; | 552 networkRequest.initiator = initiator; |
| 584 return networkRequest; | 553 return networkRequest; |
| 585 } | 554 } |
| 586 } | 555 } |
| 587 | 556 |
| 588 /** | 557 /** |
| 589 * @type {?WebInspector.NetworkManager} | 558 * @type {?WebInspector.NetworkManager} |
| 590 */ | 559 */ |
| 591 WebInspector.networkManager = null; | 560 WebInspector.networkManager = null; |
| OLD | NEW |