Index: third_party/WebKit/Source/devtools/front_end/formatter_worker/FormatterWorker.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormatterWorker.js b/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormatterWorker.js |
index b7c5227125f65e68446d940cad7340a2127a8f03..b4a6705585618d1e1aa43ae85ccd04b7af7624ad 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormatterWorker.js |
+++ b/third_party/WebKit/Source/devtools/front_end/formatter_worker/FormatterWorker.js |
@@ -69,6 +69,9 @@ self.onmessage = function(event) { |
case "parseCSS": |
WebInspector.parseCSS(params.content); |
break; |
+ case "parseSCSS": |
+ WebInspector.Parser.parse(params.content, "text/x-scss"); |
+ break; |
case "javaScriptOutline": |
WebInspector.javaScriptOutline(params.content); |
break; |
@@ -228,3 +231,35 @@ WebInspector.format = function(mimeType, text, indentString) |
} |
postMessage(result); |
} |
+ |
+/** |
+ * @interface |
+ */ |
+WebInspector.Parser = function() { } |
dgozman
2016/04/29 02:10:07
WebInspector.FormatterWorker.ContentParser
lushnikov
2016/04/29 02:31:35
Done.
|
+ |
+WebInspector.Parser.prototype = { |
+ /** |
+ * @param {string} content |
+ * @return {!Object} |
+ */ |
+ parse: function(content) { } |
+} |
+ |
+WebInspector.Parser.parse = function(content, mimeType) |
+{ |
+ var extension = self.runtime.extensions(WebInspector.Parser).find(findExtension); |
+ console.assert(extension); |
+ extension.instancePromise() |
+ .then(instance => instance.parse(content)) |
+ .then(result => postMessage(result)) |
dgozman
2016/04/29 02:10:07
Let's catch and send null if anything
lushnikov
2016/04/29 02:31:35
Done.
|
+ .catch(e => console.error(e)) |
dgozman
2016/04/29 02:10:07
style: semicolon missing
lushnikov
2016/04/29 02:31:35
Done.
|
+ |
+ /** |
+ * @param {!Runtime.Extension} extension |
+ * @return {boolean} |
+ */ |
+ function findExtension(extension) |
+ { |
+ return extension.descriptor()["mimeType"] === mimeType; |
+ } |
+} |