| Index: src/debug-debugger.js
|
| diff --git a/src/debug-debugger.js b/src/debug-debugger.js
|
| index c296e422d842e14a9f180d1bbd9fecd034a4d176..060e159f33de9aa8e0ae30692dde3dffc6d5afd1 100644
|
| --- a/src/debug-debugger.js
|
| +++ b/src/debug-debugger.js
|
| @@ -1966,14 +1966,7 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
|
| 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;
|
| @@ -1987,10 +1980,32 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
|
| return;
|
| }
|
|
|
| + // A function that calls a proper signature of LiveEdit API.
|
| + var invocation;
|
| +
|
| var change_log = new Array();
|
| +
|
| + if (IS_STRING(request.arguments.new_source)) {
|
| + var new_source = request.arguments.new_source;
|
| + invocation = function() {
|
| + return Debug.LiveEdit.SetScriptSource(the_script, new_source, change_log);
|
| + }
|
| + } else {
|
| + 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;
|
| + }
|
| + invocation = function() {
|
| + return Debug.LiveEditChangeScript(the_script, change_pos, change_len,
|
| + new_string, change_log);
|
| + }
|
| + }
|
| +
|
| try {
|
| - Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string,
|
| - change_log);
|
| + invocation();
|
| } catch (e) {
|
| if (e instanceof Debug.LiveEditChangeScript.Failure) {
|
| // Let's treat it as a "success" so that body with change_log will be
|
|
|