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

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

Issue 1559006: Remove trailing regexp from .js files. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « src/d8.js ('k') | src/liveedit-debugger.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 response.success = false; 1267 response.success = false;
1268 response.message = %ToString(e); 1268 response.message = %ToString(e);
1269 } 1269 }
1270 1270
1271 // Return the response as a JSON encoded string. 1271 // Return the response as a JSON encoded string.
1272 try { 1272 try {
1273 if (!IS_UNDEFINED(response.running)) { 1273 if (!IS_UNDEFINED(response.running)) {
1274 // Response controls running state. 1274 // Response controls running state.
1275 this.running_ = response.running; 1275 this.running_ = response.running;
1276 } 1276 }
1277 response.running = this.running_; 1277 response.running = this.running_;
1278 return response.toJSONProtocol(); 1278 return response.toJSONProtocol();
1279 } catch (e) { 1279 } catch (e) {
1280 // Failed to generate response - return generic error. 1280 // Failed to generate response - return generic error.
1281 return '{"seq":' + response.seq + ',' + 1281 return '{"seq":' + response.seq + ',' +
1282 '"request_seq":' + request.seq + ',' + 1282 '"request_seq":' + request.seq + ',' +
1283 '"type":"response",' + 1283 '"type":"response",' +
1284 '"success":false,' + 1284 '"success":false,' +
1285 '"message":"Internal error: ' + %ToString(e) + '"}'; 1285 '"message":"Internal error: ' + %ToString(e) + '"}';
1286 } 1286 }
1287 } catch (e) { 1287 } catch (e) {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 var includeSource = false; 1863 var includeSource = false;
1864 var idsToInclude = null; 1864 var idsToInclude = null;
1865 if (request.arguments) { 1865 if (request.arguments) {
1866 // Pull out arguments. 1866 // Pull out arguments.
1867 if (!IS_UNDEFINED(request.arguments.types)) { 1867 if (!IS_UNDEFINED(request.arguments.types)) {
1868 types = %ToNumber(request.arguments.types); 1868 types = %ToNumber(request.arguments.types);
1869 if (isNaN(types) || types < 0) { 1869 if (isNaN(types) || types < 0) {
1870 return response.failed('Invalid types "' + request.arguments.types + '"' ); 1870 return response.failed('Invalid types "' + request.arguments.types + '"' );
1871 } 1871 }
1872 } 1872 }
1873 1873
1874 if (!IS_UNDEFINED(request.arguments.includeSource)) { 1874 if (!IS_UNDEFINED(request.arguments.includeSource)) {
1875 includeSource = %ToBoolean(request.arguments.includeSource); 1875 includeSource = %ToBoolean(request.arguments.includeSource);
1876 response.setOption('includeSource', includeSource); 1876 response.setOption('includeSource', includeSource);
1877 } 1877 }
1878 1878
1879 if (IS_ARRAY(request.arguments.ids)) { 1879 if (IS_ARRAY(request.arguments.ids)) {
1880 idsToInclude = {}; 1880 idsToInclude = {};
1881 var ids = request.arguments.ids; 1881 var ids = request.arguments.ids;
1882 for (var i = 0; i < ids.length; i++) { 1882 for (var i = 0; i < ids.length; i++) {
1883 idsToInclude[ids[i]] = true; 1883 idsToInclude[ids[i]] = true;
1884 } 1884 }
1885 } 1885 }
1886 } 1886 }
1887 1887
1888 // Collect all scripts in the heap. 1888 // Collect all scripts in the heap.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1966 return response.failed('Missing arguments'); 1966 return response.failed('Missing arguments');
1967 } 1967 }
1968 var script_id = request.arguments.script_id; 1968 var script_id = request.arguments.script_id;
1969 var change_pos = parseInt(request.arguments.change_pos); 1969 var change_pos = parseInt(request.arguments.change_pos);
1970 var change_len = parseInt(request.arguments.change_len); 1970 var change_len = parseInt(request.arguments.change_len);
1971 var new_string = request.arguments.new_string; 1971 var new_string = request.arguments.new_string;
1972 if (!IS_STRING(new_string)) { 1972 if (!IS_STRING(new_string)) {
1973 response.failed('Argument "new_string" is not a string value'); 1973 response.failed('Argument "new_string" is not a string value');
1974 return; 1974 return;
1975 } 1975 }
1976 1976
1977 var scripts = %DebugGetLoadedScripts(); 1977 var scripts = %DebugGetLoadedScripts();
1978 1978
1979 var the_script = null; 1979 var the_script = null;
1980 for (var i = 0; i < scripts.length; i++) { 1980 for (var i = 0; i < scripts.length; i++) {
1981 if (scripts[i].id == script_id) { 1981 if (scripts[i].id == script_id) {
1982 the_script = scripts[i]; 1982 the_script = scripts[i];
1983 } 1983 }
1984 } 1984 }
1985 if (!the_script) { 1985 if (!the_script) {
1986 response.failed('Script not found'); 1986 response.failed('Script not found');
1987 return; 1987 return;
1988 } 1988 }
1989 1989
1990 var change_log = new Array(); 1990 var change_log = new Array();
1991 try { 1991 try {
1992 Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string, 1992 Debug.LiveEditChangeScript(the_script, change_pos, change_len, new_string,
1993 change_log); 1993 change_log);
1994 } catch (e) { 1994 } catch (e) {
1995 if (e instanceof Debug.LiveEditChangeScript.Failure) { 1995 if (e instanceof Debug.LiveEditChangeScript.Failure) {
1996 // Let's treat it as a "success" so that body with change_log will be 1996 // Let's treat it as a "success" so that body with change_log will be
1997 // sent back. "change_log" will have "failure" field set. 1997 // sent back. "change_log" will have "failure" field set.
1998 change_log.push( { failure: true } ); 1998 change_log.push( { failure: true } );
1999 } else { 1999 } else {
2000 throw e; 2000 throw e;
2001 } 2001 }
2002 } 2002 }
2003 response.body = {change_log: change_log}; 2003 response.body = {change_log: change_log};
2004 }; 2004 };
2005 2005
2006 2006
2007 // Check whether the previously processed command caused the VM to become 2007 // Check whether the previously processed command caused the VM to become
2008 // running. 2008 // running.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 if (typeof key == 'string') { 2069 if (typeof key == 'string') {
2070 // Format the value based on its type. 2070 // Format the value based on its type.
2071 var property_value_json = ValueToProtocolValue_(object[key], 2071 var property_value_json = ValueToProtocolValue_(object[key],
2072 mirror_serializer); 2072 mirror_serializer);
2073 // Add the property if relevant. 2073 // Add the property if relevant.
2074 if (!IS_UNDEFINED(property_value_json)) { 2074 if (!IS_UNDEFINED(property_value_json)) {
2075 content[key] = property_value_json; 2075 content[key] = property_value_json;
2076 } 2076 }
2077 } 2077 }
2078 } 2078 }
2079 2079
2080 return content; 2080 return content;
2081 } 2081 }
2082 2082
2083 2083
2084 /** 2084 /**
2085 * Convert an array to its debugger protocol representation. It will convert 2085 * Convert an array to its debugger protocol representation. It will convert
2086 * each array element to a protocol value. 2086 * each array element to a protocol value.
2087 * @param {Array} array The array to format as protocol array. 2087 * @param {Array} array The array to format as protocol array.
2088 * @param {MirrorSerializer} mirror_serializer The serializer to use if any 2088 * @param {MirrorSerializer} mirror_serializer The serializer to use if any
2089 * mirror objects are encountered. 2089 * mirror objects are encountered.
2090 * @return {Array} Protocol array value. 2090 * @return {Array} Protocol array value.
2091 */ 2091 */
2092 function ArrayToProtocolArray_(array, mirror_serializer) { 2092 function ArrayToProtocolArray_(array, mirror_serializer) {
2093 var json = []; 2093 var json = [];
2094 for (var i = 0; i < array.length; i++) { 2094 for (var i = 0; i < array.length; i++) {
2095 json.push(ValueToProtocolValue_(array[i], mirror_serializer)); 2095 json.push(ValueToProtocolValue_(array[i], mirror_serializer));
2096 } 2096 }
2097 return json; 2097 return json;
2098 } 2098 }
2099 2099
2100 2100
2101 /** 2101 /**
2102 * Convert a value to its debugger protocol representation. 2102 * Convert a value to its debugger protocol representation.
2103 * @param {*} value The value to format as protocol value. 2103 * @param {*} value The value to format as protocol value.
2104 * @param {MirrorSerializer} mirror_serializer The serializer to use if any 2104 * @param {MirrorSerializer} mirror_serializer The serializer to use if any
2105 * mirror objects are encountered. 2105 * mirror objects are encountered.
2106 * @return {*} Protocol value. 2106 * @return {*} Protocol value.
2107 */ 2107 */
2108 function ValueToProtocolValue_(value, mirror_serializer) { 2108 function ValueToProtocolValue_(value, mirror_serializer) {
2109 // Format the value based on its type. 2109 // Format the value based on its type.
2110 var json; 2110 var json;
2111 switch (typeof value) { 2111 switch (typeof value) {
2112 case 'object': 2112 case 'object':
(...skipping 10 matching lines...) Expand all
2123 case 'string': 2123 case 'string':
2124 case 'number': 2124 case 'number':
2125 json = value; 2125 json = value;
2126 break 2126 break
2127 2127
2128 default: 2128 default:
2129 json = null; 2129 json = null;
2130 } 2130 }
2131 return json; 2131 return json;
2132 } 2132 }
OLDNEW
« no previous file with comments | « src/d8.js ('k') | src/liveedit-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698