Chromium Code Reviews| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 this._initNetworkConditions(); | 47 this._initNetworkConditions(); |
| 48 this._networkAgent.enable(); | 48 this._networkAgent.enable(); |
| 49 | 49 |
| 50 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis abledSettingChanged, this); | 50 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis abledSettingChanged, this); |
| 51 } | 51 } |
| 52 | 52 |
| 53 WebInspector.NetworkManager.EventTypes = { | 53 WebInspector.NetworkManager.EventTypes = { |
| 54 RequestStarted: "RequestStarted", | 54 RequestStarted: "RequestStarted", |
| 55 RequestUpdated: "RequestUpdated", | 55 RequestUpdated: "RequestUpdated", |
| 56 RequestFinished: "RequestFinished", | 56 RequestFinished: "RequestFinished", |
| 57 RequestUpdateDropped: "RequestUpdateDropped" | 57 RequestUpdateDropped: "RequestUpdateDropped", |
| 58 ResponseReceivedSecurityDetails: "ResponseReceivedSecurityDetails" | |
| 58 } | 59 } |
| 59 | 60 |
| 60 WebInspector.NetworkManager._MIMETypes = { | 61 WebInspector.NetworkManager._MIMETypes = { |
| 61 "text/html": {"document": true}, | 62 "text/html": {"document": true}, |
| 62 "text/xml": {"document": true}, | 63 "text/xml": {"document": true}, |
| 63 "text/plain": {"document": true}, | 64 "text/plain": {"document": true}, |
| 64 "application/xhtml+xml": {"document": true}, | 65 "application/xhtml+xml": {"document": true}, |
| 65 "image/svg+xml": {"document": true}, | 66 "image/svg+xml": {"document": true}, |
| 66 "text/css": {"stylesheet": true}, | 67 "text/css": {"stylesheet": true}, |
| 67 "text/xsl": {"stylesheet": true}, | 68 "text/xsl": {"stylesheet": true}, |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.RequestUpdateDropped, eventData); | 343 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.RequestUpdateDropped, eventData); |
| 343 return; | 344 return; |
| 344 } | 345 } |
| 345 | 346 |
| 346 networkRequest.responseReceivedTime = time; | 347 networkRequest.responseReceivedTime = time; |
| 347 networkRequest.setResourceType(WebInspector.resourceTypes[resourceType]) ; | 348 networkRequest.setResourceType(WebInspector.resourceTypes[resourceType]) ; |
| 348 | 349 |
| 349 this._updateNetworkRequestWithResponse(networkRequest, response); | 350 this._updateNetworkRequestWithResponse(networkRequest, response); |
| 350 | 351 |
| 351 this._updateNetworkRequest(networkRequest); | 352 this._updateNetworkRequest(networkRequest); |
| 353 | |
| 354 this._dispatchResponseReceivedSecurityDetails(requestId, response); | |
| 352 }, | 355 }, |
| 353 | 356 |
| 354 /** | 357 /** |
| 358 * @param {!NetworkAgent.RequestId} requestId | |
| 359 * @param {!NetworkAgent.Response} response | |
| 360 */ | |
| 361 _dispatchResponseReceivedSecurityDetails: function(requestId, response) | |
| 362 { | |
| 363 var eventData = {}; | |
| 364 eventData.requestId = requestId; | |
| 365 eventData.origin = WebInspector.ParsedURL.splitURLIntoPathComponents(res ponse.url)[0]; | |
| 366 eventData.securityState = response.securityState; | |
| 367 if (response.securityDetails) { | |
| 368 /** | |
| 369 * @this {WebInspector.NetworkDispatcher} | |
| 370 * @param {?Protocol.Error} error | |
| 371 * @param {!NetworkAgent.CertificateDetails} certificateDetails | |
| 372 */ | |
| 373 function callback(error, certificateDetails) | |
| 374 { | |
| 375 if (error) { | |
| 376 console.error("Unable to get certificate details from the br owser (for certificate ID ", response.securityDetails.certificateId, "): ", erro r); | |
| 377 return; | |
| 378 } else { | |
|
dgozman
2015/08/19 01:51:35
No need for |else| because of return.
lgarron
2015/08/19 02:24:24
Done.
| |
| 379 eventData.securityDetails.certificateDetails = certificateDe tails; | |
| 380 } | |
| 381 this._manager.dispatchEventToListeners(WebInspector.NetworkManag er.EventTypes.ResponseReceivedSecurityDetails, eventData); | |
| 382 } | |
| 383 | |
| 384 eventData.securityDetails = response.securityDetails; | |
| 385 this._manager._networkAgent.getCertificateDetails(response.securityD etails.certificateId, callback.bind(this)); | |
| 386 | |
| 387 } else { | |
| 388 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.ResponseReceivedSecurityDetails, eventData); | |
| 389 } | |
| 390 }, | |
| 391 | |
| 392 /** | |
| 355 * @override | 393 * @override |
| 356 * @param {!NetworkAgent.RequestId} requestId | 394 * @param {!NetworkAgent.RequestId} requestId |
| 357 * @param {!NetworkAgent.Timestamp} time | 395 * @param {!NetworkAgent.Timestamp} time |
| 358 * @param {number} dataLength | 396 * @param {number} dataLength |
| 359 * @param {number} encodedDataLength | 397 * @param {number} encodedDataLength |
| 360 */ | 398 */ |
| 361 dataReceived: function(requestId, time, dataLength, encodedDataLength) | 399 dataReceived: function(requestId, time, dataLength, encodedDataLength) |
| 362 { | 400 { |
| 363 var networkRequest = this._inflightRequestsById[requestId]; | 401 var networkRequest = this._inflightRequestsById[requestId]; |
| 364 if (!networkRequest) | 402 if (!networkRequest) |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 678 this._userAgent = userAgent; | 716 this._userAgent = userAgent; |
| 679 for (var target of WebInspector.targetManager.targets()) | 717 for (var target of WebInspector.targetManager.targets()) |
| 680 target.networkAgent().setUserAgentOverride(this._userAgent); | 718 target.networkAgent().setUserAgentOverride(this._userAgent); |
| 681 } | 719 } |
| 682 } | 720 } |
| 683 | 721 |
| 684 /** | 722 /** |
| 685 * @type {!WebInspector.MultitargetNetworkManager} | 723 * @type {!WebInspector.MultitargetNetworkManager} |
| 686 */ | 724 */ |
| 687 WebInspector.multitargetNetworkManager; | 725 WebInspector.multitargetNetworkManager; |
| OLD | NEW |