Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: Source/devtools/front_end/sdk/NetworkManager.js

Issue 922213004: DevTools: Ignore mimetype mismatch for Image, Script, StyleSheet (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: invert conditional. warn only for document, stylesheet, texttracks. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 "text/css": {"stylesheet": true}, 63 "text/css": {"stylesheet": true},
64 "text/xsl": {"stylesheet": true}, 64 "text/xsl": {"stylesheet": true},
65 "image/jpg": {"image": true}, 65 "image/jpg": {"image": true},
pfeldman 2015/02/24 20:07:18 While you are here, you might want to delete these
paulirish 2015/02/24 20:11:33 Done.
66 "image/jpeg": {"image": true}, 66 "image/jpeg": {"image": true},
67 "image/pjpeg": {"image": true}, 67 "image/pjpeg": {"image": true},
68 "image/png": {"image": true}, 68 "image/png": {"image": true},
69 "image/gif": {"image": true}, 69 "image/gif": {"image": true},
70 "image/bmp": {"image": true}, 70 "image/bmp": {"image": true},
71 "image/svg+xml": {"image": true, "font": true, "document": tru e}, 71 "image/svg+xml": {"image": true, "font": true, "document": tru e},
72 "image/vnd.microsoft.icon": {"image": true}, 72 "image/vnd.microsoft.icon": {"image": true},
73 "image/webp": {"image": true}, 73 "image/webp": {"image": true},
74 "image/x-icon": {"image": true}, 74 "image/x-icon": {"image": true},
75 "image/x-xbitmap": {"image": true}, 75 "image/x-xbitmap": {"image": true},
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // If status is an error, content is likely to be of an inconsistent typ e, 258 // 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 259 // 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. 260 // 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, 261 // 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. 262 // 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. 263 // Don't check for mime-types in 304-resources.
264 if (networkRequest.hasErrorStatusCode() || networkRequest.statusCode === 304 || networkRequest.statusCode === 204) 264 if (networkRequest.hasErrorStatusCode() || networkRequest.statusCode === 304 || networkRequest.statusCode === 204)
265 return true; 265 return true;
266 266
267 var resourceType = networkRequest.resourceType(); 267 var resourceType = networkRequest.resourceType();
268 if (resourceType === undefined 268
269 || resourceType === WebInspector.resourceTypes.Other 269 if (resourceType !== WebInspector.resourceTypes.Stylesheet
270 || resourceType === WebInspector.resourceTypes.Media 270 || resourceType !== WebInspector.resourceTypes.Document
pfeldman 2015/02/24 20:02:31 I wonder if you want to replace || with &&.
paulirish 2015/02/24 20:03:59 Not a bad idea. :) Thx.
paulirish 2015/02/24 20:11:33 Done.
271 || resourceType === WebInspector.resourceTypes.XHR 271 || resourceType !== WebInspector.resourceTypes.TextTrack)
272 || resourceType === WebInspector.resourceTypes.WebSocket)
273 return true; 272 return true;
274 273
275 if (!networkRequest.mimeType) 274 if (!networkRequest.mimeType)
276 return true; // Might be not known for cached resources with null re sponses. 275 return true; // Might be not known for cached resources with null re sponses.
277 276
278 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes) 277 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes)
279 return resourceType.name() in WebInspector.NetworkManager._MIMETypes [networkRequest.mimeType]; 278 return resourceType.name() in WebInspector.NetworkManager._MIMETypes [networkRequest.mimeType];
280 279
281 return false; 280 return false;
282 }, 281 },
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 target.networkAgent().emulateNetworkConditions(this._networkConditio ns.offline, this._networkConditions.latency, 699 target.networkAgent().emulateNetworkConditions(this._networkConditio ns.offline, this._networkConditions.latency,
701 this._networkConditions.throughput, this._networkConditions.thro ughput); 700 this._networkConditions.throughput, this._networkConditions.thro ughput);
702 } 701 }
703 } 702 }
704 } 703 }
705 704
706 /** 705 /**
707 * @type {!WebInspector.MultitargetNetworkManager} 706 * @type {!WebInspector.MultitargetNetworkManager}
708 */ 707 */
709 WebInspector.multitargetNetworkManager; 708 WebInspector.multitargetNetworkManager;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698