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

Side by Side Diff: src/debug-debugger.js

Issue 11421100: Issue 2429, core implementation and the protocol change (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: follow codereview Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/isolate.h » ('j') | src/liveedit.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 1299
1300 1300
1301 ProtocolMessage.prototype.setOption = function(name, value) { 1301 ProtocolMessage.prototype.setOption = function(name, value) {
1302 if (!this.options_) { 1302 if (!this.options_) {
1303 this.options_ = {}; 1303 this.options_ = {};
1304 } 1304 }
1305 this.options_[name] = value; 1305 this.options_[name] = value;
1306 }; 1306 };
1307 1307
1308 1308
1309 ProtocolMessage.prototype.failed = function(message) { 1309 ProtocolMessage.prototype.failed = function(message, opt_details) {
1310 this.success = false; 1310 this.success = false;
1311 this.message = message; 1311 this.message = message;
1312 if (IS_OBJECT(opt_details)) {
1313 this.error_details = opt_details;
1314 }
1312 }; 1315 };
1313 1316
1314 1317
1315 ProtocolMessage.prototype.toJSONProtocol = function() { 1318 ProtocolMessage.prototype.toJSONProtocol = function() {
1316 // Encode the protocol header. 1319 // Encode the protocol header.
1317 var json = {}; 1320 var json = {};
1318 json.seq= this.seq; 1321 json.seq= this.seq;
1319 if (this.request_seq) { 1322 if (this.request_seq) {
1320 json.request_seq = this.request_seq; 1323 json.request_seq = this.request_seq;
1321 } 1324 }
(...skipping 26 matching lines...) Expand all
1348 } 1351 }
1349 } else { 1352 } else {
1350 bodyJson = ObjectToProtocolObject_(this.body, serializer); 1353 bodyJson = ObjectToProtocolObject_(this.body, serializer);
1351 } 1354 }
1352 json.body = bodyJson; 1355 json.body = bodyJson;
1353 json.refs = serializer.serializeReferencedObjects(); 1356 json.refs = serializer.serializeReferencedObjects();
1354 } 1357 }
1355 if (this.message) { 1358 if (this.message) {
1356 json.message = this.message; 1359 json.message = this.message;
1357 } 1360 }
1361 if (this.error_details) {
1362 json.error_details = this.error_details;
1363 }
1358 json.running = this.running; 1364 json.running = this.running;
1359 return JSON.stringify(json); 1365 return JSON.stringify(json);
1360 }; 1366 };
1361 1367
1362 1368
1363 DebugCommandProcessor.prototype.createResponse = function(request) { 1369 DebugCommandProcessor.prototype.createResponse = function(request) {
1364 return new ProtocolMessage(request); 1370 return new ProtocolMessage(request);
1365 }; 1371 };
1366 1372
1367 1373
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 } 2460 }
2455 2461
2456 var change_log = new Array(); 2462 var change_log = new Array();
2457 2463
2458 if (!IS_STRING(request.arguments.new_source)) { 2464 if (!IS_STRING(request.arguments.new_source)) {
2459 throw "new_source argument expected"; 2465 throw "new_source argument expected";
2460 } 2466 }
2461 2467
2462 var new_source = request.arguments.new_source; 2468 var new_source = request.arguments.new_source;
2463 2469
2464 var result_description = Debug.LiveEdit.SetScriptSource(the_script, 2470 var result_description;
2465 new_source, preview_only, change_log); 2471 try {
2472 result_description = Debug.LiveEdit.SetScriptSource(the_script,
2473 new_source, preview_only, change_log);
2474 } catch (e) {
2475 if (e instanceof Debug.LiveEdit.Failure && "details" in e) {
2476 response.failed(e.message, e.details);
2477 return;
2478 }
2479 throw e;
2480 }
2466 response.body = {change_log: change_log, result: result_description}; 2481 response.body = {change_log: change_log, result: result_description};
2467 2482
2468 if (!preview_only && !this.running_ && result_description.stack_modified) { 2483 if (!preview_only && !this.running_ && result_description.stack_modified) {
2469 response.body.stepin_recommended = true; 2484 response.body.stepin_recommended = true;
2470 } 2485 }
2471 }; 2486 };
2472 2487
2473 2488
2474 DebugCommandProcessor.prototype.restartFrameRequest_ = function( 2489 DebugCommandProcessor.prototype.restartFrameRequest_ = function(
2475 request, response) { 2490 request, response) {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 2749
2735 default: 2750 default:
2736 json = null; 2751 json = null;
2737 } 2752 }
2738 return json; 2753 return json;
2739 } 2754 }
2740 2755
2741 Debug.TestApi = { 2756 Debug.TestApi = {
2742 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_ 2757 CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_
2743 }; 2758 };
OLDNEW
« no previous file with comments | « no previous file | src/isolate.h » ('j') | src/liveedit.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698