| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 } | 2386 } |
| 2381 | 2387 |
| 2382 var change_log = new Array(); | 2388 var change_log = new Array(); |
| 2383 | 2389 |
| 2384 if (!IS_STRING(request.arguments.new_source)) { | 2390 if (!IS_STRING(request.arguments.new_source)) { |
| 2385 throw "new_source argument expected"; | 2391 throw "new_source argument expected"; |
| 2386 } | 2392 } |
| 2387 | 2393 |
| 2388 var new_source = request.arguments.new_source; | 2394 var new_source = request.arguments.new_source; |
| 2389 | 2395 |
| 2390 var result_description = Debug.LiveEdit.SetScriptSource(the_script, | 2396 var result_description; |
| 2391 new_source, preview_only, change_log); | 2397 try { |
| 2398 result_description = Debug.LiveEdit.SetScriptSource(the_script, |
| 2399 new_source, preview_only, change_log); |
| 2400 } catch (e) { |
| 2401 if (e instanceof Debug.LiveEdit.Failure && "details" in e) { |
| 2402 response.failed(e.message, e.details); |
| 2403 return; |
| 2404 } |
| 2405 throw e; |
| 2406 } |
| 2392 response.body = {change_log: change_log, result: result_description}; | 2407 response.body = {change_log: change_log, result: result_description}; |
| 2393 | 2408 |
| 2394 if (!preview_only && !this.running_ && result_description.stack_modified) { | 2409 if (!preview_only && !this.running_ && result_description.stack_modified) { |
| 2395 response.body.stepin_recommended = true; | 2410 response.body.stepin_recommended = true; |
| 2396 } | 2411 } |
| 2397 }; | 2412 }; |
| 2398 | 2413 |
| 2399 | 2414 |
| 2400 DebugCommandProcessor.prototype.restartFrameRequest_ = function( | 2415 DebugCommandProcessor.prototype.restartFrameRequest_ = function( |
| 2401 request, response) { | 2416 request, response) { |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2656 case 'string': | 2671 case 'string': |
| 2657 case 'number': | 2672 case 'number': |
| 2658 json = value; | 2673 json = value; |
| 2659 break; | 2674 break; |
| 2660 | 2675 |
| 2661 default: | 2676 default: |
| 2662 json = null; | 2677 json = null; |
| 2663 } | 2678 } |
| 2664 return json; | 2679 return json; |
| 2665 } | 2680 } |
| OLD | NEW |