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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleContextSelector.js

Issue 2911363002: DevTools: Split SoftDropdown out of ConsoleContextSelector (Closed)
Patch Set: remove depth in test Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium 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 * @implements {SDK.SDKModelObserver<!SDK.RuntimeModel>} 5 * @implements {SDK.SDKModelObserver<!SDK.RuntimeModel>}
6 * @implements {UI.ListDelegate<!SDK.ExecutionContext>} 6 * @implements {UI.SoftDropDown.Delegate<!SDK.ExecutionContext>}
7 */ 7 */
8 Console.ConsoleContextSelector = class { 8 Console.ConsoleContextSelector = class {
9 constructor() { 9 constructor() {
10 this._toolbarItem = new UI.ToolbarItem(createElementWithClass('button', 'con sole-context')); 10 /** @type {!UI.ListModel<!SDK.ExecutionContext>} */
11 var shadowRoot = 11 this._items = new UI.ListModel();
12 UI.createShadowRootWithCoreStyles(this._toolbarItem.element, 'console/co nsoleContextSelectorButton.css'); 12 /** @type {!UI.SoftDropDown<!SDK.ExecutionContext>} */
13 this._titleElement = shadowRoot.createChild('span', 'title'); 13 this._dropDown = new UI.SoftDropDown(this._items, this);
14 this._dropDown.setRowHeight(36);
15 this._toolbarItem = new UI.ToolbarItem(this._dropDown.element);
14 16
15 /** @type {!Map<!SDK.ExecutionContext, !ProductRegistry.BadgePool>} */ 17 /** @type {!Map<!SDK.ExecutionContext, !ProductRegistry.BadgePool>} */
16 this._badgePoolForExecutionContext = new Map(); 18 this._badgePoolForExecutionContext = new Map();
17 19
18 this._toolbarItem.element.classList.add('toolbar-has-dropdown'); 20 this._toolbarItem.element.classList.add('toolbar-has-dropdown');
19 this._toolbarItem.element.tabIndex = 0;
20 this._glassPane = new UI.GlassPane();
21 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.NoMargin);
22 this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom);
23 this._glassPane.setOutsideClickCallback(this._hide.bind(this));
24 this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior. BlockedByGlassPane);
25 /** @type {!UI.ListModel<!SDK.ExecutionContext>} */
26 this._items = new UI.ListModel();
27 /** @type {!UI.ListControl<!SDK.ExecutionContext>} */
28 this._list = new UI.ListControl(this._items, this, UI.ListMode.EqualHeightIt ems);
29 this._list.element.classList.add('context-list');
30 this._rowHeight = 36;
31 UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'console/c onsoleContextSelector.css')
32 .appendChild(this._list.element);
33
34 this._listWasShowing200msAgo = false;
35 this._toolbarItem.element.addEventListener('mousedown', event => {
36 if (this._listWasShowing200msAgo)
37 this._hide(event);
38 else
39 this._show(event);
40 }, false);
41 this._toolbarItem.element.addEventListener('keydown', this._onKeyDown.bind(t his), false);
42 this._toolbarItem.element.addEventListener('focusout', this._hide.bind(this) , false);
43 this._list.element.addEventListener('mousedown', event => {
44 event.consume(true);
45 }, false);
46 this._list.element.addEventListener('mouseup', event => {
47 if (event.target === this._list.element)
48 return;
49
50 if (!this._listWasShowing200msAgo)
51 return;
52 this._updateSelectedContext();
53 this._hide(event);
54 }, false);
55
56 var dropdownArrowIcon = UI.Icon.create('smallicon-triangle-down');
57 shadowRoot.appendChild(dropdownArrowIcon);
58 21
59 SDK.targetManager.addModelListener( 22 SDK.targetManager.addModelListener(
60 SDK.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextCreated, this. _onExecutionContextCreated, this); 23 SDK.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextCreated, this. _onExecutionContextCreated, this);
61 SDK.targetManager.addModelListener( 24 SDK.targetManager.addModelListener(
62 SDK.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextChanged, this. _onExecutionContextChanged, this); 25 SDK.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextChanged, this. _onExecutionContextChanged, this);
63 SDK.targetManager.addModelListener( 26 SDK.targetManager.addModelListener(
64 SDK.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextDestroyed, thi s._onExecutionContextDestroyed, this); 27 SDK.RuntimeModel, SDK.RuntimeModel.Events.ExecutionContextDestroyed, thi s._onExecutionContextDestroyed, this);
65 SDK.targetManager.addModelListener( 28 SDK.targetManager.addModelListener(
66 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this ._frameNavigated, this); 29 SDK.ResourceTreeModel, SDK.ResourceTreeModel.Events.FrameNavigated, this ._frameNavigated, this);
67 30
68 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChangedExternally, this); 31 UI.context.addFlavorChangeListener(SDK.ExecutionContext, this._executionCont extChangedExternally, this);
69 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this._callFr ameSelectedInUI, this); 32 UI.context.addFlavorChangeListener(SDK.DebuggerModel.CallFrame, this._callFr ameSelectedInUI, this);
70 SDK.targetManager.observeModels(SDK.RuntimeModel, this); 33 SDK.targetManager.observeModels(SDK.RuntimeModel, this);
71 SDK.targetManager.addModelListener( 34 SDK.targetManager.addModelListener(
72 SDK.DebuggerModel, SDK.DebuggerModel.Events.CallFrameSelected, this._cal lFrameSelectedInModel, this); 35 SDK.DebuggerModel, SDK.DebuggerModel.Events.CallFrameSelected, this._cal lFrameSelectedInModel, this);
73 } 36 }
74 37
75 /** 38 /**
76 * @return {!UI.ToolbarItem} 39 * @return {!UI.ToolbarItem}
77 */ 40 */
78 toolbarItem() { 41 toolbarItem() {
79 return this._toolbarItem; 42 return this._toolbarItem;
80 } 43 }
81 44
82 /** 45 /**
83 * @param {!Event} event 46 * @override
47 * @param {?SDK.ExecutionContext} item
84 */ 48 */
85 _show(event) { 49 itemHighlighted(item) {
86 if (this._glassPane.isShowing())
87 return;
88 this._glassPane.setContentAnchorBox(this._toolbarItem.element.boxInWindow()) ;
89 this._glassPane.show(/** @type {!Document} **/ (this._toolbarItem.element.ow nerDocument));
90 this._updateGlasspaneSize();
91 var selectedContext = UI.context.flavor(SDK.ExecutionContext);
92 if (selectedContext) {
93 this._list.selectItem(selectedContext);
94 this._list.scrollItemIntoView(selectedContext, true);
95 }
96 this._toolbarItem.element.focus();
97 event.consume(true);
98 setTimeout(() => this._listWasShowing200msAgo = true, 200);
99 }
100
101 _updateGlasspaneSize() {
102 var maxHeight = this._rowHeight * (Math.min(this._items.length(), 9));
103 this._glassPane.setMaxContentSize(new UI.Size(315, maxHeight));
104 this._list.viewportResized();
105 }
106
107 /**
108 * @param {!Event} event
109 */
110 _hide(event) {
111 setTimeout(() => this._listWasShowing200msAgo = false, 200);
112 this._glassPane.hide();
113 SDK.OverlayModel.hideDOMNodeHighlight(); 50 SDK.OverlayModel.hideDOMNodeHighlight();
114 event.consume(true); 51 if (item && item.frameId) {
115 } 52 var overlayModel = item.target().model(SDK.OverlayModel);
116 53 if (overlayModel)
117 /** 54 overlayModel.highlightFrame(item.frameId);
118 * @param {!Event} event
119 */
120 _onKeyDown(event) {
121 var handled = false;
122 switch (event.key) {
123 case 'ArrowUp':
124 handled = this._list.selectPreviousItem(false, false);
125 break;
126 case 'ArrowDown':
127 handled = this._list.selectNextItem(false, false);
128 break;
129 case 'ArrowRight':
130 var currentExecutionContext = this._list.selectedItem();
131 if (!currentExecutionContext)
132 break;
133 var nextExecutionContext = this._items.itemAtIndex(this._list.selectedIn dex() + 1);
134 if (nextExecutionContext && this._depthFor(currentExecutionContext) < th is._depthFor(nextExecutionContext))
135 handled = this._list.selectNextItem(false, false);
136 break;
137 case 'ArrowLeft':
138 var currentExecutionContext = this._list.selectedItem();
139 if (!currentExecutionContext)
140 break;
141 var depth = this._depthFor(currentExecutionContext);
142 for (var i = this._list.selectedIndex() - 1; i >= 0; i--) {
143 if (this._depthFor(this._items.itemAtIndex(i)) < depth) {
144 handled = true;
145 this._list.selectItem(this._items.itemAtIndex(i), false);
146 break;
147 }
148 }
149 break;
150 case 'PageUp':
151 handled = this._list.selectItemPreviousPage(false);
152 break;
153 case 'PageDown':
154 handled = this._list.selectItemNextPage(false);
155 break;
156 case 'Home':
157 for (var i = 0; i < this._items.length(); i++) {
158 if (this.isItemSelectable(this._items.itemAtIndex(i))) {
159 this._list.selectItem(this._items.itemAtIndex(i));
160 handled = true;
161 break;
162 }
163 }
164 break;
165 case 'End':
166 for (var i = this._items.length() - 1; i >= 0; i--) {
167 if (this.isItemSelectable(this._items.itemAtIndex(i))) {
168 this._list.selectItem(this._items.itemAtIndex(i));
169 handled = true;
170 break;
171 }
172 }
173 break;
174 case 'Escape':
175 this._hide(event);
176 break;
177 case 'Tab':
178 if (!this._glassPane.isShowing())
179 break;
180 this._updateSelectedContext();
181 this._hide(event);
182 break;
183 case 'Enter':
184 if (!this._glassPane.isShowing()) {
185 this._show(event);
186 break;
187 }
188 this._updateSelectedContext();
189 this._hide(event);
190 break;
191 case ' ':
192 this._show(event);
193 break;
194 default:
195 if (event.key.length === 1) {
196 var selectedIndex = this._list.selectedIndex();
197 var letter = event.key.toUpperCase();
198 for (var i = 0; i < this._items.length(); i++) {
199 var context = this._items.itemAtIndex((selectedIndex + i + 1) % this ._items.length());
200 if (this._titleFor(context).toUpperCase().startsWith(letter)) {
201 this._list.selectItem(context);
202 break;
203 }
204 }
205 handled = true;
206 }
207 break;
208 }
209
210 if (handled) {
211 event.consume(true);
212 this._updateSelectedContext();
213 } 55 }
214 } 56 }
215 57
216 /** 58 /**
59 * @override
217 * @param {!SDK.ExecutionContext} executionContext 60 * @param {!SDK.ExecutionContext} executionContext
218 * @return {string} 61 * @return {string}
219 */ 62 */
220 _titleFor(executionContext) { 63 titleFor(executionContext) {
221 var target = executionContext.target(); 64 var target = executionContext.target();
222 var label = executionContext.label() ? target.decorateLabel(executionContext .label()) : ''; 65 var label = executionContext.label() ? target.decorateLabel(executionContext .label()) : '';
223 if (executionContext.frameId) { 66 if (executionContext.frameId) {
224 var resourceTreeModel = target.model(SDK.ResourceTreeModel); 67 var resourceTreeModel = target.model(SDK.ResourceTreeModel);
225 var frame = resourceTreeModel && resourceTreeModel.frameForId(executionCon text.frameId); 68 var frame = resourceTreeModel && resourceTreeModel.frameForId(executionCon text.frameId);
226 if (frame) 69 if (frame)
227 label = label || frame.displayName(); 70 label = label || frame.displayName();
228 } 71 }
229 label = label || executionContext.origin; 72 label = label || executionContext.origin;
230 73
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 */ 138 */
296 _executionContextCreated(executionContext) { 139 _executionContextCreated(executionContext) {
297 // FIXME(413886): We never want to show execution context for the main threa d of shadow page in service/shared worker frontend. 140 // FIXME(413886): We never want to show execution context for the main threa d of shadow page in service/shared worker frontend.
298 // This check could be removed once we do not send this context to frontend. 141 // This check could be removed once we do not send this context to frontend.
299 if (!executionContext.target().hasJSCapability()) 142 if (!executionContext.target().hasJSCapability())
300 return; 143 return;
301 144
302 this._items.insertItemWithComparator(executionContext, executionContext.runt imeModel.executionContextComparator()); 145 this._items.insertItemWithComparator(executionContext, executionContext.runt imeModel.executionContextComparator());
303 146
304 if (executionContext === UI.context.flavor(SDK.ExecutionContext)) 147 if (executionContext === UI.context.flavor(SDK.ExecutionContext))
305 this._updateSelectionTitle(); 148 this._dropDown.selectItem(executionContext);
306 } 149 }
307 150
308 /** 151 /**
309 * @param {!Common.Event} event 152 * @param {!Common.Event} event
310 */ 153 */
311 _onExecutionContextCreated(event) { 154 _onExecutionContextCreated(event) {
312 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); 155 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data);
313 this._executionContextCreated(executionContext); 156 this._executionContextCreated(executionContext);
314 this._updateSelectionTitle();
315 this._updateGlasspaneSize();
316 } 157 }
317 158
318 /** 159 /**
319 * @param {!Common.Event} event 160 * @param {!Common.Event} event
320 */ 161 */
321 _onExecutionContextChanged(event) { 162 _onExecutionContextChanged(event) {
322 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); 163 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data);
323 if (this._items.indexOfItem(executionContext) === -1) 164 if (this._items.indexOfItem(executionContext) === -1)
324 return; 165 return;
325 this._executionContextDestroyed(executionContext); 166 this._executionContextDestroyed(executionContext);
326 this._executionContextCreated(executionContext); 167 this._executionContextCreated(executionContext);
327 this._updateSelectionTitle();
328 } 168 }
329 169
330 /** 170 /**
331 * @param {!SDK.ExecutionContext} executionContext 171 * @param {!SDK.ExecutionContext} executionContext
332 */ 172 */
333 _executionContextDestroyed(executionContext) { 173 _executionContextDestroyed(executionContext) {
334 if (this._items.indexOfItem(executionContext) === -1) 174 if (this._items.indexOfItem(executionContext) === -1)
335 return; 175 return;
336 this._disposeExecutionContextBadge(executionContext); 176 this._disposeExecutionContextBadge(executionContext);
337 this._items.removeItem(executionContext); 177 this._items.removeItem(executionContext);
338 this._updateGlasspaneSize();
339 } 178 }
340 179
341 /** 180 /**
342 * @param {!Common.Event} event 181 * @param {!Common.Event} event
343 */ 182 */
344 _onExecutionContextDestroyed(event) { 183 _onExecutionContextDestroyed(event) {
345 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); 184 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data);
346 this._executionContextDestroyed(executionContext); 185 this._executionContextDestroyed(executionContext);
347 this._updateSelectionTitle();
348 } 186 }
349 187
350 /** 188 /**
351 * @param {!Common.Event} event 189 * @param {!Common.Event} event
352 */ 190 */
353 _executionContextChangedExternally(event) { 191 _executionContextChangedExternally(event) {
354 var executionContext = /** @type {?SDK.ExecutionContext} */ (event.data); 192 var executionContext = /** @type {?SDK.ExecutionContext} */ (event.data);
355 if (!executionContext || this._items.indexOfItem(executionContext) === -1) 193 this._dropDown.selectItem(executionContext);
356 return;
357 this._list.selectItem(executionContext);
358 this._updateSelectedContext();
359 }
360
361 _updateSelectionTitle() {
362 var executionContext = UI.context.flavor(SDK.ExecutionContext);
363 if (executionContext)
364 this._titleElement.textContent = this._titleFor(executionContext);
365 else
366 this._titleElement.textContent = '';
367 this._toolbarItem.element.classList.toggle(
368 'warning', !this._isTopContext(executionContext) && this._hasTopContext( ));
369 } 194 }
370 195
371 /** 196 /**
372 * @param {?SDK.ExecutionContext} executionContext 197 * @param {?SDK.ExecutionContext} executionContext
373 * @return {boolean} 198 * @return {boolean}
374 */ 199 */
375 _isTopContext(executionContext) { 200 _isTopContext(executionContext) {
376 if (!executionContext || !executionContext.isDefault) 201 if (!executionContext || !executionContext.isDefault)
377 return false; 202 return false;
378 var resourceTreeModel = executionContext.target().model(SDK.ResourceTreeMode l); 203 var resourceTreeModel = executionContext.target().model(SDK.ResourceTreeMode l);
(...skipping 28 matching lines...) Expand all
407 */ 232 */
408 modelRemoved(runtimeModel) { 233 modelRemoved(runtimeModel) {
409 for (var i = 0; i < this._items.length(); i++) { 234 for (var i = 0; i < this._items.length(); i++) {
410 if (this._items.itemAtIndex(i).runtimeModel === runtimeModel) 235 if (this._items.itemAtIndex(i).runtimeModel === runtimeModel)
411 this._executionContextDestroyed(this._items.itemAtIndex(i)); 236 this._executionContextDestroyed(this._items.itemAtIndex(i));
412 } 237 }
413 } 238 }
414 239
415 /** 240 /**
416 * @override 241 * @override
242 * @param {!Element} element
417 * @param {!SDK.ExecutionContext} item 243 * @param {!SDK.ExecutionContext} item
418 * @return {!Element}
419 */ 244 */
420 createElementForItem(item) { 245 renderElementForItem(element, item) {
421 var element = createElementWithClass('div', 'context'); 246 var shadowRoot = UI.createShadowRootWithCoreStyles(element, 'console/console ContextSelector.css');
422 element.style.paddingLeft = (8 + this._depthFor(item) * 15) + 'px'; 247 var title = shadowRoot.createChild('div', 'title');
423 // var titleArea = element.createChild('div', 'title-area'); 248 title.createTextChild(this.titleFor(item).trimEnd(100));
424 var title = element.createChild('div', 'title'); 249 var subTitle = shadowRoot.createChild('div', 'subtitle');
425 title.createTextChild(this._titleFor(item).trimEnd(100));
426 var subTitle = element.createChild('div', 'subtitle');
427 var badgeElement = this._badgeFor(item); 250 var badgeElement = this._badgeFor(item);
428 if (badgeElement) { 251 if (badgeElement) {
429 badgeElement.classList.add('badge'); 252 badgeElement.classList.add('badge');
430 subTitle.appendChild(badgeElement); 253 subTitle.appendChild(badgeElement);
431 } 254 }
432 subTitle.createTextChild(this._subtitleFor(item)); 255 subTitle.createTextChild(this._subtitleFor(item));
433 element.addEventListener('mousemove', e => { 256 element.style.paddingLeft = (8 + this._depthFor(item) * 15) + 'px';
434 if ((e.movementX || e.movementY) && this.isItemSelectable(item))
435 this._list.selectItem(item, false, /* Don't scroll */ true);
436 });
437 element.classList.toggle('disabled', !this.isItemSelectable(item));
438 return element;
439 } 257 }
440 258
441 /** 259 /**
442 * @param {!SDK.ExecutionContext} executionContext 260 * @param {!SDK.ExecutionContext} executionContext
443 * @return {string} 261 * @return {string}
444 */ 262 */
445 _subtitleFor(executionContext) { 263 _subtitleFor(executionContext) {
446 var target = executionContext.target(); 264 var target = executionContext.target();
447 if (executionContext.frameId) { 265 if (executionContext.frameId) {
448 var resourceTreeModel = target.model(SDK.ResourceTreeModel); 266 var resourceTreeModel = target.model(SDK.ResourceTreeModel);
(...skipping 12 matching lines...) Expand all
461 if (callFrame) 279 if (callFrame)
462 return new Common.ParsedURL(callFrame.url).domain(); 280 return new Common.ParsedURL(callFrame.url).domain();
463 return Common.UIString('IFrame'); 281 return Common.UIString('IFrame');
464 } 282 }
465 return ''; 283 return '';
466 } 284 }
467 285
468 /** 286 /**
469 * @override 287 * @override
470 * @param {!SDK.ExecutionContext} item 288 * @param {!SDK.ExecutionContext} item
471 * @return {number}
472 */
473 heightForItem(item) {
474 return this._rowHeight;
475 }
476
477 /**
478 * @override
479 * @param {!SDK.ExecutionContext} item
480 * @return {boolean} 289 * @return {boolean}
481 */ 290 */
482 isItemSelectable(item) { 291 isItemSelectable(item) {
483 var callFrame = item.debuggerModel.selectedCallFrame(); 292 var callFrame = item.debuggerModel.selectedCallFrame();
484 var callFrameContext = callFrame && callFrame.script.executionContext(); 293 var callFrameContext = callFrame && callFrame.script.executionContext();
485 return !callFrameContext || item === callFrameContext; 294 return !callFrameContext || item === callFrameContext;
486 } 295 }
487 296
488 /** 297 /**
489 * @override 298 * @override
490 * @param {?SDK.ExecutionContext} from 299 * @param {?SDK.ExecutionContext} item
491 * @param {?SDK.ExecutionContext} to
492 * @param {?Element} fromElement
493 * @param {?Element} toElement
494 */ 300 */
495 selectedItemChanged(from, to, fromElement, toElement) { 301 itemSelected(item) {
496 if (fromElement) 302 this._toolbarItem.element.classList.toggle('warning', !this._isTopContext(it em) && this._hasTopContext());
497 fromElement.classList.remove('selected'); 303 UI.context.setFlavor(SDK.ExecutionContext, item);
498 if (toElement)
499 toElement.classList.add('selected');
500 SDK.OverlayModel.hideDOMNodeHighlight();
501 if (to && to.frameId) {
502 var resourceTreeModel = to.target().model(SDK.ResourceTreeModel);
503 if (resourceTreeModel)
504 resourceTreeModel.domModel().overlayModel().highlightFrame(to.frameId);
505 }
506 }
507
508 _updateSelectedContext() {
509 var context = this._list.selectedItem();
510 UI.context.setFlavor(SDK.ExecutionContext, context);
511 this._updateSelectionTitle();
512 } 304 }
513 305
514 _callFrameSelectedInUI() { 306 _callFrameSelectedInUI() {
515 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); 307 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame);
516 var callFrameContext = callFrame && callFrame.script.executionContext(); 308 var callFrameContext = callFrame && callFrame.script.executionContext();
517 if (callFrameContext) 309 if (callFrameContext)
518 UI.context.setFlavor(SDK.ExecutionContext, callFrameContext); 310 UI.context.setFlavor(SDK.ExecutionContext, callFrameContext);
519 } 311 }
520 312
521 /** 313 /**
522 * @param {!Common.Event} event 314 * @param {!Common.Event} event
523 */ 315 */
524 _callFrameSelectedInModel(event) { 316 _callFrameSelectedInModel(event) {
525 var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.data); 317 var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.data);
526 for (var i = 0; i < this._items.length(); i++) { 318 for (var i = 0; i < this._items.length(); i++) {
527 var executionContext = this._items.itemAtIndex(i); 319 var executionContext = this._items.itemAtIndex(i);
528 if (executionContext.debuggerModel === debuggerModel) { 320 if (executionContext.debuggerModel === debuggerModel) {
529 this._disposeExecutionContextBadge(executionContext); 321 this._disposeExecutionContextBadge(executionContext);
530 this._list.refreshItem(executionContext); 322 this._dropDown.refreshItem(executionContext);
531 } 323 }
532 } 324 }
533 } 325 }
534 326
535 /** 327 /**
536 * @param {!Common.Event} event 328 * @param {!Common.Event} event
537 */ 329 */
538 _frameNavigated(event) { 330 _frameNavigated(event) {
539 var frameId = event.data.id; 331 var frame = /** @type {!SDK.ResourceTreeFrame} */ (event.data);
540 for (var i = 0; i < this._items.length(); i++) { 332 var runtimeModel = frame.resourceTreeModel().target().model(SDK.RuntimeModel );
541 var executionContext = this._items.itemAtIndex(i); 333 if (!runtimeModel)
542 if (frameId === executionContext.frameId) { 334 return;
335 for (var executionContext of runtimeModel.executionContexts()) {
336 if (frame.id === executionContext.frameId) {
543 this._disposeExecutionContextBadge(executionContext); 337 this._disposeExecutionContextBadge(executionContext);
544 this._list.refreshItem(executionContext); 338 this._dropDown.refreshItem(executionContext);
545 } 339 }
546 } 340 }
547 } 341 }
548 }; 342 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698