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

Side by Side Diff: src/d8.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/array.js ('k') | src/debug-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 2008 the V8 project authors. All rights reserved. 1 // Copyright 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 result += ' in '; 157 result += ' in ';
158 result += body.invocationText; 158 result += body.invocationText;
159 result += ', '; 159 result += ', ';
160 result += SourceInfo(body); 160 result += SourceInfo(body);
161 result += '\n'; 161 result += '\n';
162 result += SourceUnderline(body.sourceLineText, body.sourceColumn); 162 result += SourceUnderline(body.sourceLineText, body.sourceColumn);
163 Debug.State.currentSourceLine = body.sourceLine; 163 Debug.State.currentSourceLine = body.sourceLine;
164 Debug.State.currentFrame = 0; 164 Debug.State.currentFrame = 0;
165 details.text = result; 165 details.text = result;
166 break; 166 break;
167 167
168 case 'exception': 168 case 'exception':
169 if (body.uncaught) { 169 if (body.uncaught) {
170 result += 'Uncaught: '; 170 result += 'Uncaught: ';
171 } else { 171 } else {
172 result += 'Exception: '; 172 result += 'Exception: ';
173 } 173 }
174 result += '"'; 174 result += '"';
175 result += body.exception.text; 175 result += body.exception.text;
176 result += '"'; 176 result += '"';
177 if (body.sourceLine >= 0) { 177 if (body.sourceLine >= 0) {
(...skipping 27 matching lines...) Expand all
205 default: 205 default:
206 details.text = 'Unknown debug event ' + response.event(); 206 details.text = 'Unknown debug event ' + response.event();
207 } 207 }
208 208
209 return details; 209 return details;
210 }; 210 };
211 211
212 212
213 function SourceInfo(body) { 213 function SourceInfo(body) {
214 var result = ''; 214 var result = '';
215 215
216 if (body.script) { 216 if (body.script) {
217 if (body.script.name) { 217 if (body.script.name) {
218 result += body.script.name; 218 result += body.script.name;
219 } else { 219 } else {
220 result += '[unnamed]'; 220 result += '[unnamed]';
221 } 221 }
222 } 222 }
223 result += ' line '; 223 result += ' line ';
224 result += body.sourceLine + 1; 224 result += body.sourceLine + 1;
225 result += ' column '; 225 result += ' column ';
226 result += body.sourceColumn + 1; 226 result += body.sourceColumn + 1;
227 227
228 return result; 228 return result;
229 } 229 }
230 230
231 231
232 function SourceUnderline(source_text, position) { 232 function SourceUnderline(source_text, position) {
233 if (!source_text) { 233 if (!source_text) {
234 return; 234 return;
235 } 235 }
236 236
237 // Create an underline with a caret pointing to the source position. If the 237 // Create an underline with a caret pointing to the source position. If the
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 case 'step': 291 case 'step':
292 case 's': 292 case 's':
293 this.request_ = this.stepCommandToJSONRequest_(args); 293 this.request_ = this.stepCommandToJSONRequest_(args);
294 break; 294 break;
295 295
296 case 'backtrace': 296 case 'backtrace':
297 case 'bt': 297 case 'bt':
298 this.request_ = this.backtraceCommandToJSONRequest_(args); 298 this.request_ = this.backtraceCommandToJSONRequest_(args);
299 break; 299 break;
300 300
301 case 'frame': 301 case 'frame':
302 case 'f': 302 case 'f':
303 this.request_ = this.frameCommandToJSONRequest_(args); 303 this.request_ = this.frameCommandToJSONRequest_(args);
304 break; 304 break;
305 305
306 case 'scopes': 306 case 'scopes':
307 this.request_ = this.scopesCommandToJSONRequest_(args); 307 this.request_ = this.scopesCommandToJSONRequest_(args);
308 break; 308 break;
309 309
310 case 'scope': 310 case 'scope':
311 this.request_ = this.scopeCommandToJSONRequest_(args); 311 this.request_ = this.scopeCommandToJSONRequest_(args);
312 break; 312 break;
313 313
314 case 'print': 314 case 'print':
315 case 'p': 315 case 'p':
316 this.request_ = this.printCommandToJSONRequest_(args); 316 this.request_ = this.printCommandToJSONRequest_(args);
317 break; 317 break;
318 318
319 case 'dir': 319 case 'dir':
320 this.request_ = this.dirCommandToJSONRequest_(args); 320 this.request_ = this.dirCommandToJSONRequest_(args);
321 break; 321 break;
322 322
323 case 'references': 323 case 'references':
324 this.request_ = this.referencesCommandToJSONRequest_(args); 324 this.request_ = this.referencesCommandToJSONRequest_(args);
325 break; 325 break;
326 326
327 case 'instances': 327 case 'instances':
328 this.request_ = this.instancesCommandToJSONRequest_(args); 328 this.request_ = this.instancesCommandToJSONRequest_(args);
329 break; 329 break;
330 330
331 case 'source': 331 case 'source':
332 this.request_ = this.sourceCommandToJSONRequest_(args); 332 this.request_ = this.sourceCommandToJSONRequest_(args);
333 break; 333 break;
334 334
335 case 'scripts': 335 case 'scripts':
336 this.request_ = this.scriptsCommandToJSONRequest_(args); 336 this.request_ = this.scriptsCommandToJSONRequest_(args);
337 break; 337 break;
338 338
339 case 'break': 339 case 'break':
340 case 'b': 340 case 'b':
341 this.request_ = this.breakCommandToJSONRequest_(args); 341 this.request_ = this.breakCommandToJSONRequest_(args);
342 break; 342 break;
343 343
344 case 'clear': 344 case 'clear':
345 this.request_ = this.clearCommandToJSONRequest_(args); 345 this.request_ = this.clearCommandToJSONRequest_(args);
346 break; 346 break;
347 347
348 case 'threads': 348 case 'threads':
349 this.request_ = this.threadsCommandToJSONRequest_(args); 349 this.request_ = this.threadsCommandToJSONRequest_(args);
350 break; 350 break;
351 351
352 case 'trace': 352 case 'trace':
353 // Return undefined to indicate command handled internally (no JSON). 353 // Return undefined to indicate command handled internally (no JSON).
354 this.request_ = void 0; 354 this.request_ = void 0;
355 this.traceCommand_(args); 355 this.traceCommand_(args);
356 break; 356 break;
357 357
358 case 'help': 358 case 'help':
359 case '?': 359 case '?':
360 this.helpCommand_(args); 360 this.helpCommand_(args);
361 // Return undefined to indicate command handled internally (no JSON). 361 // Return undefined to indicate command handled internally (no JSON).
362 this.request_ = void 0; 362 this.request_ = void 0;
363 break; 363 break;
364 364
365 default: 365 default:
366 throw new Error('Unknown command "' + cmd + '"'); 366 throw new Error('Unknown command "' + cmd + '"');
367 } 367 }
368 368
369 last_cmd = cmd; 369 last_cmd = cmd;
370 } 370 }
371 371
372 DebugRequest.prototype.JSONRequest = function() { 372 DebugRequest.prototype.JSONRequest = function() {
373 return this.request_; 373 return this.request_;
374 } 374 }
375 375
376 376
377 function RequestPacket(command) { 377 function RequestPacket(command) {
378 this.seq = 0; 378 this.seq = 0;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 483 }
484 request.arguments.stepcount = stepcount; 484 request.arguments.stepcount = stepcount;
485 } 485 }
486 486
487 // Get the step action. 487 // Get the step action.
488 switch (args[0]) { 488 switch (args[0]) {
489 case 'in': 489 case 'in':
490 case 'i': 490 case 'i':
491 request.arguments.stepaction = 'in'; 491 request.arguments.stepaction = 'in';
492 break; 492 break;
493 493
494 case 'min': 494 case 'min':
495 case 'm': 495 case 'm':
496 request.arguments.stepaction = 'min'; 496 request.arguments.stepaction = 'min';
497 break; 497 break;
498 498
499 case 'next': 499 case 'next':
500 case 'n': 500 case 'n':
501 request.arguments.stepaction = 'next'; 501 request.arguments.stepaction = 'next';
502 break; 502 break;
503 503
504 case 'out': 504 case 'out':
505 case 'o': 505 case 'o':
506 request.arguments.stepaction = 'out'; 506 request.arguments.stepaction = 'out';
507 break; 507 break;
508 508
509 default: 509 default:
510 throw new Error('Invalid step argument "' + args[0] + '".'); 510 throw new Error('Invalid step argument "' + args[0] + '".');
511 } 511 }
512 } 512 }
513 } else { 513 } else {
514 // Default is step next. 514 // Default is step next.
515 request.arguments.stepaction = 'next'; 515 request.arguments.stepaction = 'next';
516 } 516 }
517 517
518 return request.toJSONProtocol(); 518 return request.toJSONProtocol();
519 }; 519 };
520 520
521 521
522 // Create a JSON request for the backtrace command. 522 // Create a JSON request for the backtrace command.
523 DebugRequest.prototype.backtraceCommandToJSONRequest_ = function(args) { 523 DebugRequest.prototype.backtraceCommandToJSONRequest_ = function(args) {
524 // Build a backtrace request from the text command. 524 // Build a backtrace request from the text command.
525 var request = this.createRequest('backtrace'); 525 var request = this.createRequest('backtrace');
526 526
527 // Default is to show top 10 frames. 527 // Default is to show top 10 frames.
528 request.arguments = {}; 528 request.arguments = {};
529 request.arguments.fromFrame = 0; 529 request.arguments.fromFrame = 0;
530 request.arguments.toFrame = 10; 530 request.arguments.toFrame = 10;
531 531
532 args = args.split(/\s*[ ]+\s*/g); 532 args = args.split(/\s*[ ]+\s*/g);
533 if (args.length == 1 && args[0].length > 0) { 533 if (args.length == 1 && args[0].length > 0) {
534 var frameCount = parseInt(args[0]); 534 var frameCount = parseInt(args[0]);
535 if (frameCount > 0) { 535 if (frameCount > 0) {
536 // Show top frames. 536 // Show top frames.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 return this.makeEvaluateJSONRequest_(args); 619 return this.makeEvaluateJSONRequest_(args);
620 }; 620 };
621 621
622 622
623 // Create a JSON request for the references command. 623 // Create a JSON request for the references command.
624 DebugRequest.prototype.referencesCommandToJSONRequest_ = function(args) { 624 DebugRequest.prototype.referencesCommandToJSONRequest_ = function(args) {
625 // Build an evaluate request from the text command. 625 // Build an evaluate request from the text command.
626 if (args.length == 0) { 626 if (args.length == 0) {
627 throw new Error('Missing object id.'); 627 throw new Error('Missing object id.');
628 } 628 }
629 629
630 return this.makeReferencesJSONRequest_(args, 'referencedBy'); 630 return this.makeReferencesJSONRequest_(args, 'referencedBy');
631 }; 631 };
632 632
633 633
634 // Create a JSON request for the instances command. 634 // Create a JSON request for the instances command.
635 DebugRequest.prototype.instancesCommandToJSONRequest_ = function(args) { 635 DebugRequest.prototype.instancesCommandToJSONRequest_ = function(args) {
636 // Build an evaluate request from the text command. 636 // Build an evaluate request from the text command.
637 if (args.length == 0) { 637 if (args.length == 0) {
638 throw new Error('Missing object id.'); 638 throw new Error('Missing object id.');
639 } 639 }
640 640
641 // Build a references request. 641 // Build a references request.
642 return this.makeReferencesJSONRequest_(args, 'constructedBy'); 642 return this.makeReferencesJSONRequest_(args, 'constructedBy');
643 }; 643 };
644 644
645 645
646 // Create a JSON request for the source command. 646 // Create a JSON request for the source command.
647 DebugRequest.prototype.sourceCommandToJSONRequest_ = function(args) { 647 DebugRequest.prototype.sourceCommandToJSONRequest_ = function(args) {
648 // Build a evaluate request from the text command. 648 // Build a evaluate request from the text command.
649 var request = this.createRequest('source'); 649 var request = this.createRequest('source');
650 650
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 684
685 if (args.length > 1) { 685 if (args.length > 1) {
686 throw new Error('Invalid scripts arguments.'); 686 throw new Error('Invalid scripts arguments.');
687 } 687 }
688 688
689 request.arguments = {}; 689 request.arguments = {};
690 switch (args[0]) { 690 switch (args[0]) {
691 case 'natives': 691 case 'natives':
692 request.arguments.types = ScriptTypeFlag(Debug.ScriptType.Native); 692 request.arguments.types = ScriptTypeFlag(Debug.ScriptType.Native);
693 break; 693 break;
694 694
695 case 'extensions': 695 case 'extensions':
696 request.arguments.types = ScriptTypeFlag(Debug.ScriptType.Extension); 696 request.arguments.types = ScriptTypeFlag(Debug.ScriptType.Extension);
697 break; 697 break;
698 698
699 case 'all': 699 case 'all':
700 request.arguments.types = 700 request.arguments.types =
701 ScriptTypeFlag(Debug.ScriptType.Normal) | 701 ScriptTypeFlag(Debug.ScriptType.Normal) |
702 ScriptTypeFlag(Debug.ScriptType.Native) | 702 ScriptTypeFlag(Debug.ScriptType.Native) |
703 ScriptTypeFlag(Debug.ScriptType.Extension); 703 ScriptTypeFlag(Debug.ScriptType.Extension);
704 break; 704 break;
705 705
706 default: 706 default:
707 throw new Error('Invalid argument "' + args[0] + '".'); 707 throw new Error('Invalid argument "' + args[0] + '".');
708 } 708 }
709 } 709 }
710 710
711 return request.toJSONProtocol(); 711 return request.toJSONProtocol();
712 }; 712 };
713 713
714 714
715 // Create a JSON request for the break command. 715 // Create a JSON request for the break command.
(...skipping 17 matching lines...) Expand all
733 condition = args.substring(pos + 1, args.length); 733 condition = args.substring(pos + 1, args.length);
734 } 734 }
735 735
736 // Check for script breakpoint (name:line[:column]). If no ':' in break 736 // Check for script breakpoint (name:line[:column]). If no ':' in break
737 // specification it is considered a function break point. 737 // specification it is considered a function break point.
738 pos = target.indexOf(':'); 738 pos = target.indexOf(':');
739 if (pos > 0) { 739 if (pos > 0) {
740 type = 'script'; 740 type = 'script';
741 var tmp = target.substring(pos + 1, target.length); 741 var tmp = target.substring(pos + 1, target.length);
742 target = target.substring(0, pos); 742 target = target.substring(0, pos);
743 743
744 // Check for both line and column. 744 // Check for both line and column.
745 pos = tmp.indexOf(':'); 745 pos = tmp.indexOf(':');
746 if (pos > 0) { 746 if (pos > 0) {
747 column = parseInt(tmp.substring(pos + 1, tmp.length)) - 1; 747 column = parseInt(tmp.substring(pos + 1, tmp.length)) - 1;
748 line = parseInt(tmp.substring(0, pos)) - 1; 748 line = parseInt(tmp.substring(0, pos)) - 1;
749 } else { 749 } else {
750 line = parseInt(tmp) - 1; 750 line = parseInt(tmp) - 1;
751 } 751 }
752 } else if (target[0] == '#' && target[target.length - 1] == '#') { 752 } else if (target[0] == '#' && target[target.length - 1] == '#') {
753 type = 'handle'; 753 type = 'handle';
754 target = target.substring(1, target.length - 1); 754 target = target.substring(1, target.length - 1);
755 } else { 755 } else {
756 type = 'function'; 756 type = 'function';
757 } 757 }
758 758
759 request.arguments = {}; 759 request.arguments = {};
760 request.arguments.type = type; 760 request.arguments.type = type;
761 request.arguments.target = target; 761 request.arguments.target = target;
762 request.arguments.line = line; 762 request.arguments.line = line;
763 request.arguments.column = column; 763 request.arguments.column = column;
764 request.arguments.condition = condition; 764 request.arguments.condition = condition;
765 } else { 765 } else {
766 throw new Error('Invalid break arguments.'); 766 throw new Error('Invalid break arguments.');
767 } 767 }
768 768
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 details.running = response.running(); 929 details.running = response.running();
930 930
931 var body = response.body(); 931 var body = response.body();
932 var result = ''; 932 var result = '';
933 switch (response.command()) { 933 switch (response.command()) {
934 case 'setbreakpoint': 934 case 'setbreakpoint':
935 result = 'set breakpoint #'; 935 result = 'set breakpoint #';
936 result += body.breakpoint; 936 result += body.breakpoint;
937 details.text = result; 937 details.text = result;
938 break; 938 break;
939 939
940 case 'clearbreakpoint': 940 case 'clearbreakpoint':
941 result = 'cleared breakpoint #'; 941 result = 'cleared breakpoint #';
942 result += body.breakpoint; 942 result += body.breakpoint;
943 details.text = result; 943 details.text = result;
944 break; 944 break;
945 945
946 case 'backtrace': 946 case 'backtrace':
947 if (body.totalFrames == 0) { 947 if (body.totalFrames == 0) {
948 result = '(empty stack)'; 948 result = '(empty stack)';
949 } else { 949 } else {
950 var result = 'Frames #' + body.fromFrame + ' to #' + 950 var result = 'Frames #' + body.fromFrame + ' to #' +
951 (body.toFrame - 1) + ' of ' + body.totalFrames + '\n'; 951 (body.toFrame - 1) + ' of ' + body.totalFrames + '\n';
952 for (i = 0; i < body.frames.length; i++) { 952 for (i = 0; i < body.frames.length; i++) {
953 if (i != 0) result += '\n'; 953 if (i != 0) result += '\n';
954 result += body.frames[i].text; 954 result += body.frames[i].text;
955 } 955 }
956 } 956 }
957 details.text = result; 957 details.text = result;
958 break; 958 break;
959 959
960 case 'frame': 960 case 'frame':
961 details.text = SourceUnderline(body.sourceLineText, 961 details.text = SourceUnderline(body.sourceLineText,
962 body.column); 962 body.column);
963 Debug.State.currentSourceLine = body.line; 963 Debug.State.currentSourceLine = body.line;
964 Debug.State.currentFrame = body.index; 964 Debug.State.currentFrame = body.index;
965 break; 965 break;
966 966
967 case 'scopes': 967 case 'scopes':
968 if (body.totalScopes == 0) { 968 if (body.totalScopes == 0) {
969 result = '(no scopes)'; 969 result = '(no scopes)';
970 } else { 970 } else {
971 result = 'Scopes #' + body.fromScope + ' to #' + 971 result = 'Scopes #' + body.fromScope + ' to #' +
972 (body.toScope - 1) + ' of ' + body.totalScopes + '\n'; 972 (body.toScope - 1) + ' of ' + body.totalScopes + '\n';
973 for (i = 0; i < body.scopes.length; i++) { 973 for (i = 0; i < body.scopes.length; i++) {
974 if (i != 0) { 974 if (i != 0) {
975 result += '\n'; 975 result += '\n';
976 } 976 }
977 result += formatScope_(body.scopes[i]); 977 result += formatScope_(body.scopes[i]);
978 } 978 }
979 } 979 }
980 details.text = result; 980 details.text = result;
981 break; 981 break;
982 982
983 case 'scope': 983 case 'scope':
984 result += formatScope_(body); 984 result += formatScope_(body);
985 result += '\n'; 985 result += '\n';
986 var scope_object_value = response.lookup(body.object.ref); 986 var scope_object_value = response.lookup(body.object.ref);
987 result += formatObject_(scope_object_value, true); 987 result += formatObject_(scope_object_value, true);
988 details.text = result; 988 details.text = result;
989 break; 989 break;
990 990
991 case 'evaluate': 991 case 'evaluate':
992 case 'lookup': 992 case 'lookup':
993 if (last_cmd == 'p' || last_cmd == 'print') { 993 if (last_cmd == 'p' || last_cmd == 'print') {
994 result = body.text; 994 result = body.text;
995 } else { 995 } else {
996 var value; 996 var value;
997 if (lookup_handle) { 997 if (lookup_handle) {
998 value = response.bodyValue(lookup_handle); 998 value = response.bodyValue(lookup_handle);
999 } else { 999 } else {
1000 value = response.bodyValue(); 1000 value = response.bodyValue();
(...skipping 23 matching lines...) Expand all
1024 var count = body.length; 1024 var count = body.length;
1025 result += 'found ' + count + ' objects'; 1025 result += 'found ' + count + ' objects';
1026 result += '\n'; 1026 result += '\n';
1027 for (var i = 0; i < count; i++) { 1027 for (var i = 0; i < count; i++) {
1028 var value = response.bodyValue(i); 1028 var value = response.bodyValue(i);
1029 result += formatObject_(value, false); 1029 result += formatObject_(value, false);
1030 result += '\n'; 1030 result += '\n';
1031 } 1031 }
1032 details.text = result; 1032 details.text = result;
1033 break; 1033 break;
1034 1034
1035 case 'source': 1035 case 'source':
1036 // Get the source from the response. 1036 // Get the source from the response.
1037 var source = body.source; 1037 var source = body.source;
1038 var from_line = body.fromLine + 1; 1038 var from_line = body.fromLine + 1;
1039 var lines = source.split('\n'); 1039 var lines = source.split('\n');
1040 var maxdigits = 1 + Math.floor(log10(from_line + lines.length)); 1040 var maxdigits = 1 + Math.floor(log10(from_line + lines.length));
1041 if (maxdigits < 3) { 1041 if (maxdigits < 3) {
1042 maxdigits = 3; 1042 maxdigits = 3;
1043 } 1043 }
1044 var result = ''; 1044 var result = '';
(...skipping 14 matching lines...) Expand all
1059 for (var i = 0; i < spacer; i++) { 1059 for (var i = 0; i < spacer; i++) {
1060 result += ' '; 1060 result += ' ';
1061 } 1061 }
1062 result += current_line + ': '; 1062 result += current_line + ': ';
1063 } 1063 }
1064 result += lines[num]; 1064 result += lines[num];
1065 result += '\n'; 1065 result += '\n';
1066 } 1066 }
1067 details.text = result; 1067 details.text = result;
1068 break; 1068 break;
1069 1069
1070 case 'scripts': 1070 case 'scripts':
1071 var result = ''; 1071 var result = '';
1072 for (i = 0; i < body.length; i++) { 1072 for (i = 0; i < body.length; i++) {
1073 if (i != 0) result += '\n'; 1073 if (i != 0) result += '\n';
1074 if (body[i].id) { 1074 if (body[i].id) {
1075 result += body[i].id; 1075 result += body[i].id;
1076 } else { 1076 } else {
1077 result += '[no id]'; 1077 result += '[no id]';
1078 } 1078 }
1079 result += ', '; 1079 result += ', ';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 result += ' '; 1121 result += ' ';
1122 result += body.threads[i].id; 1122 result += body.threads[i].id;
1123 result += '\n'; 1123 result += '\n';
1124 } 1124 }
1125 details.text = result; 1125 details.text = result;
1126 break; 1126 break;
1127 1127
1128 case 'continue': 1128 case 'continue':
1129 details.text = "(running)"; 1129 details.text = "(running)";
1130 break; 1130 break;
1131 1131
1132 default: 1132 default:
1133 details.text = 1133 details.text =
1134 'Response for unknown command \'' + response.command + '\'' + 1134 'Response for unknown command \'' + response.command + '\'' +
1135 ' (' + json_response + ')'; 1135 ' (' + json_response + ')';
1136 } 1136 }
1137 } catch (e) { 1137 } catch (e) {
1138 details.text = 'Error: "' + e + '" formatting response'; 1138 details.text = 'Error: "' + e + '" formatting response';
1139 } 1139 }
1140 1140
1141 return details; 1141 return details;
1142 }; 1142 };
1143 1143
1144 1144
1145 /** 1145 /**
1146 * Protocol packages send from the debugger. 1146 * Protocol packages send from the debugger.
1147 * @param {string} json - raw protocol packet as JSON string. 1147 * @param {string} json - raw protocol packet as JSON string.
1148 * @constructor 1148 * @constructor
1149 */ 1149 */
1150 function ProtocolPackage(json) { 1150 function ProtocolPackage(json) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 /** 1247 /**
1248 * Get the value type. 1248 * Get the value type.
1249 * @return {String} the value type 1249 * @return {String} the value type
1250 */ 1250 */
1251 ProtocolValue.prototype.type = function() { 1251 ProtocolValue.prototype.type = function() {
1252 return this.value_.type; 1252 return this.value_.type;
1253 } 1253 }
1254 1254
1255 1255
1256 /** 1256 /**
1257 * Get a metadata field from a protocol value. 1257 * Get a metadata field from a protocol value.
1258 * @return {Object} the metadata field value 1258 * @return {Object} the metadata field value
1259 */ 1259 */
1260 ProtocolValue.prototype.field = function(name) { 1260 ProtocolValue.prototype.field = function(name) {
1261 return this.value_[name]; 1261 return this.value_[name];
1262 } 1262 }
1263 1263
1264 1264
1265 /** 1265 /**
1266 * Check is the value is a primitive value. 1266 * Check is the value is a primitive value.
1267 * @return {boolean} true if the value is primitive 1267 * @return {boolean} true if the value is primitive
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 return '{' + content.join(',') + '}'; 1428 return '{' + content.join(',') + '}';
1429 } 1429 }
1430 1430
1431 1431
1432 function ArrayToJSONArray_(content) { 1432 function ArrayToJSONArray_(content) {
1433 return '[' + content.join(',') + ']'; 1433 return '[' + content.join(',') + ']';
1434 } 1434 }
1435 1435
1436 1436
1437 function BooleanToJSON_(value) { 1437 function BooleanToJSON_(value) {
1438 return String(value); 1438 return String(value);
1439 } 1439 }
1440 1440
1441 1441
1442 function NumberToJSON_(value) { 1442 function NumberToJSON_(value) {
1443 return String(value); 1443 return String(value);
1444 } 1444 }
1445 1445
1446 1446
1447 // Mapping of some control characters to avoid the \uXXXX syntax for most 1447 // Mapping of some control characters to avoid the \uXXXX syntax for most
1448 // commonly used control cahracters. 1448 // commonly used control cahracters.
1449 const ctrlCharMap_ = { 1449 const ctrlCharMap_ = {
1450 '\b': '\\b', 1450 '\b': '\\b',
1451 '\t': '\\t', 1451 '\t': '\\t',
1452 '\n': '\\n', 1452 '\n': '\\n',
1453 '\f': '\\f', 1453 '\f': '\\f',
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 json += NumberToJSON_(elem); 1616 json += NumberToJSON_(elem);
1617 } else if (typeof(elem) === 'string') { 1617 } else if (typeof(elem) === 'string') {
1618 json += StringToJSON_(elem); 1618 json += StringToJSON_(elem);
1619 } else { 1619 } else {
1620 json += elem; 1620 json += elem;
1621 } 1621 }
1622 } 1622 }
1623 json += ']'; 1623 json += ']';
1624 return json; 1624 return json;
1625 } 1625 }
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/debug-debugger.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698