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

Unified Diff: src/debug-debugger.js

Issue 1697016: LiveEdit: clean JS sources a bit (Closed)
Patch Set: tab Created 10 years, 8 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 | « no previous file | src/liveedit-debugger.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug-debugger.js
diff --git a/src/debug-debugger.js b/src/debug-debugger.js
index 075189543ecaba3800bad3280634090fa5259709..e94cee41d216901b12a1e9a9a1e54f21f925be1e 100644
--- a/src/debug-debugger.js
+++ b/src/debug-debugger.js
@@ -2018,32 +2018,16 @@ 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.LiveEdit.ApplyPatch(the_script, change_pos, change_len,
- new_string, change_log);
- }
+ if (!IS_STRING(request.arguments.new_source)) {
+ throw "new_source argument expected";
}
+ var new_source = request.arguments.new_source;
+
try {
- invocation();
+ Debug.LiveEdit.SetScriptSource(the_script, new_source, change_log);
} catch (e) {
if (e instanceof Debug.LiveEdit.Failure) {
// Let's treat it as a "success" so that body with change_log will be
« no previous file with comments | « no previous file | src/liveedit-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698