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

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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 var str = this._prompt.text; 781 var str = this._prompt.text;
782 if (!str.length) 782 if (!str.length)
783 return; 783 return;
784 this._appendCommand(str, true); 784 this._appendCommand(str, true);
785 }, 785 },
786 786
787 /** 787 /**
788 * @param {?WebInspector.RemoteObject} result 788 * @param {?WebInspector.RemoteObject} result
789 * @param {boolean} wasThrown 789 * @param {boolean} wasThrown
790 * @param {!WebInspector.ConsoleMessage} originatingConsoleMessage 790 * @param {!WebInspector.ConsoleMessage} originatingConsoleMessage
791 * @param {?DebuggerAgent.ExceptionDetails=} exceptionDetails
791 */ 792 */
792 _printResult: function(result, wasThrown, originatingConsoleMessage) 793 _printResult: function(result, wasThrown, originatingConsoleMessage, excepti onDetails)
793 { 794 {
794 if (!result) 795 if (!result)
795 return; 796 return;
796 797
797 var target = result.target(); 798 var target = result.target();
798 /** 799 /**
799 * @param {string=} url 800 * @param {string=} url
800 * @param {number=} lineNumber 801 * @param {number=} lineNumber
801 * @param {number=} columnNumber 802 * @param {number=} columnNumber
802 */ 803 */
803 function addMessage(url, lineNumber, columnNumber) 804 function addMessage(url, lineNumber, columnNumber)
804 { 805 {
805 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Err or : WebInspector.ConsoleMessage.MessageLevel.Log; 806 var level = wasThrown ? WebInspector.ConsoleMessage.MessageLevel.Err or : WebInspector.ConsoleMessage.MessageLevel.Log;
806 var message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageTy pe.Result, url, lineNumber, columnNumber, undefined, [result]); 807 var message = new WebInspector.ConsoleMessage(target, WebInspector.C onsoleMessage.MessageSource.JS, level, "", WebInspector.ConsoleMessage.MessageTy pe.Result, url, lineNumber, columnNumber, undefined, [result]);
807 message.setOriginatingMessage(originatingConsoleMessage); 808 message.setOriginatingMessage(originatingConsoleMessage);
808 target.consoleModel.addMessage(message); 809 target.consoleModel.addMessage(message);
810 if (wasThrown) {
811 var errorMessage = new WebInspector.ConsoleMessage(
812 target,
813 WebInspector.ConsoleMessage.MessageSource.JS,
814 level,
815 exceptionDetails.text,
816 undefined,
817 exceptionDetails.url,
818 exceptionDetails.line,
819 exceptionDetails.column,
820 undefined,
821 undefined,
822 exceptionDetails.stackTrace);
823 target.consoleModel.addMessage(errorMessage);
824 }
809 } 825 }
810 826
811 if (result.type !== "function") { 827 if (result.type !== "function") {
812 addMessage(); 828 addMessage();
813 return; 829 return;
814 } 830 }
815 831
816 result.functionDetails(didGetDetails); 832 result.functionDetails(didGetDetails);
817 833
818 /** 834 /**
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 }, 869 },
854 870
855 /** 871 /**
856 * @param {!WebInspector.Event} event 872 * @param {!WebInspector.Event} event
857 */ 873 */
858 _commandEvaluated: function(event) 874 _commandEvaluated: function(event)
859 { 875 {
860 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data); 876 var data = /**{{result: ?WebInspector.RemoteObject, wasThrown: boolean, text: string, commandMessage: !WebInspector.ConsoleMessage}} */ (event.data);
861 this._prompt.pushHistoryItem(data.text); 877 this._prompt.pushHistoryItem(data.text);
862 WebInspector.settings.consoleHistory.set(this._prompt.historyData.slice( -30)); 878 WebInspector.settings.consoleHistory.set(this._prompt.historyData.slice( -30));
863 this._printResult(data.result, data.wasThrown, data.commandMessage); 879 this._printResult(data.result, data.wasThrown, data.commandMessage, data .exceptionDetails);
864 }, 880 },
865 881
866 /** 882 /**
867 * @return {!Array.<!Element>} 883 * @return {!Array.<!Element>}
868 */ 884 */
869 elementsToRestoreScrollPositionsFor: function() 885 elementsToRestoreScrollPositionsFor: function()
870 { 886 {
871 return [this._messagesElement]; 887 return [this._messagesElement];
872 }, 888 },
873 889
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
1230 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = { 1246 WebInspector.ConsoleView.ShowConsoleActionDelegate.prototype = {
1231 /** 1247 /**
1232 * @return {boolean} 1248 * @return {boolean}
1233 */ 1249 */
1234 handleAction: function() 1250 handleAction: function()
1235 { 1251 {
1236 WebInspector.console.show(); 1252 WebInspector.console.show();
1237 return true; 1253 return true;
1238 } 1254 }
1239 } 1255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698