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

Side by Side Diff: test/debugger/test-api.js

Issue 2685483002: [debugger] expose side-effect free evaluate to inspector. (Closed)
Patch Set: add inspector test Created 3 years, 10 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
OLDNEW
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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 670 }
671 } 671 }
672 672
673 return { value : () => value, 673 return { value : () => value,
674 isUndefined : () => isUndefined, 674 isUndefined : () => isUndefined,
675 type : () => obj.type, 675 type : () => obj.type,
676 className : () => obj.className 676 className : () => obj.className
677 }; 677 };
678 } 678 }
679 679
680 evaluateOnCallFrame(frame, expr) { 680 evaluateOnCallFrame(frame, expr, throw_on_side_effect = false) {
681 const frameid = frame.callFrameId; 681 const frameid = frame.callFrameId;
682 const {msgid, msg} = this.createMessage( 682 const {msgid, msg} = this.createMessage(
683 "Debugger.evaluateOnCallFrame", 683 "Debugger.evaluateOnCallFrame",
684 { callFrameId : frameid, 684 { callFrameId : frameid,
685 expression : expr 685 expression : expr,
686 throwOnSideEffect : throw_on_side_effect,
686 }); 687 });
687 this.sendMessage(msg); 688 this.sendMessage(msg);
688 const reply = this.takeReplyChecked(msgid); 689 const reply = this.takeReplyChecked(msgid);
689 690
690 const result = reply.result.result; 691 const result = reply.result.result;
691 return this.reconstructRemoteObject(result); 692 return this.reconstructRemoteObject(result);
692 } 693 }
693 694
694 frameReceiver(frame) { 695 frameReceiver(frame) {
695 return this.reconstructRemoteObject(frame.this); 696 return this.reconstructRemoteObject(frame.this);
(...skipping 24 matching lines...) Expand all
720 for (let i = 0; i < frame.scopeChain.length; i++) { 721 for (let i = 0; i < frame.scopeChain.length; i++) {
721 scopes.push(this.execStateScope(frame, i)); 722 scopes.push(this.execStateScope(frame, i));
722 } 723 }
723 return scopes; 724 return scopes;
724 } 725 }
725 726
726 return { sourceColumn : () => column, 727 return { sourceColumn : () => column,
727 sourceLine : () => line + 1, 728 sourceLine : () => line + 1,
728 sourceLineText : () => loc.sourceText, 729 sourceLineText : () => loc.sourceText,
729 sourcePosition : () => loc.position, 730 sourcePosition : () => loc.position,
730 evaluate : (expr) => this.evaluateOnCallFrame(frame, expr), 731 evaluate : (expr, throw_on_side_effect) =>
732 this.evaluateOnCallFrame(frame, expr, throw_on_side_effect),
731 functionName : () => frame.functionName, 733 functionName : () => frame.functionName,
732 func : () => func, 734 func : () => func,
733 index : () => index, 735 index : () => index,
734 localCount : () => this.execStateFrameLocalCount(frame), 736 localCount : () => this.execStateFrameLocalCount(frame),
735 localName : (ix) => this.execStateFrameLocalName(frame, ix), 737 localName : (ix) => this.execStateFrameLocalName(frame, ix),
736 localValue: (ix) => this.execStateFrameLocalValue(frame, ix), 738 localValue: (ix) => this.execStateFrameLocalValue(frame, ix),
737 receiver : () => this.frameReceiver(frame), 739 receiver : () => this.frameReceiver(frame),
738 restart : () => this.execStateFrameRestart(frame), 740 restart : () => this.execStateFrameRestart(frame),
739 returnValue : () => this.frameReturnValue(frame), 741 returnValue : () => this.frameReturnValue(frame),
740 scopeCount : () => frame.scopeChain.length, 742 scopeCount : () => frame.scopeChain.length,
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 debug.instance = new DebugWrapper(); 890 debug.instance = new DebugWrapper();
889 debug.instance.enable(); 891 debug.instance.enable();
890 } 892 }
891 return debug.instance; 893 return debug.instance;
892 }}); 894 }});
893 895
894 Object.defineProperty(debug, 'ScopeType', { get: function() { 896 Object.defineProperty(debug, 'ScopeType', { get: function() {
895 const instance = debug.Debug; 897 const instance = debug.Debug;
896 return instance.ScopeType; 898 return instance.ScopeType;
897 }}); 899 }});
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698