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

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

Issue 1030473002: DevTools: Ignore mimetype mismatch for Image, Script, StyleSheet (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/http/tests/inspector/network/script-as-text-loading-with-caret-expected.txt ('k') | 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 RequestUpdated: "RequestUpdated", 54 RequestUpdated: "RequestUpdated",
55 RequestFinished: "RequestFinished", 55 RequestFinished: "RequestFinished",
56 RequestUpdateDropped: "RequestUpdateDropped" 56 RequestUpdateDropped: "RequestUpdateDropped"
57 } 57 }
58 58
59 WebInspector.NetworkManager._MIMETypes = { 59 WebInspector.NetworkManager._MIMETypes = {
60 "text/html": {"document": true}, 60 "text/html": {"document": true},
61 "text/xml": {"document": true}, 61 "text/xml": {"document": true},
62 "text/plain": {"document": true}, 62 "text/plain": {"document": true},
63 "application/xhtml+xml": {"document": true}, 63 "application/xhtml+xml": {"document": true},
64 "image/svg+xml": {"document": true},
64 "text/css": {"stylesheet": true}, 65 "text/css": {"stylesheet": true},
65 "text/xsl": {"stylesheet": true}, 66 "text/xsl": {"stylesheet": true},
66 "image/jpg": {"image": true},
67 "image/jpeg": {"image": true},
68 "image/pjpeg": {"image": true},
69 "image/png": {"image": true},
70 "image/gif": {"image": true},
71 "image/bmp": {"image": true},
72 "image/svg+xml": {"image": true, "font": true, "document": tru e},
73 "image/vnd.microsoft.icon": {"image": true},
74 "image/webp": {"image": true},
75 "image/x-icon": {"image": true},
76 "image/x-xbitmap": {"image": true},
77 "font/ttf": {"font": true},
78 "font/otf": {"font": true},
79 "font/woff": {"font": true},
80 "font/woff2": {"font": true},
81 "font/truetype": {"font": true},
82 "font/opentype": {"font": true},
83 "application/octet-stream": {"font": true, "image": true},
84 "application/font-woff": {"font": true},
85 "application/font-woff2": {"font": true},
86 "application/x-font-woff": {"font": true},
87 "application/x-font-type1": {"font": true},
88 "application/x-font-ttf": {"font": true},
89 "application/x-truetype-font": {"font": true},
90 "text/javascript": {"script": true},
91 "text/ecmascript": {"script": true},
92 "application/javascript": {"script": true},
93 "application/ecmascript": {"script": true},
94 "application/x-javascript": {"script": true},
95 "application/json": {"script": true},
96 "text/javascript1.1": {"script": true},
97 "text/javascript1.2": {"script": true},
98 "text/javascript1.3": {"script": true},
99 "text/jscript": {"script": true},
100 "text/livescript": {"script": true},
101 "text/vtt": {"texttrack": true}, 67 "text/vtt": {"texttrack": true},
102 } 68 }
103 69
104 /** 70 /**
105 * @param {string} url 71 * @param {string} url
106 * @param {?Object.<string, string>} headers 72 * @param {?Object.<string, string>} headers
107 * @param {function(number, !Object.<string, string>, string)} callback 73 * @param {function(number, !Object.<string, string>, string)} callback
108 */ 74 */
109 WebInspector.NetworkManager.loadResourceForFrontend = function(url, headers, cal lback) 75 WebInspector.NetworkManager.loadResourceForFrontend = function(url, headers, cal lback)
110 { 76 {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // If status is an error, content is likely to be of an inconsistent typ e, 247 // If status is an error, content is likely to be of an inconsistent typ e,
282 // as it's going to be an error message. We do not want to emit a warnin g 248 // as it's going to be an error message. We do not want to emit a warnin g
283 // for this, though, as this will already be reported as resource loadin g failure. 249 // for this, though, as this will already be reported as resource loadin g failure.
284 // Also, if a URL like http://localhost/wiki/load.php?debug=true&lang=en produces text/css and gets reloaded, 250 // Also, if a URL like http://localhost/wiki/load.php?debug=true&lang=en produces text/css and gets reloaded,
285 // it is 304 Not Modified and its guessed mime-type is text/php, which i s wrong. 251 // it is 304 Not Modified and its guessed mime-type is text/php, which i s wrong.
286 // Don't check for mime-types in 304-resources. 252 // Don't check for mime-types in 304-resources.
287 if (networkRequest.hasErrorStatusCode() || networkRequest.statusCode === 304 || networkRequest.statusCode === 204) 253 if (networkRequest.hasErrorStatusCode() || networkRequest.statusCode === 304 || networkRequest.statusCode === 204)
288 return true; 254 return true;
289 255
290 var resourceType = networkRequest.resourceType(); 256 var resourceType = networkRequest.resourceType();
291 if (resourceType === undefined 257 if (resourceType !== WebInspector.resourceTypes.Stylesheet &&
292 || resourceType === WebInspector.resourceTypes.Other 258 resourceType !== WebInspector.resourceTypes.Document &&
293 || resourceType === WebInspector.resourceTypes.Media 259 resourceType !== WebInspector.resourceTypes.TextTrack) {
294 || resourceType === WebInspector.resourceTypes.XHR
295 || resourceType === WebInspector.resourceTypes.WebSocket)
296 return true; 260 return true;
261 }
297 262
298 if (!networkRequest.mimeType) 263 if (!networkRequest.mimeType)
299 return true; // Might be not known for cached resources with null re sponses. 264 return true; // Might be not known for cached resources with null re sponses.
300 265
301 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes) 266 if (networkRequest.mimeType in WebInspector.NetworkManager._MIMETypes)
302 return resourceType.name() in WebInspector.NetworkManager._MIMETypes [networkRequest.mimeType]; 267 return resourceType.name() in WebInspector.NetworkManager._MIMETypes [networkRequest.mimeType];
303 268
304 return false; 269 return false;
305 }, 270 },
306 271
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 target.networkAgent().emulateNetworkConditions(this._networkConditio ns.offline, this._networkConditions.latency, 690 target.networkAgent().emulateNetworkConditions(this._networkConditio ns.offline, this._networkConditions.latency,
726 this._networkConditions.throughput, this._networkConditions.thro ughput); 691 this._networkConditions.throughput, this._networkConditions.thro ughput);
727 } 692 }
728 } 693 }
729 } 694 }
730 695
731 /** 696 /**
732 * @type {!WebInspector.MultitargetNetworkManager} 697 * @type {!WebInspector.MultitargetNetworkManager}
733 */ 698 */
734 WebInspector.multitargetNetworkManager; 699 WebInspector.multitargetNetworkManager;
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/inspector/network/script-as-text-loading-with-caret-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698