Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: Source/devtools/front_end/console/ConsoleView.js

Issue 369333002: DevTools: Added error message when the command is invoked from the console with exception (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@add-evaluate-exception-details
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 var str = this._prompt.text; 769 var str = this._prompt.text;
770 if (!str.length) 770 if (!str.length)
771 return; 771 return;
772 this._appendCommand(str, true); 772 this._appendCommand(str, true);
773 }, 773 },
774 774
775 /** 775 /**
776 * @param {?WebInspector.RemoteObject} result 776 * @param {?WebInspector.RemoteObject} result
777 * @param {boolean} wasThrown 777 * @param {boolean} wasThrown
778 * @param {!WebInspector.ConsoleMessage} originatingConsoleMessage 778 * @param {!WebInspector.ConsoleMessage} originatingConsoleMessage
779 * @param {?DebuggerAgent.ExceptionDetails=} exceptionDetails
779 */ 780 */
780 _printResult: function(result, wasThrown, originatingConsoleMessage) 781 _printResult: function(result, wasThrown, originatingConsoleMessage, excepti onDetails)
781 { 782 {
782 if (!result) 783 if (!result)
783 return; 784 return;
784 785
785 var target = result.target(); 786 var target = result.target();
786 /** 787 /**
787 * @param {string=} url 788 * @param {string=} url
788 * @param {number=} lineNumber 789 * @param {number=} lineNumber
789 * @param {number=} columnNumber 790 * @param {number=} columnNumber
790 */ 791 */
791 function addMessage(url, lineNumber, columnNumber) 792 function addMessage(url, lineNumber, columnNumber)
792 { 793 {
793 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Err or : WebInspector.ConsoleMessage.MessageLevel.Log; 794 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Err or : WebInspector.ConsoleMessage.MessageLevel.Log;
794 var message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageTy pe.Result, url, lineNumber, columnNumber, undefined, [result]); 795 var message;
796 if (!wasThrown)
797 message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageTy pe.Result, url, lineNumber, columnNumber, undefined, [result]);
798 else
799 message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, exceptionDetails.text, WebInspector.Conso leMessage.MessageType.Result, exceptionDetails.url, exceptionDetails.line, excep tionDetails.column, undefined, [WebInspector.UIString("Uncaught"), result], exce ptionDetails.stackTrace);
795 message.setOriginatingMessage(originatingConsoleMessage); 800 message.setOriginatingMessage(originatingConsoleMessage);
796 target.consoleModel.addMessage(message); 801 target.consoleModel.addMessage(message);
797 } 802 }
798 803
799 if (result.type !== "function") { 804 if (result.type !== "function") {
800 addMessage(); 805 addMessage();
801 return; 806 return;
802 } 807 }
803 808
804 result.functionDetails(didGetDetails); 809 result.functionDetails(didGetDetails);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 }, 846 },
842 847
843 /** 848 /**
844 * @param {!WebInspector.Event} event 849 * @param {!WebInspector.Event} event
845 */ 850 */
846 _commandEvaluated: function(event) 851 _commandEvaluated: function(event)
847 { 852 {
848 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data); 853 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data);
849 this._prompt.pushHistoryItem(data.text); 854 this._prompt.pushHistoryItem(data.text);
850 WebInspector.settings.consoleHistory.set(this._prompt.historyData.slice( -30)); 855 WebInspector.settings.consoleHistory.set(this._prompt.historyData.slice( -30));
851 this._printResult(data.result, data.wasThrown, data.commandMessage); 856 this._printResult(data.result, data.wasThrown, data.commandMessage, data .exceptionDetails);
852 }, 857 },
853 858
854 /** 859 /**
855 * @return {!Array.<!Element>} 860 * @return {!Array.<!Element>}
856 */ 861 */
857 elementsToRestoreScrollPositionsFor: function() 862 elementsToRestoreScrollPositionsFor: function()
858 { 863 {
859 return [this._messagesElement]; 864 return [this._messagesElement];
860 }, 865 },
861 866
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1216 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { 1221 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = {
1217 /** 1222 /**
1218 * @return {boolean} 1223 * @return {boolean}
1219 */ 1224 */
1220 handleAction: function() 1225 handleAction: function()
1221 { 1226 {
1222 WebInspector.console.show(); 1227 WebInspector.console.show();
1223 return true; 1228 return true;
1224 } 1229 }
1225 } 1230 }
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorRuntimeAgent.cpp ('k') | Source/devtools/front_end/console/ConsoleViewMessage.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698