Index: Source/devtools/front_end/sdk/ConsoleModel.js |
diff --git a/Source/devtools/front_end/sdk/ConsoleModel.js b/Source/devtools/front_end/sdk/ConsoleModel.js |
index 66dec2279101e10e41486cbbebaedaf41671f608..f7244e4345c6ab7282b54fe7da2387bf3d47765e 100644 |
--- a/Source/devtools/front_end/sdk/ConsoleModel.js |
+++ b/Source/devtools/front_end/sdk/ConsoleModel.js |
@@ -194,8 +194,24 @@ WebInspector.ConsoleModel.evaluateCommandInConsole = function(executionContext, |
target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: text, commandMessage: commandMessage, exceptionDetails: exceptionDetails}); |
} |
} |
- |
- executionContext.evaluate(text, "console", useCommandLineAPI, false, false, true, printResult); |
+ |
+ var mime = WebInspector.ResourceType.fromActivePanel(); |
pfeldman
2015/08/13 21:15:46
Use DI for that. We should teach language support
wes
2015/08/14 00:55:05
So, I would declare an 'ActiveMimeExtensionDelegat
pfeldman
2015/08/17 21:15:51
As discussed during our meeting, we should take th
wes
2015/08/25 18:13:18
By the time you had commented this I had actually
|
+ if (WebInspector.languageService.handles.transpile(mime)) { |
+ var location = executionContext.pauseLocation(); |
+ var prom = WebInspector.ConsoleModel._pendingTranspileResult = WebInspector.languageService.transpile(mime, text, location); |
+ prom.then(result => { |
+ if (WebInspector.ConsoleModel._pendingTranspileResult !== prom) { |
+ return; //preempted by a following entry - drop ths one. |
wes
2015/08/14 00:55:05
I don't know if this behavior is desirable, but I
|
+ } |
+ executionContext.evaluate(result, "console", !!useCommandLineAPI, false, false, true, printResult); |
+ }) |
+ .catch(err => { |
+ //TODO: decide how to handle errors? |
wes
2015/08/14 00:55:05
I would like some feedback on how to fulfill this
pfeldman
2015/08/17 21:15:52
- please don't use arrow functions just yet
- that
wes
2015/08/25 18:13:18
If the transpile call throws on the user's end (an
|
+ throw err; |
+ }); |
+ } else { |
+ executionContext.evaluate(text, "console", useCommandLineAPI, false, false, true, printResult); |
+ } |
WebInspector.userMetrics.ConsoleEvaluated.record(); |
} |