OLD | NEW |
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 |
11 * notice, this list of conditions and the following disclaimer in the | 11 * notice, this list of conditions and the following disclaimer in the |
12 * documentation and/or other materials provided with the distribution. | 12 * documentation and/or other materials provided with the distribution. |
13 * | 13 * |
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY | 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR | 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 /** | 27 /** |
28 * @constructor | 28 * @constructor |
29 * @extends {WebInspector.SimpleView} | 29 * @extends {WebInspector.VBox} |
| 30 * @implements {WebInspector.ContextFlavorListener} |
30 */ | 31 */ |
31 WebInspector.ScopeChainSidebarPane = function() | 32 WebInspector.ScopeChainSidebarPane = function() |
32 { | 33 { |
33 WebInspector.SimpleView.call(this, WebInspector.UIString("Scope")); | 34 WebInspector.VBox.call(this); |
34 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr
oller(); | 35 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr
oller(); |
35 this._linkifier = new WebInspector.Linkifier(); | 36 this._linkifier = new WebInspector.Linkifier(); |
36 WebInspector.context.addFlavorChangeListener(WebInspector.DebuggerModel.Call
Frame, this._update, this); | 37 this._update(); |
37 } | 38 } |
38 | 39 |
39 WebInspector.ScopeChainSidebarPane._pathSymbol = Symbol("path"); | 40 WebInspector.ScopeChainSidebarPane._pathSymbol = Symbol("path"); |
40 | 41 |
41 WebInspector.ScopeChainSidebarPane.prototype = { | 42 WebInspector.ScopeChainSidebarPane.prototype = { |
| 43 /** |
| 44 * @override |
| 45 * @param {?Object} object |
| 46 */ |
| 47 flavorChanged: function(object) |
| 48 { |
| 49 this._update(); |
| 50 }, |
| 51 |
42 _update: function() | 52 _update: function() |
43 { | 53 { |
44 var callFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.C
allFrame); | 54 var callFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.C
allFrame); |
| 55 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDet
ails); |
45 this._linkifier.reset(); | 56 this._linkifier.reset(); |
46 WebInspector.SourceMapNamesResolver.resolveThisObject(callFrame) | 57 WebInspector.SourceMapNamesResolver.resolveThisObject(callFrame) |
47 .then(this._innerUpdate.bind(this, callFrame)); | 58 .then(this._innerUpdate.bind(this, details, callFrame)); |
48 }, | 59 }, |
49 | 60 |
50 /** | 61 /** |
| 62 * @param {?WebInspector.DebuggerPausedDetails} details |
51 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame | 63 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame |
52 * @param {?WebInspector.RemoteObject} thisObject | 64 * @param {?WebInspector.RemoteObject} thisObject |
53 */ | 65 */ |
54 _innerUpdate: function(callFrame, thisObject) | 66 _innerUpdate: function(details, callFrame, thisObject) |
55 { | 67 { |
56 this.element.removeChildren(); | 68 this.element.removeChildren(); |
57 | 69 |
58 if (!callFrame) { | 70 if (!details || !callFrame) { |
59 var infoElement = createElement("div"); | 71 var infoElement = createElement("div"); |
60 infoElement.className = "gray-info-message"; | 72 infoElement.className = "gray-info-message"; |
61 infoElement.textContent = WebInspector.UIString("Not Paused"); | 73 infoElement.textContent = WebInspector.UIString("Not Paused"); |
62 this.element.appendChild(infoElement); | 74 this.element.appendChild(infoElement); |
63 return; | 75 return; |
64 } | 76 } |
65 | 77 |
66 var foundLocalScope = false; | 78 var foundLocalScope = false; |
67 var scopeChain = callFrame.scopeChain(); | 79 var scopeChain = callFrame.scopeChain(); |
68 for (var i = 0; i < scopeChain.length; ++i) { | 80 for (var i = 0; i < scopeChain.length; ++i) { |
69 var scope = scopeChain[i]; | 81 var scope = scopeChain[i]; |
70 var title = null; | 82 var title = null; |
71 var emptyPlaceholder = null; | 83 var emptyPlaceholder = null; |
72 var extraProperties = []; | 84 var extraProperties = []; |
73 | 85 |
74 switch (scope.type()) { | 86 switch (scope.type()) { |
75 case DebuggerAgent.ScopeType.Local: | 87 case DebuggerAgent.ScopeType.Local: |
76 foundLocalScope = true; | 88 foundLocalScope = true; |
77 title = WebInspector.UIString("Local"); | 89 title = WebInspector.UIString("Local"); |
78 emptyPlaceholder = WebInspector.UIString("No Variables"); | 90 emptyPlaceholder = WebInspector.UIString("No Variables"); |
79 if (thisObject) | 91 if (thisObject) |
80 extraProperties.push(new WebInspector.RemoteObjectProperty("
this", thisObject)); | 92 extraProperties.push(new WebInspector.RemoteObjectProperty("
this", thisObject)); |
81 if (i === 0) { | 93 if (i === 0) { |
82 var details = callFrame.debuggerModel.debuggerPausedDetails(
); | |
83 var exception = details.exception(); | 94 var exception = details.exception(); |
84 if (exception) | 95 if (exception) |
85 extraProperties.push(new WebInspector.RemoteObjectProper
ty(WebInspector.UIString.capitalize("Exception"), exception, undefined, undefine
d, undefined, undefined, undefined, true)); | 96 extraProperties.push(new WebInspector.RemoteObjectProper
ty(WebInspector.UIString.capitalize("Exception"), exception, undefined, undefine
d, undefined, undefined, undefined, true)); |
86 var returnValue = callFrame.returnValue(); | 97 var returnValue = callFrame.returnValue(); |
87 if (returnValue) | 98 if (returnValue) |
88 extraProperties.push(new WebInspector.RemoteObjectProper
ty(WebInspector.UIString.capitalize("Return ^value"), returnValue, undefined, un
defined, undefined, undefined, undefined, true)); | 99 extraProperties.push(new WebInspector.RemoteObjectProper
ty(WebInspector.UIString.capitalize("Return ^value"), returnValue, undefined, un
defined, undefined, undefined, undefined, true)); |
89 } | 100 } |
90 break; | 101 break; |
91 case DebuggerAgent.ScopeType.Closure: | 102 case DebuggerAgent.ScopeType.Closure: |
92 var scopeName = scope.name(); | 103 var scopeName = scope.name(); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 section.objectTreeElement().expand(); | 141 section.objectTreeElement().expand(); |
131 | 142 |
132 section.element.classList.add("scope-chain-sidebar-pane-section"); | 143 section.element.classList.add("scope-chain-sidebar-pane-section"); |
133 this.element.appendChild(section.element); | 144 this.element.appendChild(section.element); |
134 } | 145 } |
135 this._sidebarPaneUpdatedForTest(); | 146 this._sidebarPaneUpdatedForTest(); |
136 }, | 147 }, |
137 | 148 |
138 _sidebarPaneUpdatedForTest: function() { }, | 149 _sidebarPaneUpdatedForTest: function() { }, |
139 | 150 |
140 __proto__: WebInspector.SimpleView.prototype | 151 __proto__: WebInspector.VBox.prototype |
141 } | 152 } |
OLD | NEW |