Index: webkit/glue/devtools/js/devtools.js |
=================================================================== |
--- webkit/glue/devtools/js/devtools.js (revision 21636) |
+++ webkit/glue/devtools/js/devtools.js (working copy) |
@@ -67,18 +67,21 @@ |
/** |
* @param {string} script Script exression to be evaluated in the context of the |
* inspected page. |
- * @param {function(string):undefined} callback Function to call with the |
- * result. |
+ * @param {function(Object|string, boolean):undefined} opt_callback Function to call |
+ * with the result. |
*/ |
-devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, callback) { |
- var callbackId = devtools.Callback.wrap(function(result) { |
- var pair = JSON.parse(result); |
- if (callback) { |
- callback(pair[0], pair[1]); |
+devtools.ToolsAgent.prototype.evaluateJavaScript = function(script, |
+ opt_callback) { |
+ var callbackId = devtools.Callback.wrap(function(result, exception) { |
+ if (opt_callback) { |
+ if (exception) { |
+ opt_callback(exception, true /* result is exception */); |
+ } else { |
+ opt_callback(JSON.parse(result), false); |
+ } |
} |
}); |
- RemoteToolsAgent.ExecuteUtilityFunction(callbackId, |
- 'evaluate', JSON.stringify([script])); |
+ RemoteToolsAgent.EvaluateJavaScript(callbackId, script); |
}; |