| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 this._networkAgent.setCacheDisabled(true); | 44 this._networkAgent.setCacheDisabled(true); |
| 45 if (WebInspector.moduleSetting("monitoringXHREnabled").get()) | 45 if (WebInspector.moduleSetting("monitoringXHREnabled").get()) |
| 46 this._networkAgent.setMonitoringXHREnabled(true); | 46 this._networkAgent.setMonitoringXHREnabled(true); |
| 47 | 47 |
| 48 // Limit buffer when talking to a remote device. | 48 // Limit buffer when talking to a remote device. |
| 49 if (Runtime.queryParam("remoteFrontend") || Runtime.queryParam("ws")) | 49 if (Runtime.queryParam("remoteFrontend") || Runtime.queryParam("ws")) |
| 50 this._networkAgent.enable(10000000, 5000000); | 50 this._networkAgent.enable(10000000, 5000000); |
| 51 else | 51 else |
| 52 this._networkAgent.enable(); | 52 this._networkAgent.enable(); |
| 53 | 53 |
| 54 /** @type {!Map<!SecurityAgent.CertificateId, !Promise<!NetworkAgent.Certifi
cateDetails>>} */ | |
| 55 this._certificateDetailsCache = new Map(); | |
| 56 | |
| 57 this._bypassServiceWorkerSetting = WebInspector.settings.createSetting("bypa
ssServiceWorker", false); | 54 this._bypassServiceWorkerSetting = WebInspector.settings.createSetting("bypa
ssServiceWorker", false); |
| 58 if (this._bypassServiceWorkerSetting.get()) | 55 if (this._bypassServiceWorkerSetting.get()) |
| 59 this._bypassServiceWorkerChanged(); | 56 this._bypassServiceWorkerChanged(); |
| 60 this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorker
Changed, this); | 57 this._bypassServiceWorkerSetting.addChangeListener(this._bypassServiceWorker
Changed, this); |
| 61 | 58 |
| 62 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis
abledSettingChanged, this); | 59 WebInspector.moduleSetting("cacheDisabled").addChangeListener(this._cacheDis
abledSettingChanged, this); |
| 63 } | 60 } |
| 64 | 61 |
| 65 /** @enum {symbol} */ | 62 /** @enum {symbol} */ |
| 66 WebInspector.NetworkManager.Events = { | 63 WebInspector.NetworkManager.Events = { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 var enabled = /** @type {boolean} */ (event.data); | 140 var enabled = /** @type {boolean} */ (event.data); |
| 144 this._networkAgent.setCacheDisabled(enabled); | 141 this._networkAgent.setCacheDisabled(enabled); |
| 145 }, | 142 }, |
| 146 | 143 |
| 147 dispose: function() | 144 dispose: function() |
| 148 { | 145 { |
| 149 WebInspector.moduleSetting("cacheDisabled").removeChangeListener(this._c
acheDisabledSettingChanged, this); | 146 WebInspector.moduleSetting("cacheDisabled").removeChangeListener(this._c
acheDisabledSettingChanged, this); |
| 150 }, | 147 }, |
| 151 | 148 |
| 152 /** | 149 /** |
| 153 * @param {!SecurityAgent.CertificateId} certificateId | |
| 154 * @return {!Promise<!NetworkAgent.CertificateDetails>} | |
| 155 */ | |
| 156 certificateDetailsPromise: function(certificateId) | |
| 157 { | |
| 158 var cachedPromise = this._certificateDetailsCache.get(certificateId); | |
| 159 if (cachedPromise) | |
| 160 return cachedPromise; | |
| 161 | |
| 162 /** | |
| 163 * @this {WebInspector.NetworkManager} | |
| 164 * @param {function(?NetworkAgent.CertificateDetails)} resolve | |
| 165 * @param {function()} reject | |
| 166 */ | |
| 167 function executor(resolve, reject) { | |
| 168 /** | |
| 169 * @param {?Protocol.Error} error | |
| 170 * @param {?NetworkAgent.CertificateDetails} certificateDetails | |
| 171 */ | |
| 172 function innerCallback(error, certificateDetails) | |
| 173 { | |
| 174 if (error) { | |
| 175 console.error("Unable to get certificate details from the br
owser (for certificate ID ", certificateId, "): ", error); | |
| 176 reject(); | |
| 177 } else { | |
| 178 resolve(certificateDetails); | |
| 179 } | |
| 180 } | |
| 181 this._networkAgent.getCertificateDetails(certificateId, innerCallbac
k); | |
| 182 } | |
| 183 | |
| 184 var promise = new Promise(executor.bind(this)); | |
| 185 | |
| 186 this._certificateDetailsCache.set(certificateId, promise); | |
| 187 return promise; | |
| 188 }, | |
| 189 | |
| 190 /** | |
| 191 * @return {!WebInspector.Setting} | 150 * @return {!WebInspector.Setting} |
| 192 */ | 151 */ |
| 193 bypassServiceWorkerSetting: function() | 152 bypassServiceWorkerSetting: function() |
| 194 { | 153 { |
| 195 return this._bypassServiceWorkerSetting; | 154 return this._bypassServiceWorkerSetting; |
| 196 }, | 155 }, |
| 197 | 156 |
| 198 _bypassServiceWorkerChanged: function() | 157 _bypassServiceWorkerChanged: function() |
| 199 { | 158 { |
| 200 this._networkAgent.setBypassServiceWorker(this._bypassServiceWorkerSetti
ng.get()); | 159 this._networkAgent.setBypassServiceWorker(this._bypassServiceWorkerSetti
ng.get()); |
| (...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 945 WebInspector.ResourceLoader.load(url, headers, callback); | 904 WebInspector.ResourceLoader.load(url, headers, callback); |
| 946 }, | 905 }, |
| 947 | 906 |
| 948 __proto__: WebInspector.Object.prototype | 907 __proto__: WebInspector.Object.prototype |
| 949 } | 908 } |
| 950 | 909 |
| 951 /** | 910 /** |
| 952 * @type {!WebInspector.MultitargetNetworkManager} | 911 * @type {!WebInspector.MultitargetNetworkManager} |
| 953 */ | 912 */ |
| 954 WebInspector.multitargetNetworkManager; | 913 WebInspector.multitargetNetworkManager; |
| OLD | NEW |