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 else |
| 378 eventData.securityDetails.certificateDetails = certificateDe
tails; |
| 379 |
| 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 } else { |
| 386 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E
ventTypes.ResponseReceivedSecurityDetails, eventData); |
| 387 } |
| 388 }, |
| 389 |
| 390 /** |
355 * @override | 391 * @override |
356 * @param {!NetworkAgent.RequestId} requestId | 392 * @param {!NetworkAgent.RequestId} requestId |
357 * @param {!NetworkAgent.Timestamp} time | 393 * @param {!NetworkAgent.Timestamp} time |
358 * @param {number} dataLength | 394 * @param {number} dataLength |
359 * @param {number} encodedDataLength | 395 * @param {number} encodedDataLength |
360 */ | 396 */ |
361 dataReceived: function(requestId, time, dataLength, encodedDataLength) | 397 dataReceived: function(requestId, time, dataLength, encodedDataLength) |
362 { | 398 { |
363 var networkRequest = this._inflightRequestsById[requestId]; | 399 var networkRequest = this._inflightRequestsById[requestId]; |
364 if (!networkRequest) | 400 if (!networkRequest) |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 this._userAgent = userAgent; | 714 this._userAgent = userAgent; |
679 for (var target of WebInspector.targetManager.targets()) | 715 for (var target of WebInspector.targetManager.targets()) |
680 target.networkAgent().setUserAgentOverride(this._userAgent); | 716 target.networkAgent().setUserAgentOverride(this._userAgent); |
681 } | 717 } |
682 } | 718 } |
683 | 719 |
684 /** | 720 /** |
685 * @type {!WebInspector.MultitargetNetworkManager} | 721 * @type {!WebInspector.MultitargetNetworkManager} |
686 */ | 722 */ |
687 WebInspector.multitargetNetworkManager; | 723 WebInspector.multitargetNetworkManager; |
OLD | NEW |