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

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

Issue 2493373002: DevTools: rename WebInspector into modules. (Closed)
Patch Set: for bots Created 4 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
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
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 * @implements {WebInspector.ContextFlavorListener} 27 * @implements {UI.ContextFlavorListener}
28 * @unrestricted 28 * @unrestricted
29 */ 29 */
30 WebInspector.ScopeChainSidebarPane = class extends WebInspector.VBox { 30 Sources.ScopeChainSidebarPane = class extends UI.VBox {
31 constructor() { 31 constructor() {
32 super(); 32 super();
33 this._expandController = new WebInspector.ObjectPropertiesSectionExpandContr oller(); 33 this._expandController = new Components.ObjectPropertiesSectionExpandControl ler();
34 this._linkifier = new WebInspector.Linkifier(); 34 this._linkifier = new Components.Linkifier();
35 this._update(); 35 this._update();
36 } 36 }
37 37
38 /** 38 /**
39 * @override 39 * @override
40 * @param {?Object} object 40 * @param {?Object} object
41 */ 41 */
42 flavorChanged(object) { 42 flavorChanged(object) {
43 this._update(); 43 this._update();
44 } 44 }
45 45
46 _update() { 46 _update() {
47 var callFrame = WebInspector.context.flavor(WebInspector.DebuggerModel.CallF rame); 47 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame);
48 var details = WebInspector.context.flavor(WebInspector.DebuggerPausedDetails ); 48 var details = UI.context.flavor(SDK.DebuggerPausedDetails);
49 this._linkifier.reset(); 49 this._linkifier.reset();
50 WebInspector.SourceMapNamesResolver.resolveThisObject(callFrame).then( 50 Sources.SourceMapNamesResolver.resolveThisObject(callFrame).then(
51 this._innerUpdate.bind(this, details, callFrame)); 51 this._innerUpdate.bind(this, details, callFrame));
52 } 52 }
53 53
54 /** 54 /**
55 * @param {?WebInspector.DebuggerPausedDetails} details 55 * @param {?SDK.DebuggerPausedDetails} details
56 * @param {?WebInspector.DebuggerModel.CallFrame} callFrame 56 * @param {?SDK.DebuggerModel.CallFrame} callFrame
57 * @param {?WebInspector.RemoteObject} thisObject 57 * @param {?SDK.RemoteObject} thisObject
58 */ 58 */
59 _innerUpdate(details, callFrame, thisObject) { 59 _innerUpdate(details, callFrame, thisObject) {
60 this.element.removeChildren(); 60 this.element.removeChildren();
61 61
62 if (!details || !callFrame) { 62 if (!details || !callFrame) {
63 var infoElement = createElement('div'); 63 var infoElement = createElement('div');
64 infoElement.className = 'gray-info-message'; 64 infoElement.className = 'gray-info-message';
65 infoElement.textContent = WebInspector.UIString('Not Paused'); 65 infoElement.textContent = Common.UIString('Not Paused');
66 this.element.appendChild(infoElement); 66 this.element.appendChild(infoElement);
67 return; 67 return;
68 } 68 }
69 69
70 var foundLocalScope = false; 70 var foundLocalScope = false;
71 var scopeChain = callFrame.scopeChain(); 71 var scopeChain = callFrame.scopeChain();
72 for (var i = 0; i < scopeChain.length; ++i) { 72 for (var i = 0; i < scopeChain.length; ++i) {
73 var scope = scopeChain[i]; 73 var scope = scopeChain[i];
74 var title = null; 74 var title = null;
75 var emptyPlaceholder = null; 75 var emptyPlaceholder = null;
76 var extraProperties = []; 76 var extraProperties = [];
77 77
78 switch (scope.type()) { 78 switch (scope.type()) {
79 case Protocol.Debugger.ScopeType.Local: 79 case Protocol.Debugger.ScopeType.Local:
80 foundLocalScope = true; 80 foundLocalScope = true;
81 title = WebInspector.UIString('Local'); 81 title = Common.UIString('Local');
82 emptyPlaceholder = WebInspector.UIString('No Variables'); 82 emptyPlaceholder = Common.UIString('No Variables');
83 if (thisObject) 83 if (thisObject)
84 extraProperties.push(new WebInspector.RemoteObjectProperty('this', t hisObject)); 84 extraProperties.push(new SDK.RemoteObjectProperty('this', thisObject ));
85 if (i === 0) { 85 if (i === 0) {
86 var exception = details.exception(); 86 var exception = details.exception();
87 if (exception) 87 if (exception)
88 extraProperties.push(new WebInspector.RemoteObjectProperty( 88 extraProperties.push(new SDK.RemoteObjectProperty(
89 WebInspector.UIString.capitalize('Exception'), exception, unde fined, undefined, undefined, undefined, 89 Common.UIString.capitalize('Exception'), exception, undefined, undefined, undefined, undefined,
90 undefined, true)); 90 undefined, true));
91 var returnValue = callFrame.returnValue(); 91 var returnValue = callFrame.returnValue();
92 if (returnValue) 92 if (returnValue)
93 extraProperties.push(new WebInspector.RemoteObjectProperty( 93 extraProperties.push(new SDK.RemoteObjectProperty(
94 WebInspector.UIString.capitalize('Return ^value'), returnValue , undefined, undefined, undefined, 94 Common.UIString.capitalize('Return ^value'), returnValue, unde fined, undefined, undefined,
95 undefined, undefined, true)); 95 undefined, undefined, true));
96 } 96 }
97 break; 97 break;
98 case Protocol.Debugger.ScopeType.Closure: 98 case Protocol.Debugger.ScopeType.Closure:
99 var scopeName = scope.name(); 99 var scopeName = scope.name();
100 if (scopeName) 100 if (scopeName)
101 title = WebInspector.UIString('Closure (%s)', WebInspector.beautifyF unctionName(scopeName)); 101 title = Common.UIString('Closure (%s)', UI.beautifyFunctionName(scop eName));
102 else 102 else
103 title = WebInspector.UIString('Closure'); 103 title = Common.UIString('Closure');
104 emptyPlaceholder = WebInspector.UIString('No Variables'); 104 emptyPlaceholder = Common.UIString('No Variables');
105 break; 105 break;
106 case Protocol.Debugger.ScopeType.Catch: 106 case Protocol.Debugger.ScopeType.Catch:
107 title = WebInspector.UIString('Catch'); 107 title = Common.UIString('Catch');
108 break; 108 break;
109 case Protocol.Debugger.ScopeType.Block: 109 case Protocol.Debugger.ScopeType.Block:
110 title = WebInspector.UIString('Block'); 110 title = Common.UIString('Block');
111 break; 111 break;
112 case Protocol.Debugger.ScopeType.Script: 112 case Protocol.Debugger.ScopeType.Script:
113 title = WebInspector.UIString('Script'); 113 title = Common.UIString('Script');
114 break; 114 break;
115 case Protocol.Debugger.ScopeType.With: 115 case Protocol.Debugger.ScopeType.With:
116 title = WebInspector.UIString('With Block'); 116 title = Common.UIString('With Block');
117 break; 117 break;
118 case Protocol.Debugger.ScopeType.Global: 118 case Protocol.Debugger.ScopeType.Global:
119 title = WebInspector.UIString('Global'); 119 title = Common.UIString('Global');
120 break; 120 break;
121 } 121 }
122 122
123 var subtitle = scope.description(); 123 var subtitle = scope.description();
124 if (!title || title === subtitle) 124 if (!title || title === subtitle)
125 subtitle = undefined; 125 subtitle = undefined;
126 126
127 var titleElement = createElementWithClass('div', 'scope-chain-sidebar-pane -section-header'); 127 var titleElement = createElementWithClass('div', 'scope-chain-sidebar-pane -section-header');
128 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-subtitle ').textContent = subtitle; 128 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-subtitle ').textContent = subtitle;
129 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-title'). textContent = title; 129 titleElement.createChild('div', 'scope-chain-sidebar-pane-section-title'). textContent = title;
130 130
131 var section = new WebInspector.ObjectPropertiesSection( 131 var section = new Components.ObjectPropertiesSection(
132 WebInspector.SourceMapNamesResolver.resolveScopeInObject(scope), title Element, this._linkifier, 132 Sources.SourceMapNamesResolver.resolveScopeInObject(scope), titleEleme nt, this._linkifier,
133 emptyPlaceholder, true, extraProperties); 133 emptyPlaceholder, true, extraProperties);
134 this._expandController.watchSection(title + (subtitle ? ':' + subtitle : ' '), section); 134 this._expandController.watchSection(title + (subtitle ? ':' + subtitle : ' '), section);
135 135
136 if (scope.type() === Protocol.Debugger.ScopeType.Global) 136 if (scope.type() === Protocol.Debugger.ScopeType.Global)
137 section.objectTreeElement().collapse(); 137 section.objectTreeElement().collapse();
138 else if (!foundLocalScope || scope.type() === Protocol.Debugger.ScopeType. Local) 138 else if (!foundLocalScope || scope.type() === Protocol.Debugger.ScopeType. Local)
139 section.objectTreeElement().expand(); 139 section.objectTreeElement().expand();
140 140
141 section.element.classList.add('scope-chain-sidebar-pane-section'); 141 section.element.classList.add('scope-chain-sidebar-pane-section');
142 this.element.appendChild(section.element); 142 this.element.appendChild(section.element);
143 } 143 }
144 this._sidebarPaneUpdatedForTest(); 144 this._sidebarPaneUpdatedForTest();
145 } 145 }
146 146
147 _sidebarPaneUpdatedForTest() { 147 _sidebarPaneUpdatedForTest() {
148 } 148 }
149 }; 149 };
150 150
151 WebInspector.ScopeChainSidebarPane._pathSymbol = Symbol('path'); 151 Sources.ScopeChainSidebarPane._pathSymbol = Symbol('path');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698