add callFunctionOn capability to remote debugger

This commit is contained in:
Jonathan Lipps
2013-02-01 15:34:13 -08:00
parent e721639d44
commit f3c2c38a1d
2 changed files with 15 additions and 0 deletions
+9
View File
@@ -123,6 +123,15 @@ RemoteDebugger.prototype.execute = function(command, cb) {
this.send(sendJSCommand, cb);
};
RemoteDebugger.prototype.callFunction = function(objId, fn, args, cb) {
assert.ok(this.connId); assert.ok(this.appIdKey); assert.ok(this.senderId);
assert.ok(this.pageIdKey);
logger.info("Calling javascript function");
var callJSFunction = messages.callJSFunction(objId, fn, args, this.appIdKey,
this.connId, this.senderId, this.pageIdKey);
this.send(callJSFunction, cb);
};
// ====================================
// HANDLERS
// ====================================
+6
View File
@@ -52,6 +52,12 @@ exports.sendJSCommand = function(js, appIdKey, connId, senderId, pageIdKey) {
{expression: js, returnByValue: true}, appIdKey, connId, senderId, pageIdKey);
};
exports.callJSFunction = function(objId, fn, args, appIdKey, connId, senderId, pageIdKey) {
return exports.command("Runtime.callFunctionOn",
{objectId: objId, functionDeclaration: fn, arguments: args, returnByValue: true},
appIdKey, connId, senderId, pageIdKey);
};
exports.command = function(method, params, appIdKey, connId, senderId, pageIdKey) {
var plist = {
__argument: {