OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 WebInspector.ScopeChainSidebarPane = function() | 26 WebInspector.ScopeChainSidebarPane = function() |
27 { | 27 { |
28 WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope Variables")
); | 28 WebInspector.SidebarPane.call(this, WebInspector.UIString("Scope Variables")
); |
| 29 this._sections = []; |
| 30 this._expandedSections = {}; |
29 this._expandedProperties = []; | 31 this._expandedProperties = []; |
30 } | 32 } |
31 | 33 |
32 WebInspector.ScopeChainSidebarPane.prototype = { | 34 WebInspector.ScopeChainSidebarPane.prototype = { |
33 update: function(callFrame) | 35 update: function(callFrame) |
34 { | 36 { |
35 this.bodyElement.removeChildren(); | 37 this.bodyElement.removeChildren(); |
36 | 38 |
37 this.sections = []; | |
38 this.callFrame = callFrame; | |
39 | |
40 if (!callFrame) { | 39 if (!callFrame) { |
41 var infoElement = document.createElement("div"); | 40 var infoElement = document.createElement("div"); |
42 infoElement.className = "info"; | 41 infoElement.className = "info"; |
43 infoElement.textContent = WebInspector.UIString("Not Paused"); | 42 infoElement.textContent = WebInspector.UIString("Not Paused"); |
44 this.bodyElement.appendChild(infoElement); | 43 this.bodyElement.appendChild(infoElement); |
45 return; | 44 return; |
46 } | 45 } |
47 | 46 |
| 47 for (var i = 0; i < this._sections.length; ++i) { |
| 48 var section = this._sections[i]; |
| 49 if (!section.title) |
| 50 continue; |
| 51 if (section.expanded) |
| 52 this._expandedSections[section.title] = true; |
| 53 else |
| 54 delete this._expandedSections[section.title]; |
| 55 } |
| 56 |
| 57 this._sections = []; |
| 58 |
48 var foundLocalScope = false; | 59 var foundLocalScope = false; |
49 var scopeChain = callFrame.scopeChain; | 60 var scopeChain = callFrame.scopeChain; |
50 for (var i = 0; i < scopeChain.length; ++i) { | 61 for (var i = 0; i < scopeChain.length; ++i) { |
51 var scopeObjectProxy = scopeChain[i]; | 62 var scopeObjectProxy = scopeChain[i]; |
52 var title = null; | 63 var title = null; |
53 var subtitle = scopeObjectProxy.description; | 64 var subtitle = scopeObjectProxy.description; |
54 var emptyPlaceholder = null; | 65 var emptyPlaceholder = null; |
55 var extraProperties = null; | 66 var extraProperties = null; |
56 | 67 |
57 if (scopeObjectProxy.isLocal) { | 68 if (scopeObjectProxy.isLocal) { |
(...skipping 16 matching lines...) Expand all Loading... |
74 else if (scopeObjectProxy.isWithBlock) | 85 else if (scopeObjectProxy.isWithBlock) |
75 title = WebInspector.UIString("With Block"); | 86 title = WebInspector.UIString("With Block"); |
76 | 87 |
77 if (!title || title === subtitle) | 88 if (!title || title === subtitle) |
78 subtitle = null; | 89 subtitle = null; |
79 | 90 |
80 var section = new WebInspector.ObjectPropertiesSection(WebInspector.
RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, t
rue, extraProperties, WebInspector.ScopeVariableTreeElement); | 91 var section = new WebInspector.ObjectPropertiesSection(WebInspector.
RemoteObject.fromPayload(scopeObjectProxy), title, subtitle, emptyPlaceholder, t
rue, extraProperties, WebInspector.ScopeVariableTreeElement); |
81 section.editInSelectedCallFrameWhenPaused = true; | 92 section.editInSelectedCallFrameWhenPaused = true; |
82 section.pane = this; | 93 section.pane = this; |
83 | 94 |
84 if (!foundLocalScope || scopeObjectProxy.isLocal) | 95 if (!foundLocalScope || scopeObjectProxy.isLocal || title in this._e
xpandedSections) |
85 section.expanded = true; | 96 section.expanded = true; |
86 | 97 |
87 this.sections.push(section); | 98 this._sections.push(section); |
88 this.bodyElement.appendChild(section.element); | 99 this.bodyElement.appendChild(section.element); |
89 } | 100 } |
90 } | 101 } |
91 } | 102 } |
92 | 103 |
93 WebInspector.ScopeChainSidebarPane.prototype.__proto__ = WebInspector.SidebarPan
e.prototype; | 104 WebInspector.ScopeChainSidebarPane.prototype.__proto__ = WebInspector.SidebarPan
e.prototype; |
94 | 105 |
95 WebInspector.ScopeVariableTreeElement = function(property) | 106 WebInspector.ScopeVariableTreeElement = function(property) |
96 { | 107 { |
97 WebInspector.ObjectPropertyTreeElement.call(this, property); | 108 WebInspector.ObjectPropertyTreeElement.call(this, property); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 result = current.property.name; | 150 result = current.property.name; |
140 current = current.parent; | 151 current = current.parent; |
141 } while (current && !current.root); | 152 } while (current && !current.root); |
142 | 153 |
143 this._propertyPath = result; | 154 this._propertyPath = result; |
144 return result; | 155 return result; |
145 } | 156 } |
146 } | 157 } |
147 | 158 |
148 WebInspector.ScopeVariableTreeElement.prototype.__proto__ = WebInspector.ObjectP
ropertyTreeElement.prototype; | 159 WebInspector.ScopeVariableTreeElement.prototype.__proto__ = WebInspector.ObjectP
ropertyTreeElement.prototype; |
OLD | NEW |