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); | |
dgozman
2015/08/19 20:22:30
Should we just report empty certificate details?
lgarron
2015/08/19 22:51:33
I didn't want to think about dealing with that cas
| |
377 return; | |
378 } | |
379 eventData.securityDetails.certificateDetails = certificateDetail s; | |
380 this._manager.dispatchEventToListeners(WebInspector.NetworkManag er.EventTypes.ResponseReceivedSecurityDetails, eventData); | |
381 } | |
382 | |
383 eventData.securityDetails = response.securityDetails; | |
384 this._manager._networkAgent.getCertificateDetails(response.securityD etails.certificateId, callback.bind(this)); | |
385 | |
dgozman
2015/08/19 20:22:30
nit: extra blank line
lgarron
2015/08/19 22:51:33
Removed.
| |
386 } else { | |
387 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.ResponseReceivedSecurityDetails, eventData); | |
388 } | |
389 }, | |
390 | |
391 /** | |
355 * @override | 392 * @override |
356 * @param {!NetworkAgent.RequestId} requestId | 393 * @param {!NetworkAgent.RequestId} requestId |
357 * @param {!NetworkAgent.Timestamp} time | 394 * @param {!NetworkAgent.Timestamp} time |
358 * @param {number} dataLength | 395 * @param {number} dataLength |
359 * @param {number} encodedDataLength | 396 * @param {number} encodedDataLength |
360 */ | 397 */ |
361 dataReceived: function(requestId, time, dataLength, encodedDataLength) | 398 dataReceived: function(requestId, time, dataLength, encodedDataLength) |
362 { | 399 { |
363 var networkRequest = this._inflightRequestsById[requestId]; | 400 var networkRequest = this._inflightRequestsById[requestId]; |
364 if (!networkRequest) | 401 if (!networkRequest) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 this._userAgent = userAgent; | 715 this._userAgent = userAgent; |
679 for (var target of WebInspector.targetManager.targets()) | 716 for (var target of WebInspector.targetManager.targets()) |
680 target.networkAgent().setUserAgentOverride(this._userAgent); | 717 target.networkAgent().setUserAgentOverride(this._userAgent); |
681 } | 718 } |
682 } | 719 } |
683 | 720 |
684 /** | 721 /** |
685 * @type {!WebInspector.MultitargetNetworkManager} | 722 * @type {!WebInspector.MultitargetNetworkManager} |
686 */ | 723 */ |
687 WebInspector.multitargetNetworkManager; | 724 WebInspector.multitargetNetworkManager; |
OLD | NEW |