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

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 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 var str = this._prompt.text; 770 var str = this._prompt.text;
771 if (!str.length) 771 if (!str.length)
772 return; 772 return;
773 this._appendCommand(str, true); 773 this._appendCommand(str, true);
774 }, 774 },
775 775
776 /** 776 /**
777 * @param {?WebInspector.RemoteObject} result 777 * @param {?WebInspector.RemoteObject} result
778 * @param {boolean} wasThrown 778 * @param {boolean} wasThrown
779 * @param {!WebInspector.ConsoleMessage} originatingConsoleMessage 779 * @param {!WebInspector.ConsoleMessage} originatingConsoleMessage
780 * @param {?DebuggerAgent.ExceptionDetails=} exceptionDetails
780 */ 781 */
781 _printResult: function(result, wasThrown, originatingConsoleMessage) 782 _printResult: function(result, wasThrown, originatingConsoleMessage, excepti onDetails)
782 { 783 {
783 if (!result) 784 if (!result)
784 return; 785 return;
785 786
786 var target = result.target(); 787 var target = result.target();
787 /** 788 /**
788 * @param {string=} url 789 * @param {string=} url
789 * @param {number=} lineNumber 790 * @param {number=} lineNumber
790 * @param {number=} columnNumber 791 * @param {number=} columnNumber
791 */ 792 */
792 function addMessage(url, lineNumber, columnNumber) 793 function addMessage(url, lineNumber, columnNumber)
793 { 794 {
794 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Err or : WebInspector.ConsoleMessage.MessageLevel.Log; 795 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Err or : WebInspector.ConsoleMessage.MessageLevel.Log;
795 var message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageTy pe.Result, url, lineNumber, columnNumber, undefined, [result]); 796 var message;
797 if (!wasThrown)
798 message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageTy pe.Result, url, lineNumber, columnNumber, undefined, [result]);
799 else
800 message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, exceptionDetails.text, undefined, excepti onDetails.url, exceptionDetails.line, exceptionDetails.column, undefined, undefi ned, exceptionDetails.stackTrace);
vsevik 2014/07/15 16:14:33 It would be better if we show both the resulting o
vsevik 2014/07/15 16:14:33 It would be better if we show both the resulting o
kozyatinskiy1 2014/07/16 13:15:47 Done.
796 message.setOriginatingMessage(originatingConsoleMessage); 801 message.setOriginatingMessage(originatingConsoleMessage);
797 target.consoleModel.addMessage(message); 802 target.consoleModel.addMessage(message);
798 } 803 }
799 804
800 if (result.type !== "function") { 805 if (result.type !== "function") {
801 addMessage(); 806 addMessage();
802 return; 807 return;
803 } 808 }
804 809
805 result.functionDetails(didGetDetails); 810 result.functionDetails(didGetDetails);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 }, 847 },
843 848
844 /** 849 /**
845 * @param {!WebInspector.Event} event 850 * @param {!WebInspector.Event} event
846 */ 851 */
847 _commandEvaluated: function(event) 852 _commandEvaluated: function(event)
848 { 853 {
849 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data); 854 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data);
850 this._prompt.pushHistoryItem(data.text); 855 this._prompt.pushHistoryItem(data.text);
851 WebInspector.settings.consoleHistory.set(this._prompt.historyData.slice( -30)); 856 WebInspector.settings.consoleHistory.set(this._prompt.historyData.slice( -30));
852 this._printResult(data.result, data.wasThrown, data.commandMessage); 857 this._printResult(data.result, data.wasThrown, data.commandMessage, data .exceptionDetails);
853 }, 858 },
854 859
855 /** 860 /**
856 * @return {!Array.<!Element>} 861 * @return {!Array.<!Element>}
857 */ 862 */
858 elementsToRestoreScrollPositionsFor: function() 863 elementsToRestoreScrollPositionsFor: function()
859 { 864 {
860 return [this._messagesElement]; 865 return [this._messagesElement];
861 }, 866 },
862 867
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { 1222 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = {
1218 /** 1223 /**
1219 * @return {boolean} 1224 * @return {boolean}
1220 */ 1225 */
1221 handleAction: function() 1226 handleAction: function()
1222 { 1227 {
1223 WebInspector.consoleModel.show(); 1228 WebInspector.consoleModel.show();
1224 return true; 1229 return true;
1225 } 1230 }
1226 } 1231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698