Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: src/debug-debugger.js

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.cc ('k') | src/factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug-debugger.js
===================================================================
--- src/debug-debugger.js (revision 3964)
+++ src/debug-debugger.js (working copy)
@@ -1251,7 +1251,9 @@
} 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,52 @@
};
+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();
+ try {
+ Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string,
+ change_log);
+ } catch (e) {
+ if (e instanceof Debug.LiveEditChangeScript.Failure) {
+ // Let's treat it as a "success" so that body with change_log will be
+ // sent back. "change_log" will have "failure" field set.
+ change_log.push( { failure: true } );
+ } else {
+ throw e;
+ }
+ }
+ response.body = {change_log: change_log};
+};
+
+
// Check whether the previously processed command caused the VM to become
// running.
DebugCommandProcessor.prototype.isRunning = function() {
« no previous file with comments | « src/debug.cc ('k') | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698