Chromium Code Reviews| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 { | 187 { |
| 188 if (!result) | 188 if (!result) |
| 189 return; | 189 return; |
| 190 | 190 |
| 191 WebInspector.console.showPromise().then(reportUponEvaluation); | 191 WebInspector.console.showPromise().then(reportUponEvaluation); |
| 192 function reportUponEvaluation() | 192 function reportUponEvaluation() |
| 193 { | 193 { |
| 194 target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleMod el.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: text, c ommandMessage: commandMessage, exceptionDetails: exceptionDetails}); | 194 target.consoleModel.dispatchEventToListeners(WebInspector.ConsoleMod el.Events.CommandEvaluated, {result: result, wasThrown: wasThrown, text: text, c ommandMessage: commandMessage, exceptionDetails: exceptionDetails}); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 | 197 |
| 198 executionContext.evaluate(text, "console", useCommandLineAPI, false, false, true, printResult); | 198 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
| |
| 199 if (WebInspector.languageService.handles.transpile(mime)) { | |
| 200 var location = executionContext.pauseLocation(); | |
| 201 var prom = WebInspector.ConsoleModel._pendingTranspileResult = WebInspec tor.languageService.transpile(mime, text, location); | |
| 202 prom.then(result => { | |
| 203 if (WebInspector.ConsoleModel._pendingTranspileResult !== prom) { | |
| 204 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
| |
| 205 } | |
| 206 executionContext.evaluate(result, "console", !!useCommandLineAPI, fa lse, false, true, printResult); | |
| 207 }) | |
| 208 .catch(err => { | |
| 209 //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
| |
| 210 throw err; | |
| 211 }); | |
| 212 } else { | |
| 213 executionContext.evaluate(text, "console", useCommandLineAPI, false, fal se, true, printResult); | |
| 214 } | |
| 199 | 215 |
| 200 WebInspector.userMetrics.ConsoleEvaluated.record(); | 216 WebInspector.userMetrics.ConsoleEvaluated.record(); |
| 201 } | 217 } |
| 202 | 218 |
| 203 | 219 |
| 204 /** | 220 /** |
| 205 * @constructor | 221 * @constructor |
| 206 * @param {?WebInspector.Target} target | 222 * @param {?WebInspector.Target} target |
| 207 * @param {string} source | 223 * @param {string} source |
| 208 * @param {?string} level | 224 * @param {?string} level |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEv aluated, event.data); | 606 this.dispatchEventToListeners(WebInspector.ConsoleModel.Events.CommandEv aluated, event.data); |
| 591 }, | 607 }, |
| 592 | 608 |
| 593 __proto__: WebInspector.Object.prototype | 609 __proto__: WebInspector.Object.prototype |
| 594 } | 610 } |
| 595 | 611 |
| 596 /** | 612 /** |
| 597 * @type {!WebInspector.MultitargetConsoleModel} | 613 * @type {!WebInspector.MultitargetConsoleModel} |
| 598 */ | 614 */ |
| 599 WebInspector.multitargetConsoleModel; | 615 WebInspector.multitargetConsoleModel; |
| OLD | NEW |