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

Side by Side Diff: Source/devtools/front_end/sources/ScopeChainSidebarPane.js

Issue 738733006: DevTools: Support harmony variable scopes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 delete this._expandedSections[section.title]; 62 delete this._expandedSections[section.title];
63 } 63 }
64 64
65 this._sections = []; 65 this._sections = [];
66 66
67 var foundLocalScope = false; 67 var foundLocalScope = false;
68 var scopeChain = callFrame.scopeChain; 68 var scopeChain = callFrame.scopeChain;
69 for (var i = 0; i < scopeChain.length; ++i) { 69 for (var i = 0; i < scopeChain.length; ++i) {
70 var scope = scopeChain[i]; 70 var scope = scopeChain[i];
71 var title = null; 71 var title = null;
72 var subtitle = scope.object.description;
73 var emptyPlaceholder = null; 72 var emptyPlaceholder = null;
74 var extraProperties = []; 73 var extraProperties = [];
75 var declarativeScope; 74 var declarativeScope = true;
76 75
77 switch (scope.type) { 76 switch (scope.type) {
78 case DebuggerAgent.ScopeType.Local: 77 case DebuggerAgent.ScopeType.Local:
79 foundLocalScope = true; 78 foundLocalScope = true;
80 title = WebInspector.UIString("Local"); 79 title = WebInspector.UIString("Local");
81 emptyPlaceholder = WebInspector.UIString("No Variables"); 80 emptyPlaceholder = WebInspector.UIString("No Variables");
82 subtitle = undefined;
83 var thisObject = callFrame.thisObject(); 81 var thisObject = callFrame.thisObject();
84 if (thisObject) 82 if (thisObject)
85 extraProperties.push(new WebInspector.RemoteObjectProperty(" this", thisObject)); 83 extraProperties.push(new WebInspector.RemoteObjectProperty(" this", thisObject));
86 if (i == 0) { 84 if (i == 0) {
87 var details = callFrame.target().debuggerModel.debuggerPause dDetails(); 85 var details = callFrame.target().debuggerModel.debuggerPause dDetails();
88 if (!callFrame.isAsync()) { 86 if (!callFrame.isAsync()) {
89 var exception = details.exception(); 87 var exception = details.exception();
90 if (exception) 88 if (exception)
91 extraProperties.push(new WebInspector.RemoteObjectPr operty("<exception>", exception)); 89 extraProperties.push(new WebInspector.RemoteObjectPr operty("<exception>", exception));
92 } 90 }
93 var returnValue = callFrame.returnValue(); 91 var returnValue = callFrame.returnValue();
94 if (returnValue) 92 if (returnValue)
95 extraProperties.push(new WebInspector.RemoteObjectProper ty("<return>", returnValue)); 93 extraProperties.push(new WebInspector.RemoteObjectProper ty("<return>", returnValue));
96 } 94 }
97 declarativeScope = true;
98 break; 95 break;
99 case DebuggerAgent.ScopeType.Closure: 96 case DebuggerAgent.ScopeType.Closure:
100 title = WebInspector.UIString("Closure"); 97 title = WebInspector.UIString("Closure");
101 emptyPlaceholder = WebInspector.UIString("No Variables"); 98 emptyPlaceholder = WebInspector.UIString("No Variables");
102 subtitle = undefined;
103 declarativeScope = true;
104 break; 99 break;
105 case DebuggerAgent.ScopeType.Catch: 100 case DebuggerAgent.ScopeType.Catch:
106 title = WebInspector.UIString("Catch"); 101 title = WebInspector.UIString("Catch");
107 subtitle = undefined; 102 break;
108 declarativeScope = true; 103 case DebuggerAgent.ScopeType.Block:
104 title = WebInspector.UIString("Block");
105 break;
106 case DebuggerAgent.ScopeType.Script:
107 title = WebInspector.UIString("Script");
109 break; 108 break;
110 case DebuggerAgent.ScopeType.With: 109 case DebuggerAgent.ScopeType.With:
111 title = WebInspector.UIString("With Block"); 110 title = WebInspector.UIString("With Block");
112 declarativeScope = false; 111 declarativeScope = false;
113 break; 112 break;
114 case DebuggerAgent.ScopeType.Global: 113 case DebuggerAgent.ScopeType.Global:
115 title = WebInspector.UIString("Global"); 114 title = WebInspector.UIString("Global");
116 declarativeScope = false; 115 declarativeScope = false;
117 break; 116 break;
118 } 117 }
119 118
119 var subtitle = declarativeScope ? undefined : scope.object.descripti on;
120 if (!title || title === subtitle) 120 if (!title || title === subtitle)
121 subtitle = undefined; 121 subtitle = undefined;
122 122
123 var runtimeModel = callFrame.target().runtimeModel; 123 var runtimeModel = callFrame.target().runtimeModel;
124 if (declarativeScope) 124 if (declarativeScope)
125 var scopeObject = runtimeModel.createScopeRemoteObject(scope.obj ect, new WebInspector.ScopeRef(i, callFrame.id, undefined)); 125 var scopeObject = runtimeModel.createScopeRemoteObject(scope.obj ect, new WebInspector.ScopeRef(i, callFrame.id, undefined));
126 else 126 else
127 var scopeObject = runtimeModel.createRemoteObject(scope.object); 127 var scopeObject = runtimeModel.createRemoteObject(scope.object);
128 128
129 var section = new WebInspector.ObjectPropertiesSection(scopeObject, title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVari ableTreeElement); 129 var section = new WebInspector.ObjectPropertiesSection(scopeObject, title, subtitle, emptyPlaceholder, true, extraProperties, WebInspector.ScopeVari ableTreeElement);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 { 175 {
176 if ("_propertyIdentifier" in this) 176 if ("_propertyIdentifier" in this)
177 return this._propertyIdentifier; 177 return this._propertyIdentifier;
178 var section = this.treeOutline.section; 178 var section = this.treeOutline.section;
179 this._propertyIdentifier = section.title + ":" + (section.subtitle ? sec tion.subtitle + ":" : "") + this.propertyPath(); 179 this._propertyIdentifier = section.title + ":" + (section.subtitle ? sec tion.subtitle + ":" : "") + this.propertyPath();
180 return this._propertyIdentifier; 180 return this._propertyIdentifier;
181 }, 181 },
182 182
183 __proto__: WebInspector.ObjectPropertyTreeElement.prototype 183 __proto__: WebInspector.ObjectPropertyTreeElement.prototype
184 } 184 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/components/ObjectPropertiesSection.js ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698