| 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 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 886 */ | 886 */ |
| 887 evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectG
roup, injectCommandLineAPI, returnByValue, generatePreview) | 887 evaluateOnCallFrame: function(topCallFrame, callFrameId, expression, objectG
roup, injectCommandLineAPI, returnByValue, generatePreview) |
| 888 { | 888 { |
| 889 var callFrame = this._callFrameForId(topCallFrame, callFrameId); | 889 var callFrame = this._callFrameForId(topCallFrame, callFrameId); |
| 890 if (!callFrame) | 890 if (!callFrame) |
| 891 return "Could not find call frame with given id"; | 891 return "Could not find call frame with given id"; |
| 892 return this._evaluateAndWrap(callFrame, expression, objectGroup, injectC
ommandLineAPI, returnByValue, generatePreview); | 892 return this._evaluateAndWrap(callFrame, expression, objectGroup, injectC
ommandLineAPI, returnByValue, generatePreview); |
| 893 }, | 893 }, |
| 894 | 894 |
| 895 /** | 895 /** |
| 896 * @param {!JavaScriptCallFrame} topCallFrame | |
| 897 * @param {string} callFrameId | |
| 898 * @return {*} | |
| 899 */ | |
| 900 restartFrame: function(topCallFrame, callFrameId) | |
| 901 { | |
| 902 var callFrame = this._callFrameForId(topCallFrame, callFrameId); | |
| 903 if (!callFrame) | |
| 904 return "Could not find call frame with given id"; | |
| 905 return callFrame.restart(); | |
| 906 }, | |
| 907 | |
| 908 /** | |
| 909 * Either callFrameId or functionObjectId must be specified. | |
| 910 * @param {!JavaScriptCallFrame} topCallFrame | |
| 911 * @param {string|boolean} callFrameId or false | |
| 912 * @param {string|boolean} functionObjectId or false | |
| 913 * @param {number} scopeNumber | |
| 914 * @param {string} variableName | |
| 915 * @param {string} newValueJsonString RuntimeAgent.CallArgument structure se
rialized as string | |
| 916 * @return {string|undefined} undefined if success or an error message | |
| 917 */ | |
| 918 setVariableValue: function(topCallFrame, callFrameId, functionObjectId, scop
eNumber, variableName, newValueJsonString) | |
| 919 { | |
| 920 try { | |
| 921 var newValueJson = /** @type {!RuntimeAgent.CallArgument} */ (Inject
edScriptHost.eval("(" + newValueJsonString + ")")); | |
| 922 var resolvedValue = this._resolveCallArgument(newValueJson); | |
| 923 if (typeof callFrameId === "string") { | |
| 924 var callFrame = this._callFrameForId(topCallFrame, callFrameId); | |
| 925 if (!callFrame) | |
| 926 return "Could not find call frame with given id"; | |
| 927 callFrame.setVariableValue(scopeNumber, variableName, resolvedVa
lue) | |
| 928 } else { | |
| 929 var parsedFunctionId = this._parseObjectId(/** @type {string} */
(functionObjectId)); | |
| 930 var func = this._objectForId(parsedFunctionId); | |
| 931 if (typeof func !== "function") | |
| 932 return "Could not resolve function by id"; | |
| 933 InjectedScriptHost.setFunctionVariableValue(func, scopeNumber, v
ariableName, resolvedValue); | |
| 934 } | |
| 935 } catch (e) { | |
| 936 return toString(e); | |
| 937 } | |
| 938 return undefined; | |
| 939 }, | |
| 940 | |
| 941 /** | |
| 942 * @return {!CommandLineAPI} | 896 * @return {!CommandLineAPI} |
| 943 */ | 897 */ |
| 944 commandLineAPI: function() | 898 commandLineAPI: function() |
| 945 { | 899 { |
| 946 return new CommandLineAPI(this._commandLineAPIImpl, null); | 900 return new CommandLineAPI(this._commandLineAPIImpl, null); |
| 947 }, | 901 }, |
| 948 | 902 |
| 949 /** | 903 /** |
| 950 * @param {!JavaScriptCallFrame} topCallFrame | 904 * @param {!JavaScriptCallFrame} topCallFrame |
| 951 * @param {string} callFrameId | 905 * @param {string} callFrameId |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1894 */ | 1848 */ |
| 1895 _logEvent: function(event) | 1849 _logEvent: function(event) |
| 1896 { | 1850 { |
| 1897 inspectedGlobalObject.console.log(event.type, event); | 1851 inspectedGlobalObject.console.log(event.type, event); |
| 1898 } | 1852 } |
| 1899 } | 1853 } |
| 1900 | 1854 |
| 1901 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); | 1855 injectedScript._commandLineAPIImpl = new CommandLineAPIImpl(); |
| 1902 return injectedScript; | 1856 return injectedScript; |
| 1903 }) | 1857 }) |
| OLD | NEW |