OLD | NEW |
---|---|
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 if (!method) | 62 if (!method) |
63 return; | 63 return; |
64 | 64 |
65 switch (method) { | 65 switch (method) { |
66 case "format": | 66 case "format": |
67 WebInspector.format(params.mimeType, params.content, params.indentString ); | 67 WebInspector.format(params.mimeType, params.content, params.indentString ); |
68 break; | 68 break; |
69 case "parseCSS": | 69 case "parseCSS": |
70 WebInspector.parseCSS(params.content); | 70 WebInspector.parseCSS(params.content); |
71 break; | 71 break; |
72 case "parseSCSS": | |
73 WebInspector.Parser.parse(params.content, "text/x-scss"); | |
74 break; | |
72 case "javaScriptOutline": | 75 case "javaScriptOutline": |
73 WebInspector.javaScriptOutline(params.content); | 76 WebInspector.javaScriptOutline(params.content); |
74 break; | 77 break; |
75 case "javaScriptIdentifiers": | 78 case "javaScriptIdentifiers": |
76 WebInspector.javaScriptIdentifiers(params.content); | 79 WebInspector.javaScriptIdentifiers(params.content); |
77 break; | 80 break; |
78 case "evaluatableJavaScriptSubstring": | 81 case "evaluatableJavaScriptSubstring": |
79 WebInspector.evaluatableJavaScriptSubstring(params.content); | 82 WebInspector.evaluatableJavaScriptSubstring(params.content); |
80 break; | 83 break; |
81 case "relaxedJSONParser": | 84 case "relaxedJSONParser": |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 } | 224 } |
222 result.mapping = builder.mapping(); | 225 result.mapping = builder.mapping(); |
223 result.content = builder.content(); | 226 result.content = builder.content(); |
224 } catch (e) { | 227 } catch (e) { |
225 console.error(e); | 228 console.error(e); |
226 result.mapping = { original: [0], formatted: [0] }; | 229 result.mapping = { original: [0], formatted: [0] }; |
227 result.content = text; | 230 result.content = text; |
228 } | 231 } |
229 postMessage(result); | 232 postMessage(result); |
230 } | 233 } |
234 | |
235 /** | |
236 * @interface | |
237 */ | |
238 WebInspector.Parser = function() { } | |
dgozman
2016/04/29 02:10:07
WebInspector.FormatterWorker.ContentParser
lushnikov
2016/04/29 02:31:35
Done.
| |
239 | |
240 WebInspector.Parser.prototype = { | |
241 /** | |
242 * @param {string} content | |
243 * @return {!Object} | |
244 */ | |
245 parse: function(content) { } | |
246 } | |
247 | |
248 WebInspector.Parser.parse = function(content, mimeType) | |
249 { | |
250 var extension = self.runtime.extensions(WebInspector.Parser).find(findExtens ion); | |
251 console.assert(extension); | |
252 extension.instancePromise() | |
253 .then(instance => instance.parse(content)) | |
254 .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.
| |
255 .catch(e => console.error(e)) | |
dgozman
2016/04/29 02:10:07
style: semicolon missing
lushnikov
2016/04/29 02:31:35
Done.
| |
256 | |
257 /** | |
258 * @param {!Runtime.Extension} extension | |
259 * @return {boolean} | |
260 */ | |
261 function findExtension(extension) | |
262 { | |
263 return extension.descriptor()["mimeType"] === mimeType; | |
264 } | |
265 } | |
OLD | NEW |