| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Joseph Pecoraro | 3 * Copyright (C) 2009 Joseph Pecoraro |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 _printResult: function(result, wasThrown, originatingConsoleMessage, excepti
onDetails) | 789 _printResult: function(result, wasThrown, originatingConsoleMessage, excepti
onDetails) |
| 790 { | 790 { |
| 791 if (!result) | 791 if (!result) |
| 792 return; | 792 return; |
| 793 | 793 |
| 794 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error :
WebInspector.ConsoleMessage.MessageLevel.Log; | 794 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Error :
WebInspector.ConsoleMessage.MessageLevel.Log; |
| 795 var message; | 795 var message; |
| 796 if (!wasThrown) | 796 if (!wasThrown) |
| 797 message = new WebInspector.ConsoleMessage(result.target(), WebInspec
tor.ConsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.Mess
ageType.Result, undefined, undefined, undefined, undefined, [result]); | 797 message = new WebInspector.ConsoleMessage(result.target(), WebInspec
tor.ConsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.Mess
ageType.Result, undefined, undefined, undefined, undefined, [result]); |
| 798 else | 798 else |
| 799 message = new WebInspector.ConsoleMessage(result.target(), WebInspec
tor.ConsoleMessage.MessageSource.JS, level, exceptionDetails.text, WebInspector.
ConsoleMessage.MessageType.Result, exceptionDetails.url, exceptionDetails.lineNu
mber + 1, exceptionDetails.columnNumber + 1, undefined, [WebInspector.UIString("
Uncaught"), result], exceptionDetails.stack, undefined, undefined, exceptionDeta
ils.scriptId); | 799 message = new WebInspector.ConsoleMessage(result.target(), WebInspec
tor.ConsoleMessage.MessageSource.JS, level, exceptionDetails.text, WebInspector.
ConsoleMessage.MessageType.Result, undefined, exceptionDetails.lineNumber + 1, e
xceptionDetails.columnNumber + 1, undefined, [WebInspector.UIString("Uncaught"),
result], exceptionDetails.stackTrace, undefined, undefined, exceptionDetails.sc
riptId); |
| 800 message.setOriginatingMessage(originatingConsoleMessage); | 800 message.setOriginatingMessage(originatingConsoleMessage); |
| 801 result.target().consoleModel.addMessage(message); | 801 result.target().consoleModel.addMessage(message); |
| 802 }, | 802 }, |
| 803 | 803 |
| 804 /** | 804 /** |
| 805 * @param {string} text | 805 * @param {string} text |
| 806 * @param {boolean} useCommandLineAPI | 806 * @param {boolean} useCommandLineAPI |
| 807 */ | 807 */ |
| 808 _appendCommand: function(text, useCommandLineAPI) | 808 _appendCommand: function(text, useCommandLineAPI) |
| 809 { | 809 { |
| 810 this._prompt.setText(""); | 810 this._prompt.setText(""); |
| 811 var currentExecutionContext = WebInspector.context.flavor(WebInspector.E
xecutionContext); | 811 var currentExecutionContext = WebInspector.context.flavor(WebInspector.E
xecutionContext); |
| 812 if (currentExecutionContext) { | 812 if (currentExecutionContext) { |
| 813 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionC
ontext, text, useCommandLineAPI); | 813 WebInspector.ConsoleModel.evaluateCommandInConsole(currentExecutionC
ontext, text, useCommandLineAPI); |
| 814 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspec
torView.currentPanel().name === "console") | 814 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspec
torView.currentPanel().name === "console") |
| 815 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Ac
tion.CommandEvaluatedInConsolePanel); | 815 WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Ac
tion.CommandEvaluatedInConsolePanel); |
| 816 } | 816 } |
| 817 }, | 817 }, |
| 818 | 818 |
| 819 /** | 819 /** |
| 820 * @param {!WebInspector.Event} event | 820 * @param {!WebInspector.Event} event |
| 821 */ | 821 */ |
| 822 _commandEvaluated: function(event) | 822 _commandEvaluated: function(event) |
| 823 { | 823 { |
| 824 var data = /** @type {{result: ?WebInspector.RemoteObject, wasThrown: bo
olean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.da
ta); | 824 var data = /** @type {{result: ?WebInspector.RemoteObject, wasThrown: bo
olean, text: string, commandMessage: !WebInspector.ConsoleMessage, exceptionDeta
ils: (?RuntimeAgent.ExceptionDetails|undefined)}} */ (event.data); |
| 825 this._prompt.pushHistoryItem(data.text); | 825 this._prompt.pushHistoryItem(data.text); |
| 826 this._consoleHistorySetting.set(this._prompt.historyData().slice(-WebIns
pector.ConsoleView.persistedHistorySize)); | 826 this._consoleHistorySetting.set(this._prompt.historyData().slice(-WebIns
pector.ConsoleView.persistedHistorySize)); |
| 827 this._printResult(data.result, data.wasThrown, data.commandMessage, data
.exceptionDetails); | 827 this._printResult(data.result, data.wasThrown, data.commandMessage, data
.exceptionDetails); |
| 828 }, | 828 }, |
| 829 | 829 |
| 830 /** | 830 /** |
| 831 * @override | 831 * @override |
| 832 * @return {!Array.<!Element>} | 832 * @return {!Array.<!Element>} |
| 833 */ | 833 */ |
| 834 elementsToRestoreScrollPositionsFor: function() | 834 elementsToRestoreScrollPositionsFor: function() |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 return true; | 1330 return true; |
| 1331 } | 1331 } |
| 1332 return false; | 1332 return false; |
| 1333 } | 1333 } |
| 1334 } | 1334 } |
| 1335 | 1335 |
| 1336 /** | 1336 /** |
| 1337 * @typedef {{messageIndex: number, matchIndex: number}} | 1337 * @typedef {{messageIndex: number, matchIndex: number}} |
| 1338 */ | 1338 */ |
| 1339 WebInspector.ConsoleView.RegexMatchRange; | 1339 WebInspector.ConsoleView.RegexMatchRange; |
| OLD | NEW |