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 ReceivedResponseSecurity: "ReceivedResponseSecurity" | |
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 var securityEventData = {}; | |
355 securityEventData.requestId = requestId; | |
356 // TODO(lgarron): This is ridiculously hacky, and should never land as-i s. Calculate the proper origin. | |
dgozman
2015/08/18 18:41:49
Take a look at WebInspector.ParsedURL.
lgarron
2015/08/18 19:37:06
Thanks, that's what I need for now!
(We discussed
| |
357 securityEventData.origin = response.url.split("/").slice(0, 3).join("/") ; | |
358 securityEventData.securityState = response.securityState; | |
359 if (securityEventData.securityDetails) { | |
360 this._manager._networkAgent.getCertificateDetails(response.securityD etails.certificateId, (function(error, certificateDetails) { | |
pfeldman
2015/08/18 18:35:08
Please name the function and annotate it.
lgarron
2015/08/18 19:37:06
Is it alright if I do this inline, or should I add
lgarron
2015/08/18 21:40:58
Actually, it seems _initNetworkConditions has a gr
| |
361 securityEventData.securityDetails = response.securityDetails; | |
362 securityEventData.certificateDetails = certificateDetails; | |
363 this._manager.dispatchEventToListeners(WebInspector.NetworkManag er.EventTypes.ReceivedResponseSecurity, securityEventData); | |
364 }).bind(this)); | |
365 } else { | |
366 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.ReceivedResponseSecurity, securityEventData); | |
367 } | |
352 }, | 368 }, |
353 | 369 |
354 /** | 370 /** |
355 * @override | 371 * @override |
356 * @param {!NetworkAgent.RequestId} requestId | 372 * @param {!NetworkAgent.RequestId} requestId |
357 * @param {!NetworkAgent.Timestamp} time | 373 * @param {!NetworkAgent.Timestamp} time |
358 * @param {number} dataLength | 374 * @param {number} dataLength |
359 * @param {number} encodedDataLength | 375 * @param {number} encodedDataLength |
360 */ | 376 */ |
361 dataReceived: function(requestId, time, dataLength, encodedDataLength) | 377 dataReceived: function(requestId, time, dataLength, encodedDataLength) |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
678 this._userAgent = userAgent; | 694 this._userAgent = userAgent; |
679 for (var target of WebInspector.targetManager.targets()) | 695 for (var target of WebInspector.targetManager.targets()) |
680 target.networkAgent().setUserAgentOverride(this._userAgent); | 696 target.networkAgent().setUserAgentOverride(this._userAgent); |
681 } | 697 } |
682 } | 698 } |
683 | 699 |
684 /** | 700 /** |
685 * @type {!WebInspector.MultitargetNetworkManager} | 701 * @type {!WebInspector.MultitargetNetworkManager} |
686 */ | 702 */ |
687 WebInspector.multitargetNetworkManager; | 703 WebInspector.multitargetNetworkManager; |
OLD | NEW |