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

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, returnByValue, 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, return ByValue, generatePreview, 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} returnByValue
680 * @param {boolean} generatePreview
679 * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails 681 * @param {!DebuggerAgent.ExceptionDetails=} exceptionDetails
680 * @return {!Object} 682 * @return {!Object}
681 */ 683 */
682 _createThrownValue: function(value, objectGroup, exceptionDetails) 684 _createThrownValue: function(value, objectGroup, returnByValue, generatePrev iew, exceptionDetails)
vsevik 2014/07/17 13:13:22 I am not sure whether the changes we do here are s
683 { 685 {
684 var remoteObject = this._wrapObject(value, objectGroup); 686 var remoteObject = this._wrapObject(value, objectGroup, returnByValue, g eneratePreview && !(value instanceof Error));
685 try { 687 if (!remoteObject.description || value instanceof Error) {
686 remoteObject.description = toStringDescription(value); 688 try {
687 } catch (e) {} 689 remoteObject.description = toStringDescription(value);
690 } catch (e) {}
691 }
688 return { wasThrown: true, result: remoteObject, exceptionDetails: except ionDetails, __proto__: null }; 692 return { wasThrown: true, result: remoteObject, exceptionDetails: except ionDetails, __proto__: null };
689 }, 693 },
690 694
691 /** 695 /**
692 * @param {!Function} evalFunction 696 * @param {!Function} evalFunction
693 * @param {!Object} object 697 * @param {!Object} object
694 * @param {string} objectGroup 698 * @param {string} objectGroup
695 * @param {string} expression 699 * @param {string} expression
696 * @param {boolean} isEvalOnCallFrame 700 * @param {boolean} isEvalOnCallFrame
697 * @param {boolean} injectCommandLineAPI 701 * @param {boolean} injectCommandLineAPI
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 */ 1697 */
1694 _logEvent: function(event) 1698 _logEvent: function(event)
1695 { 1699 {
1696 inspectedWindow.console.log(event.type, event); 1700 inspectedWindow.console.log(event.type, event);
1697 } 1701 }
1698 } 1702 }
1699 1703
1700 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); 1704 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl();
1701 return injectedScript; 1705 return injectedScript;
1702 }) 1706 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698