OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 } else if (request.arguments.command == 'pause') { | 1963 } else if (request.arguments.command == 'pause') { |
1964 %ProfilerPause(modules, tag); | 1964 %ProfilerPause(modules, tag); |
1965 } else { | 1965 } else { |
1966 return response.failed('Unknown command'); | 1966 return response.failed('Unknown command'); |
1967 } | 1967 } |
1968 response.body = {}; | 1968 response.body = {}; |
1969 }; | 1969 }; |
1970 | 1970 |
1971 | 1971 |
1972 DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
{ | 1972 DebugCommandProcessor.prototype.changeLiveRequest_ = function(request, response)
{ |
1973 if (!Debug.LiveEditChangeScript) { | 1973 if (!Debug.LiveEdit) { |
1974 return response.failed('LiveEdit feature is not supported'); | 1974 return response.failed('LiveEdit feature is not supported'); |
1975 } | 1975 } |
1976 if (!request.arguments) { | 1976 if (!request.arguments) { |
1977 return response.failed('Missing arguments'); | 1977 return response.failed('Missing arguments'); |
1978 } | 1978 } |
1979 var script_id = request.arguments.script_id; | 1979 var script_id = request.arguments.script_id; |
1980 | 1980 |
1981 var scripts = %DebugGetLoadedScripts(); | 1981 var scripts = %DebugGetLoadedScripts(); |
1982 | 1982 |
1983 var the_script = null; | 1983 var the_script = null; |
(...skipping 19 matching lines...) Expand all Loading... |
2003 } | 2003 } |
2004 } else { | 2004 } else { |
2005 var change_pos = parseInt(request.arguments.change_pos); | 2005 var change_pos = parseInt(request.arguments.change_pos); |
2006 var change_len = parseInt(request.arguments.change_len); | 2006 var change_len = parseInt(request.arguments.change_len); |
2007 var new_string = request.arguments.new_string; | 2007 var new_string = request.arguments.new_string; |
2008 if (!IS_STRING(new_string)) { | 2008 if (!IS_STRING(new_string)) { |
2009 response.failed('Argument "new_string" is not a string value'); | 2009 response.failed('Argument "new_string" is not a string value'); |
2010 return; | 2010 return; |
2011 } | 2011 } |
2012 invocation = function() { | 2012 invocation = function() { |
2013 return Debug.LiveEditChangeScript(the_script, change_pos, change_len, | 2013 return Debug.LiveEdit.ApplyPatch(the_script, change_pos, change_len, |
2014 new_string, change_log); | 2014 new_string, change_log); |
2015 } | 2015 } |
2016 } | 2016 } |
2017 | 2017 |
2018 try { | 2018 try { |
2019 invocation(); | 2019 invocation(); |
2020 } catch (e) { | 2020 } catch (e) { |
2021 if (e instanceof Debug.LiveEditChangeScript.Failure) { | 2021 if (e instanceof Debug.LiveEdit.Failure) { |
2022 // Let's treat it as a "success" so that body with change_log will be | 2022 // Let's treat it as a "success" so that body with change_log will be |
2023 // sent back. "change_log" will have "failure" field set. | 2023 // sent back. "change_log" will have "failure" field set. |
2024 change_log.push( { failure: true, message: e.toString() } ); | 2024 change_log.push( { failure: true, message: e.toString() } ); |
2025 } else { | 2025 } else { |
2026 throw e; | 2026 throw e; |
2027 } | 2027 } |
2028 } | 2028 } |
2029 response.body = {change_log: change_log}; | 2029 response.body = {change_log: change_log}; |
2030 }; | 2030 }; |
2031 | 2031 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2149 case 'string': | 2149 case 'string': |
2150 case 'number': | 2150 case 'number': |
2151 json = value; | 2151 json = value; |
2152 break | 2152 break |
2153 | 2153 |
2154 default: | 2154 default: |
2155 json = null; | 2155 json = null; |
2156 } | 2156 } |
2157 return json; | 2157 return json; |
2158 } | 2158 } |
OLD | NEW |