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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 RequestUpdated: "RequestUpdated", | 53 RequestUpdated: "RequestUpdated", |
| 54 RequestFinished: "RequestFinished", | 54 RequestFinished: "RequestFinished", |
| 55 RequestUpdateDropped: "RequestUpdateDropped" | 55 RequestUpdateDropped: "RequestUpdateDropped" |
| 56 } | 56 } |
| 57 | 57 |
| 58 WebInspector.NetworkManager._MIMETypes = { | 58 WebInspector.NetworkManager._MIMETypes = { |
| 59 "text/html": {"document": true}, | 59 "text/html": {"document": true}, |
| 60 "text/xml": {"document": true}, | 60 "text/xml": {"document": true}, |
| 61 "text/plain": {"document": true}, | 61 "text/plain": {"document": true}, |
| 62 "application/xhtml+xml": {"document": true}, | 62 "application/xhtml+xml": {"document": true}, |
| 63 "image/svg+xml": {"document": true}, | |
|
paulirish
2015/02/24 20:32:00
Good idea ^
| |
| 63 "text/css": {"stylesheet": true}, | 64 "text/css": {"stylesheet": true}, |
| 64 "text/xsl": {"stylesheet": true}, | 65 "text/xsl": {"stylesheet": true}, |
| 65 "image/jpg": {"image": true}, | |
| 66 "image/jpeg": {"image": true}, | |
| 67 "image/pjpeg": {"image": true}, | |
| 68 "image/png": {"image": true}, | |
| 69 "image/gif": {"image": true}, | |
| 70 "image/bmp": {"image": true}, | |
| 71 "image/svg+xml": {"image": true, "font": true, "document": tru e}, | |
|
pfeldman
2015/02/24 20:27:58
Leave this w/ document: true only?
| |
| 72 "image/vnd.microsoft.icon": {"image": true}, | |
| 73 "image/webp": {"image": true}, | |
| 74 "image/x-icon": {"image": true}, | |
| 75 "image/x-xbitmap": {"image": true}, | |
| 76 "font/ttf": {"font": true}, | |
| 77 "font/otf": {"font": true}, | |
| 78 "font/woff": {"font": true}, | |
| 79 "font/woff2": {"font": true}, | |
| 80 "font/truetype": {"font": true}, | |
| 81 "font/opentype": {"font": true}, | |
| 82 "application/octet-stream": {"font": true, "image": true}, | |
| 83 "application/font-woff": {"font": true}, | |
| 84 "application/font-woff2": {"font": true}, | |
| 85 "application/x-font-woff": {"font": true}, | |
| 86 "application/x-font-type1": {"font": true}, | |
| 87 "application/x-font-ttf": {"font": true}, | |
| 88 "application/x-truetype-font": {"font": true}, | |
| 89 "text/javascript": {"script": true}, | |
| 90 "text/ecmascript": {"script": true}, | |
| 91 "application/javascript": {"script": true}, | |
| 92 "application/ecmascript": {"script": true}, | |
| 93 "application/x-javascript": {"script": true}, | |
| 94 "application/json": {"script": true}, | |
| 95 "text/javascript1.1": {"script": true}, | |
| 96 "text/javascript1.2": {"script": true}, | |
| 97 "text/javascript1.3": {"script": true}, | |
| 98 "text/jscript": {"script": true}, | |
| 99 "text/livescript": {"script": true}, | |
| 100 "text/vtt": {"texttrack": true}, | 66 "text/vtt": {"texttrack": true}, |
| 101 } | 67 } |
| 102 | 68 |
| 103 // Keep in sync with kDevToolsRequestInitiator defined in InspectorResourceAgent .cpp | 69 // Keep in sync with kDevToolsRequestInitiator defined in InspectorResourceAgent .cpp |
| 104 WebInspector.NetworkManager._devToolsRequestHeader = "X-DevTools-Request-Initiat or"; | 70 WebInspector.NetworkManager._devToolsRequestHeader = "X-DevTools-Request-Initiat or"; |
| 105 | 71 |
| 106 /** | 72 /** |
| 107 * @param {?WebInspector.NetworkRequest} request | 73 * @param {?WebInspector.NetworkRequest} request |
| 108 * @return {boolean} | 74 * @return {boolean} |
| 109 */ | 75 */ |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 // If status is an error, content is likely to be of an inconsistent typ e, | 224 // If status is an error, content is likely to be of an inconsistent typ e, |
| 259 // as it's going to be an error message. We do not want to emit a warnin g | 225 // as it's going to be an error message. We do not want to emit a warnin g |
| 260 // for this, though, as this will already be reported as resource loadin g failure. | 226 // for this, though, as this will already be reported as resource loadin g failure. |
| 261 // Also, if a URL like http://localhost/wiki/load.php?debug=true&lang=en produces text/css and gets reloaded, | 227 // Also, if a URL like http://localhost/wiki/load.php?debug=true&lang=en produces text/css and gets reloaded, |
| 262 // it is 304 Not Modified and its guessed mime-type is text/php, which i s wrong. | 228 // it is 304 Not Modified and its guessed mime-type is text/php, which i s wrong. |
| 263 // Don't check for mime-types in 304-resources. | 229 // Don't check for mime-types in 304-resources. |
| 264 if (networkRequest.hasErrorStatusCode() || networkRequest.statusCode === 304 || networkRequest.statusCode === 204) | 230 if (networkRequest.hasErrorStatusCode() || networkRequest.statusCode === 304 || networkRequest.statusCode === 204) |
| 265 return true; | 231 return true; |
| 266 | 232 |
| 267 var resourceType = networkRequest.resourceType(); | 233 var resourceType = networkRequest.resourceType(); |
| 268 if (resourceType === undefined | 234 |
| 269 || resourceType === WebInspector.resourceTypes.Other | 235 if (resourceType !== WebInspector.resourceTypes.Stylesheet |
| 270 || resourceType === WebInspector.resourceTypes.Media | 236 && resourceType !== WebInspector.resourceTypes.Document |
| 271 || resourceType === WebInspector.resourceTypes.XHR | 237 && resourceType !== WebInspector.resourceTypes.TextTrack) |
| 272 || resourceType === WebInspector.resourceTypes.WebSocket) | |
| 273 return true; | 238 return true; |
| 274 | 239 |
| 275 if (!networkRequest.mimeType) | 240 if (!networkRequest.mimeType) |
| 276 return true; // Might be not known for cached resources with null re sponses. | 241 return true; // Might be not known for cached resources with null re sponses. |
| 277 | 242 |
| 278 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes) | 243 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes) |
| 279 return resourceType.name() in WebInspector.NetworkManager._MIMETypes [networkRequest.mimeType]; | 244 return resourceType.name() in WebInspector.NetworkManager._MIMETypes [networkRequest.mimeType]; |
| 280 | 245 |
| 281 return false; | 246 return false; |
| 282 }, | 247 }, |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 target.networkAgent().emulateNetworkConditions(this._networkConditio ns.offline, this._networkConditions.latency, | 665 target.networkAgent().emulateNetworkConditions(this._networkConditio ns.offline, this._networkConditions.latency, |
| 701 this._networkConditions.throughput, this._networkConditions.thro ughput); | 666 this._networkConditions.throughput, this._networkConditions.thro ughput); |
| 702 } | 667 } |
| 703 } | 668 } |
| 704 } | 669 } |
| 705 | 670 |
| 706 /** | 671 /** |
| 707 * @type {!WebInspector.MultitargetNetworkManager} | 672 * @type {!WebInspector.MultitargetNetworkManager} |
| 708 */ | 673 */ |
| 709 WebInspector.multitargetNetworkManager; | 674 WebInspector.multitargetNetworkManager; |
| OLD | NEW |