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

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

Issue 1282593003: DevTools: rely on response's "Content-Type" header to refine resource type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebaseline Created 5 years, 4 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) 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 { 258 {
259 return this._url; 259 return this._url;
260 }, 260 },
261 261
262 /** 262 /**
263 * @override 263 * @override
264 * @return {!WebInspector.ResourceType} 264 * @return {!WebInspector.ResourceType}
265 */ 265 */
266 contentType: function() 266 contentType: function()
267 { 267 {
268 if (this.resourceType() === WebInspector.resourceTypes.Document && this. mimeType.indexOf("javascript") !== -1)
269 return WebInspector.resourceTypes.Script;
268 return this.resourceType(); 270 return this.resourceType();
269 }, 271 },
270 272
271 /** 273 /**
272 * @override 274 * @override
273 * @param {function(?string)} callback 275 * @param {function(?string)} callback
274 */ 276 */
275 requestContent: function(callback) 277 requestContent: function(callback)
276 { 278 {
277 if (typeof this._content !== "undefined") { 279 if (typeof this._content !== "undefined") {
278 callback(this._content); 280 callback(this._content);
279 return; 281 return;
280 } 282 }
281 283
282 this._pendingContentCallbacks.push(callback); 284 this._pendingContentCallbacks.push(callback);
283 if (!this._request || this._request.finished) 285 if (!this._request || this._request.finished)
284 this._innerRequestContent(); 286 this._innerRequestContent();
285 }, 287 },
286 288
287 /** 289 /**
288 * @return {string} 290 * @return {string}
289 */ 291 */
290 canonicalMimeType: function() 292 canonicalMimeType: function()
291 { 293 {
292 return this.resourceType().canonicalMimeType() || this.mimeType; 294 return this.contentType().canonicalMimeType() || this.mimeType;
293 }, 295 },
294 296
295 /** 297 /**
296 * @override 298 * @override
297 * @param {string} query 299 * @param {string} query
298 * @param {boolean} caseSensitive 300 * @param {boolean} caseSensitive
299 * @param {boolean} isRegex 301 * @param {boolean} isRegex
300 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback 302 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} cal lback
301 */ 303 */
302 searchInContent: function(query, caseSensitive, isRegex, callback) 304 searchInContent: function(query, caseSensitive, isRegex, callback)
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 if (this._type.isTextType()) 416 if (this._type.isTextType())
415 return true; 417 return true;
416 if (this._type === WebInspector.resourceTypes.Other) 418 if (this._type === WebInspector.resourceTypes.Other)
417 return !!this._content && !this._contentEncoded; 419 return !!this._content && !this._contentEncoded;
418 return false; 420 return false;
419 }, 421 },
420 422
421 __proto__: WebInspector.SDKObject.prototype 423 __proto__: WebInspector.SDKObject.prototype
422 } 424 }
423 425
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