OLD | NEW |
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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 } | 639 } |
640 if (ownProperties) { | 640 if (ownProperties) { |
641 if (object.__proto__ && !accessorPropertiesOnly) | 641 if (object.__proto__ && !accessorPropertiesOnly) |
642 yield { name: "__proto__", value: object.__proto__, writable
: true, configurable: true, enumerable: false, isOwn: true, __proto__: null }; | 642 yield { name: "__proto__", value: object.__proto__, writable
: true, configurable: true, enumerable: false, isOwn: true, __proto__: null }; |
643 break; | 643 break; |
644 } | 644 } |
645 } | 645 } |
646 }, | 646 }, |
647 | 647 |
648 /** | 648 /** |
649 * @param {string} expression | |
650 * @param {string} objectGroup | |
651 * @param {boolean} injectCommandLineAPI | |
652 * @param {boolean} returnByValue | |
653 * @param {boolean} generatePreview | |
654 * @return {*} | |
655 */ | |
656 evaluate: function(expression, objectGroup, injectCommandLineAPI, returnByVa
lue, generatePreview) | |
657 { | |
658 var scopeExtensionForEval = injectCommandLineAPI ? new CommandLineAPI(th
is._commandLineAPIImpl) : undefined; | |
659 var wrappedResult = InjectedScriptHost.evaluateWithExceptionDetails(expr
ession, scopeExtensionForEval); | |
660 if (objectGroup === "console" && !wrappedResult.exceptionDetails) | |
661 this._lastResult = wrappedResult.result; | |
662 if (!wrappedResult.exceptionDetails) { | |
663 return { wasThrown: false, | |
664 result: this._wrapObject(wrappedResult.result, objectGroup,
returnByValue, generatePreview), | |
665 __proto__: null }; | |
666 } | |
667 return this._createThrownValue(wrappedResult.result, objectGroup, genera
tePreview, wrappedResult.exceptionDetails); | |
668 }, | |
669 | |
670 /** | |
671 * @param {string} objectId | 649 * @param {string} objectId |
672 * @param {string} expression | 650 * @param {string} expression |
673 * @param {string} args | 651 * @param {string} args |
674 * @param {boolean} returnByValue | 652 * @param {boolean} returnByValue |
675 * @return {!Object|string} | 653 * @return {!Object|string} |
676 */ | 654 */ |
677 callFunctionOn: function(objectId, expression, args, returnByValue) | 655 callFunctionOn: function(objectId, expression, args, returnByValue) |
678 { | 656 { |
679 var parsedObjectId = this._parseObjectId(objectId); | 657 var parsedObjectId = this._parseObjectId(objectId); |
680 var object = this._objectForId(parsedObjectId); | 658 var object = this._objectForId(parsedObjectId); |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 | 813 |
836 /** | 814 /** |
837 * @return {!CommandLineAPI} | 815 * @return {!CommandLineAPI} |
838 */ | 816 */ |
839 commandLineAPI: function() | 817 commandLineAPI: function() |
840 { | 818 { |
841 return new CommandLineAPI(this._commandLineAPIImpl); | 819 return new CommandLineAPI(this._commandLineAPIImpl); |
842 }, | 820 }, |
843 | 821 |
844 /** | 822 /** |
845 * @param {!JavaScriptCallFrame} topCallFrame | |
846 * @param {string} callFrameId | |
847 * @return {?JavaScriptCallFrame} | |
848 */ | |
849 _callFrameForId: function(topCallFrame, callFrameId) | |
850 { | |
851 var parsedCallFrameId = nullifyObjectProto(/** @type {!Object} */ (Injec
tedScriptHost.eval("(" + callFrameId + ")"))); | |
852 var ordinal = parsedCallFrameId["ordinal"]; | |
853 var callFrame = topCallFrame; | |
854 while (--ordinal >= 0 && callFrame) | |
855 callFrame = callFrame.caller; | |
856 return callFrame; | |
857 }, | |
858 | |
859 /** | |
860 * @param {!Object} objectId | 823 * @param {!Object} objectId |
861 * @return {!Object|symbol|undefined} | 824 * @return {!Object|symbol|undefined} |
862 */ | 825 */ |
863 _objectForId: function(objectId) | 826 _objectForId: function(objectId) |
864 { | 827 { |
865 return objectId.injectedScriptId === injectedScriptId ? /** @type{!Objec
t|symbol|undefined} */ (InjectedScriptHost.objectForId(objectId.id)) : void 0; | 828 return objectId.injectedScriptId === injectedScriptId ? /** @type{!Objec
t|symbol|undefined} */ (InjectedScriptHost.objectForId(objectId.id)) : void 0; |
866 }, | 829 }, |
867 | 830 |
868 /** | 831 /** |
869 * @param {*} object | 832 * @param {*} object |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 */ | 1728 */ |
1766 _logEvent: function(event) | 1729 _logEvent: function(event) |
1767 { | 1730 { |
1768 inspectedGlobalObject.console.log(event.type, event); | 1731 inspectedGlobalObject.console.log(event.type, event); |
1769 } | 1732 } |
1770 } | 1733 } |
1771 | 1734 |
1772 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1735 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
1773 return injectedScript; | 1736 return injectedScript; |
1774 }) | 1737 }) |
OLD | NEW |