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

Side by Side Diff: Source/core/inspector/InjectedScriptSource.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 Apple Inc. All rights reserved. 2 * Copyright (C) 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 try { 610 try {
611 var objectGroup = this._idToObjectGroupName[parsedObjectId.id]; 611 var objectGroup = this._idToObjectGroupName[parsedObjectId.id];
612 var func = InjectedScriptHost.eval("(" + expression + ")"); 612 var func = InjectedScriptHost.eval("(" + expression + ")");
613 if (typeof func !== "function") 613 if (typeof func !== "function")
614 return "Given expression does not evaluate to a function"; 614 return "Given expression does not evaluate to a function";
615 615
616 return { wasThrown: false, 616 return { wasThrown: false,
617 result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue), 617 result: this._wrapObject(func.apply(object, resolvedArgs), objectGroup, returnByValue),
618 __proto__: null }; 618 __proto__: null };
619 } catch (e) { 619 } catch (e) {
620 return this._createThrownValue(e, objectGroup); 620 return this._createThrownValue(e, objectGroup, false);
621 } 621 }
622 }, 622 },
623 623
624 /** 624 /**
625 * Resolves a value from CallArgument description. 625 * Resolves a value from CallArgument description.
626 * @param {!RuntimeAgent.CallArgument} callArgumentJson 626 * @param {!RuntimeAgent.CallArgument} callArgumentJson
627 * @return {*} resolved value 627 * @return {*} resolved value
628 * @throws {string} error message 628 * @throws {string} error message
629 */ 629 */
630 _resolveCallArgument: function(callArgumentJson) 630 _resolveCallArgument: function(callArgumentJson)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 * @return {!Object} 663 * @return {!Object}
664 */ 664 */
665 _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, is EvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, scopeChai n) 665 _evaluateAndWrap: function(evalFunction, object, expression, objectGroup, is EvalOnCallFrame, injectCommandLineAPI, returnByValue, generatePreview, scopeChai n)
666 { 666 {
667 var wrappedResult = this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, scopeChain); 667 var wrappedResult = this._evaluateOn(evalFunction, object, objectGroup, expression, isEvalOnCallFrame, injectCommandLineAPI, scopeChain);
668 if (!wrappedResult.exceptionDetails) { 668 if (!wrappedResult.exceptionDetails) {
669 return { wasThrown: false, 669 return { wasThrown: false,
670 result: this._wrapObject(wrappedResult.result, objectGroup, returnByValue, generatePreview), 670 result: this._wrapObject(wrappedResult.result, objectGroup, returnByValue, generatePreview),
671 __proto__: null }; 671 __proto__: null };
672 } 672 }
673 return this._createThrownValue(wrappedResult.result, objectGroup, wrappe dResult.exceptionDetails); 673 return this._createThrownValue(wrappedResult.result, objectGroup, genera tePreview, wrappedResult.exceptionDetails);
674 }, 674 },
675 675
676 /** 676 /**
677 * @param {*} value 677 * @param {*} value
678 * @param {string} objectGroup 678 * @param {string} objectGroup
679 * @param {boolean} generatePreview
679 * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails 680 * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails
680 * @return {!Object} 681 * @return {!Object}
681 */ 682 */
682 _createThrownValue: function(value, objectGroup, exceptionDetails) 683 _createThrownValue: function(value, objectGroup, generatePreview, exceptionD etails)
683 { 684 {
684 var remoteObject = this._wrapObject(value, objectGroup); 685 var remoteObject = this._wrapObject(value, objectGroup, false, generateP review && !(value instanceof Error));
685 if (!remoteObject.description){ 686 if (!remoteObject.description){
686 try { 687 try {
687 remoteObject.description = toStringDescription(value); 688 remoteObject.description = toStringDescription(value);
688 } catch (e) {} 689 } catch (e) {}
689 } 690 }
690 return { wasThrown: true, result: remoteObject, exceptionDetails: except ionDetails, __proto__: null }; 691 return { wasThrown: true, result: remoteObject, exceptionDetails: except ionDetails, __proto__: null };
691 }, 692 },
692 693
693 /** 694 /**
694 * @param {!Function} evalFunction 695 * @param {!Function} evalFunction
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1698 */ 1699 */
1699 _logEvent: function(event) 1700 _logEvent: function(event)
1700 { 1701 {
1701 inspectedWindow.console.log(event.type, event); 1702 inspectedWindow.console.log(event.type, event);
1702 } 1703 }
1703 } 1704 }
1704 1705
1705 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1706 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1706 return injectedScript; 1707 return injectedScript;
1707 }) 1708 })
OLDNEW
« no previous file with comments | « Source/core/inspector/InjectedScriptBase.cpp ('k') | Source/core/inspector/InspectorDebuggerAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698