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

Unified Diff: Source/devtools/front_end/SourceMap.js

Issue 18341003: DevTools: [CodeMirror] Add syntax highlighting for some other languages. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/SourceMap.js
diff --git a/Source/devtools/front_end/SourceMap.js b/Source/devtools/front_end/SourceMap.js
index 9aff06c0f79b58375e96d79da2a863bc791e7240..802b2df86b2cc0c3acd0909a245c9924c596096a 100644
--- a/Source/devtools/front_end/SourceMap.js
+++ b/Source/devtools/front_end/SourceMap.js
@@ -109,16 +109,16 @@ WebInspector.SourceMap.prototype = {
/**
* @param {string} sourceURL
* @param {WebInspector.ResourceType} contentType
- * @param {string=} mimeType
* @return {WebInspector.ContentProvider}
*/
- sourceContentProvider: function(sourceURL, contentType, mimeType)
+ sourceContentProvider: function(sourceURL, contentType)
{
- // FIXME: We should detect mime type automatically (e.g. based on file extension)
+ var lastIndexOfDot = sourceURL.lastIndexOf(".");
+ var extension = lastIndexOfDot !== -1 ? sourceURL.substr(lastIndexOfDot + 1) : "";
+ var mimeType = WebInspector.ResourceType.mimeTypesForExtensions[extension.toLowerCase()];
var sourceContent = this.sourceContent(sourceURL);
- var contentProvider;
if (sourceContent)
- return new WebInspector.StaticContentProvider(contentType, sourceContent);
+ return new WebInspector.StaticContentProvider(contentType, sourceContent, mimeType);
return new WebInspector.CompilerSourceMappingContentProvider(sourceURL, contentType, mimeType);
},

Powered by Google App Engine
This is Rietveld 408576698