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 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression,
objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview); | 781 return this._evaluateAndWrap(callFrame.evaluate, callFrame, expression,
objectGroup, true, injectCommandLineAPI, returnByValue, generatePreview); |
782 }, | 782 }, |
783 | 783 |
784 /** | 784 /** |
785 * @param {!Object} topCallFrame | 785 * @param {!Object} topCallFrame |
786 * @param {string} callFrameId | 786 * @param {string} callFrameId |
787 * @return {*} | 787 * @return {*} |
788 */ | 788 */ |
789 restartFrame: function(topCallFrame, callFrameId) | 789 restartFrame: function(topCallFrame, callFrameId) |
790 { | 790 { |
791 var callFrame = this.callFrameForId(topCallFrame, callFrameId); | 791 var callFrame = this._callFrameForId(topCallFrame, callFrameId); |
792 if (!callFrame) | 792 if (!callFrame) |
793 return "Could not find call frame with given id"; | 793 return "Could not find call frame with given id"; |
794 var result = callFrame.restart(); | 794 var result = callFrame.restart(); |
795 if (result === false) | 795 if (result === false) |
796 result = "Restart frame is not supported"; | 796 result = "Restart frame is not supported"; |
797 return result; | 797 return result; |
798 }, | 798 }, |
799 | 799 |
800 /** | 800 /** |
801 * @param {!Object} topCallFrame | 801 * @param {!Object} topCallFrame |
802 * @param {string} callFrameId | 802 * @param {string} callFrameId |
803 * @return {*} a stepIn position array ready for protocol JSON or a string e
rror | 803 * @return {*} a stepIn position array ready for protocol JSON or a string e
rror |
804 */ | 804 */ |
805 getStepInPositions: function(topCallFrame, callFrameId) | 805 getStepInPositions: function(topCallFrame, callFrameId) |
806 { | 806 { |
807 var callFrame = this.callFrameForId(topCallFrame, callFrameId); | 807 var callFrame = this._callFrameForId(topCallFrame, callFrameId); |
808 if (!callFrame) | 808 if (!callFrame) |
809 return "Could not find call frame with given id"; | 809 return "Could not find call frame with given id"; |
810 var stepInPositionsUnpacked = JSON.parse(callFrame.stepInPositions); | 810 var stepInPositionsUnpacked = JSON.parse(callFrame.stepInPositions); |
811 if (typeof stepInPositionsUnpacked !== "object") | 811 if (typeof stepInPositionsUnpacked !== "object") |
812 return "Step in positions not available"; | 812 return "Step in positions not available"; |
813 return stepInPositionsUnpacked; | 813 return stepInPositionsUnpacked; |
814 }, | 814 }, |
815 | 815 |
816 /** | 816 /** |
817 * Either callFrameId or functionObjectId must be specified. | 817 * Either callFrameId or functionObjectId must be specified. |
818 * @param {!Object} topCallFrame | 818 * @param {!Object} topCallFrame |
819 * @param {string|boolean} callFrameId or false | 819 * @param {string|boolean} callFrameId or false |
820 * @param {string|boolean} functionObjectId or false | 820 * @param {string|boolean} functionObjectId or false |
821 * @param {number} scopeNumber | 821 * @param {number} scopeNumber |
822 * @param {string} variableName | 822 * @param {string} variableName |
823 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se
rialized as string | 823 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se
rialized as string |
824 * @return {string|undefined} undefined if success or an error message | 824 * @return {string|undefined} undefined if success or an error message |
825 */ | 825 */ |
826 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop
eNumber, variableName, newValueJsonString) | 826 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop
eNumber, variableName, newValueJsonString) |
827 { | 827 { |
828 var setter; | 828 var setter; |
829 if (typeof callFrameId === "string") { | 829 if (typeof callFrameId === "string") { |
830 var callFrame = this.callFrameForId(topCallFrame, callFrameId); | 830 var callFrame = this._callFrameForId(topCallFrame, callFrameId); |
831 if (!callFrame) | 831 if (!callFrame) |
832 return "Could not find call frame with given id"; | 832 return "Could not find call frame with given id"; |
833 setter = bind(callFrame.setVariableValue, callFrame); | 833 setter = bind(callFrame.setVariableValue, callFrame); |
834 } else { | 834 } else { |
835 var parsedFunctionId = this._parseObjectId(/** @type {string} */ (fu
nctionObjectId)); | 835 var parsedFunctionId = this._parseObjectId(/** @type {string} */ (fu
nctionObjectId)); |
836 var func = this._objectForId(parsedFunctionId); | 836 var func = this._objectForId(parsedFunctionId); |
837 if (typeof func !== "function") | 837 if (typeof func !== "function") |
838 return "Cannot resolve function by id."; | 838 return "Cannot resolve function by id."; |
839 setter = bind(InjectedScriptHost.setFunctionVariableValue, InjectedS
criptHost, func); | 839 setter = bind(InjectedScriptHost.setFunctionVariableValue, InjectedS
criptHost, func); |
840 } | 840 } |
(...skipping 15 matching lines...) Expand all Loading... |
856 return "Failed to change variable value: " + e; | 856 return "Failed to change variable value: " + e; |
857 } | 857 } |
858 return undefined; | 858 return undefined; |
859 }, | 859 }, |
860 | 860 |
861 /** | 861 /** |
862 * @param {!Object} topCallFrame | 862 * @param {!Object} topCallFrame |
863 * @param {string} callFrameId | 863 * @param {string} callFrameId |
864 * @return {?Object} | 864 * @return {?Object} |
865 */ | 865 */ |
866 callFrameForId: function(topCallFrame, callFrameId) | 866 _callFrameForId: function(topCallFrame, callFrameId) |
867 { | 867 { |
868 var parsedCallFrameId = nullifyObjectProto(InjectedScriptHost.evaluate("
(" + callFrameId + ")")); | 868 var parsedCallFrameId = nullifyObjectProto(InjectedScriptHost.evaluate("
(" + callFrameId + ")")); |
869 return this._callFrameForParsedId(topCallFrame, parsedCallFrameId, []); | 869 return this._callFrameForParsedId(topCallFrame, parsedCallFrameId, []); |
870 }, | 870 }, |
871 | 871 |
872 /** | 872 /** |
873 * @param {!Object} topCallFrame | 873 * @param {!Object} topCallFrame |
874 * @param {!Object} parsedCallFrameId | 874 * @param {!Object} parsedCallFrameId |
875 * @param {!Array.<!Object>} asyncCallStacks | 875 * @param {!Array.<!Object>} asyncCallStacks |
876 * @return {?Object} | 876 * @return {?Object} |
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 */ | 1699 */ |
1700 _logEvent: function(event) | 1700 _logEvent: function(event) |
1701 { | 1701 { |
1702 inspectedWindow.console.log(event.type, event); | 1702 inspectedWindow.console.log(event.type, event); |
1703 } | 1703 } |
1704 } | 1704 } |
1705 | 1705 |
1706 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1706 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
1707 return injectedScript; | 1707 return injectedScript; |
1708 }) | 1708 }) |
OLD | NEW |