| Index: src/debug-delay.js
|
| diff --git a/src/debug-delay.js b/src/debug-delay.js
|
| index 55c25a926cbe754c1655e31e6e55aa1a48b161e7..3bf1061df0271dfa8484d266527a7d87825524b9 100644
|
| --- a/src/debug-delay.js
|
| +++ b/src/debug-delay.js
|
| @@ -1251,7 +1251,9 @@ DebugCommandProcessor.prototype.processDebugJSONRequest = function(json_request)
|
| } else if (request.command == 'version') {
|
| this.versionRequest_(request, response);
|
| } else if (request.command == 'profile') {
|
| - this.profileRequest_(request, response);
|
| + this.profileRequest_(request, response);
|
| + } else if (request.command == 'changelive') {
|
| + this.changeLiveRequest_(request, response);
|
| } else {
|
| throw new Error('Unknown command "' + request.command + '" in request');
|
| }
|
| @@ -1954,6 +1956,43 @@ DebugCommandProcessor.prototype.profileRequest_ = function(request, response) {
|
| };
|
|
|
|
|
| +DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response) {
|
| + if (!Debug.LiveEditChangeScript) {
|
| + return response.failed('LiveEdit feature is not supported');
|
| + }
|
| + if (!request.arguments) {
|
| + return response.failed('Missing arguments');
|
| + }
|
| + var script_id = request.arguments.script_id;
|
| + var change_pos = parseInt(request.arguments.change_pos);
|
| + var change_len = parseInt(request.arguments.change_len);
|
| + var new_string = request.arguments.new_string;
|
| + if (!IS_STRING(new_string)) {
|
| + response.failed('Argument "new_string" is not a string value');
|
| + return;
|
| + }
|
| +
|
| + var scripts = %DebugGetLoadedScripts();
|
| +
|
| + var the_script = null;
|
| + for (var i = 0; i < scripts.length; i++) {
|
| + if (scripts[i].id == script_id) {
|
| + the_script = scripts[i];
|
| + }
|
| + }
|
| + if (!the_script) {
|
| + response.failed('Script not found');
|
| + return;
|
| + }
|
| +
|
| + var change_log = new Array();
|
| + Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string,
|
| + change_log);
|
| +
|
| + response.body = {change_log: change_log};
|
| +};
|
| +
|
| +
|
| // Check whether the previously processed command caused the VM to become
|
| // running.
|
| DebugCommandProcessor.prototype.isRunning = function() {
|
|
|