OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // If true, prints all messages sent and received by inspector. | 7 // If true, prints all messages sent and received by inspector. |
8 const printProtocolMessages = false; | 8 const printProtocolMessages = false; |
9 | 9 |
10 // The active wrapper instance. | 10 // The active wrapper instance. |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 | 511 |
512 let localValue; | 512 let localValue; |
513 switch (local.value.type) { | 513 switch (local.value.type) { |
514 case "undefined": localValue = undefined; break; | 514 case "undefined": localValue = undefined; break; |
515 default: localValue = local.value.value; break; | 515 default: localValue = local.value.value; break; |
516 } | 516 } |
517 | 517 |
518 return { value : () => localValue }; | 518 return { value : () => localValue }; |
519 } | 519 } |
520 | 520 |
| 521 reconstructValue(objectId) { |
| 522 const {msgid, msg} = this.createMessage( |
| 523 "Runtime.getProperties", { objectId : objectId, ownProperties: true }); |
| 524 this.sendMessage(msg); |
| 525 const reply = this.takeReplyChecked(msgid); |
| 526 return Object(reply.result.internalProperties[0].value.value); |
| 527 } |
| 528 |
521 reconstructRemoteObject(obj) { | 529 reconstructRemoteObject(obj) { |
522 let value = obj.value; | 530 let value = obj.value; |
523 let isUndefined = false; | 531 let isUndefined = false; |
524 | 532 |
525 switch (obj.type) { | 533 switch (obj.type) { |
526 case "object": { | 534 case "object": { |
527 switch (obj.subtype) { | 535 switch (obj.subtype) { |
528 case "error": { | 536 case "error": { |
529 const desc = obj.description; | 537 const desc = obj.description; |
530 switch (obj.className) { | 538 switch (obj.className) { |
(...skipping 15 matching lines...) Expand all Loading... |
546 array[i] = props[i]; | 554 array[i] = props[i]; |
547 } | 555 } |
548 value = array; | 556 value = array; |
549 break; | 557 break; |
550 } | 558 } |
551 case "null": { | 559 case "null": { |
552 value = null; | 560 value = null; |
553 break; | 561 break; |
554 } | 562 } |
555 default: { | 563 default: { |
556 value = this.propertiesToObject(this.getProperties(obj.objectId)); | 564 switch (obj.className) { |
| 565 case "global": |
| 566 value = Function('return this')(); |
| 567 break; |
| 568 case "Number": |
| 569 case "String": |
| 570 case "Boolean": |
| 571 value = this.reconstructValue(obj.objectId); |
| 572 break; |
| 573 default: |
| 574 value = this.propertiesToObject( |
| 575 this.getProperties(obj.objectId)); |
| 576 break; |
| 577 } |
557 break; | 578 break; |
558 } | 579 } |
559 } | 580 } |
560 break; | 581 break; |
561 } | 582 } |
562 case "undefined": { | 583 case "undefined": { |
563 value = undefined; | 584 value = undefined; |
564 isUndefined = true; | 585 isUndefined = true; |
565 break; | 586 break; |
566 } | 587 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 debug.instance = new DebugWrapper(); | 785 debug.instance = new DebugWrapper(); |
765 debug.instance.enable(); | 786 debug.instance.enable(); |
766 } | 787 } |
767 return debug.instance; | 788 return debug.instance; |
768 }}); | 789 }}); |
769 | 790 |
770 Object.defineProperty(debug, 'ScopeType', { get: function() { | 791 Object.defineProperty(debug, 'ScopeType', { get: function() { |
771 const instance = debug.Debug; | 792 const instance = debug.Debug; |
772 return instance.ScopeType; | 793 return instance.ScopeType; |
773 }}); | 794 }}); |
OLD | NEW |