Chromium Code Reviews| OLD | NEW |
|---|---|
| 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.ListDelegate<!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 this._toolbarItem = new UI.ToolbarItem(createElementWithClass('button', 'con sole-context')); |
| 11 var shadowRoot = | 11 var shadowRoot = |
| 12 UI.createShadowRootWithCoreStyles(this._toolbarItem.element, 'console/co nsoleContextSelectorButton.css'); | 12 UI.createShadowRootWithCoreStyles(this._toolbarItem.element, 'console/co nsoleContextSelectorButton.css'); |
| 13 this._titleElement = shadowRoot.createChild('span', 'title'); | 13 this._titleElement = shadowRoot.createChild('span', 'title'); |
| 14 this._productRegistry = null; | |
| 15 | 14 |
| 16 ProductRegistry.instance().then(registry => { | 15 /** @type {!Map<!SDK.ExecutionContext, function()>} */ |
| 17 this._productRegistry = registry; | 16 this._disposeExecutionContextFunctions = new Map(); |
| 18 this._list.refreshAllItems(); | 17 |
| 19 }); | |
| 20 this._toolbarItem.element.classList.add('toolbar-has-dropdown'); | 18 this._toolbarItem.element.classList.add('toolbar-has-dropdown'); |
| 21 this._toolbarItem.element.tabIndex = 0; | 19 this._toolbarItem.element.tabIndex = 0; |
| 22 this._glassPane = new UI.GlassPane(); | 20 this._glassPane = new UI.GlassPane(); |
| 23 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.NoMargin); | 21 this._glassPane.setMarginBehavior(UI.GlassPane.MarginBehavior.NoMargin); |
| 24 this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom); | 22 this._glassPane.setAnchorBehavior(UI.GlassPane.AnchorBehavior.PreferBottom); |
| 25 this._glassPane.setOutsideClickCallback(this._hide.bind(this)); | 23 this._glassPane.setOutsideClickCallback(this._hide.bind(this)); |
| 26 this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior. BlockedByGlassPane); | 24 this._glassPane.setPointerEventsBehavior(UI.GlassPane.PointerEventsBehavior. BlockedByGlassPane); |
| 27 this._list = new UI.ListControl(this, UI.ListMode.EqualHeightItems); | 25 this._list = new UI.ListControl(this, UI.ListMode.EqualHeightItems); |
| 28 this._list.element.classList.add('context-list'); | 26 this._list.element.classList.add('context-list'); |
| 29 this._list.element.tabIndex = -1; | 27 this._list.element.tabIndex = -1; |
| 30 this._rowHeight = 34; | 28 this._rowHeight = 36; |
| 31 UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'console/c onsoleContextSelector.css') | 29 UI.createShadowRootWithCoreStyles(this._glassPane.contentElement, 'console/c onsoleContextSelector.css') |
| 32 .appendChild(this._list.element); | 30 .appendChild(this._list.element); |
| 33 | 31 |
| 34 this._listWasShowing200msAgo = false; | 32 this._listWasShowing200msAgo = false; |
| 35 this._toolbarItem.element.addEventListener('mousedown', event => { | 33 this._toolbarItem.element.addEventListener('mousedown', event => { |
| 36 if (this._listWasShowing200msAgo) | 34 if (this._listWasShowing200msAgo) |
| 37 this._hide(event); | 35 this._hide(event); |
| 38 else | 36 else |
| 39 this._show(event); | 37 this._show(event); |
| 40 }, false); | 38 }, false); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 | 79 |
| 82 /** | 80 /** |
| 83 * @param {!Event} event | 81 * @param {!Event} event |
| 84 */ | 82 */ |
| 85 _show(event) { | 83 _show(event) { |
| 86 if (this._glassPane.isShowing()) | 84 if (this._glassPane.isShowing()) |
| 87 return; | 85 return; |
| 88 this._glassPane.setContentAnchorBox(this._toolbarItem.element.boxInWindow()) ; | 86 this._glassPane.setContentAnchorBox(this._toolbarItem.element.boxInWindow()) ; |
| 89 this._glassPane.show(/** @type {!Document} **/ (this._toolbarItem.element.ow nerDocument)); | 87 this._glassPane.show(/** @type {!Document} **/ (this._toolbarItem.element.ow nerDocument)); |
| 90 this._updateGlasspaneSize(); | 88 this._updateGlasspaneSize(); |
| 91 var selectedItem = this._list.selectedItem(); | 89 var selectedContext = UI.context.flavor(SDK.ExecutionContext); |
| 92 if (selectedItem) | 90 if (selectedContext) { |
| 93 this._list.scrollItemIntoView(selectedItem, true); | 91 this._list.selectItem(selectedContext); |
| 92 this._list.scrollItemIntoView(selectedContext, true); | |
| 93 } | |
| 94 this._toolbarItem.element.focus(); | 94 this._toolbarItem.element.focus(); |
| 95 event.consume(true); | 95 event.consume(true); |
| 96 setTimeout(() => this._listWasShowing200msAgo = true, 200); | 96 setTimeout(() => this._listWasShowing200msAgo = true, 200); |
| 97 } | 97 } |
| 98 | 98 |
| 99 _updateGlasspaneSize() { | 99 _updateGlasspaneSize() { |
| 100 var maxHeight = this._rowHeight * (Math.min(this._list.length(), 9)); | 100 var maxHeight = this._rowHeight * (Math.min(this._list.length(), 9)); |
| 101 this._glassPane.setMaxContentSize(new UI.Size(315, maxHeight)); | 101 this._glassPane.setMaxContentSize(new UI.Size(315, maxHeight)); |
| 102 this._list.viewportResized(); | 102 this._list.viewportResized(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * @param {!Event} event | 106 * @param {!Event} event |
| 107 */ | 107 */ |
| 108 _hide(event) { | 108 _hide(event) { |
| 109 setTimeout(() => this._listWasShowing200msAgo = false, 200); | 109 setTimeout(() => this._listWasShowing200msAgo = false, 200); |
| 110 this._glassPane.hide(); | 110 this._glassPane.hide(); |
| 111 SDK.OverlayModel.hideDOMNodeHighlight(); | 111 SDK.OverlayModel.hideDOMNodeHighlight(); |
| 112 var selectedContext = UI.context.flavor(SDK.ExecutionContext); | |
| 113 if (selectedContext) | |
| 114 this._list.selectItem(selectedContext); | |
| 115 event.consume(true); | 112 event.consume(true); |
| 116 } | 113 } |
| 117 | 114 |
| 118 /** | 115 /** |
| 119 * @param {!Event} event | 116 * @param {!Event} event |
| 120 */ | 117 */ |
| 121 _onKeyDown(event) { | 118 _onKeyDown(event) { |
| 122 var handled = false; | 119 var handled = false; |
| 123 switch (event.key) { | 120 switch (event.key) { |
| 124 case 'ArrowUp': | 121 case 'ArrowUp': |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 break; | 256 break; |
| 260 } | 257 } |
| 261 target = target.parentTarget(); | 258 target = target.parentTarget(); |
| 262 } | 259 } |
| 263 depth += targetDepth; | 260 depth += targetDepth; |
| 264 return depth; | 261 return depth; |
| 265 } | 262 } |
| 266 | 263 |
| 267 /** | 264 /** |
| 268 * @param {!SDK.ExecutionContext} executionContext | 265 * @param {!SDK.ExecutionContext} executionContext |
| 266 * @return {?Element} | |
| 267 */ | |
| 268 _badgeFor(executionContext) { | |
| 269 if (!executionContext.frameId || !executionContext.isDefault) | |
| 270 return null; | |
| 271 var resourceTreeModel = executionContext.target().model(SDK.ResourceTreeMode l); | |
| 272 var frame = resourceTreeModel && resourceTreeModel.frameForId(executionConte xt.frameId); | |
| 273 if (!frame) | |
| 274 return null; | |
| 275 var badgePool = new ProductRegistry.BadgePool(); | |
| 276 this._disposeExecutionContextFunctions.set(executionContext, () => { | |
|
pfeldman
2017/05/17 21:42:22
I would vote for something more conservative:
thi
einbinder
2017/05/17 23:26:15
Done.
| |
| 277 badgePool.reset(); | |
| 278 this._disposeExecutionContextFunctions.remove(executionContext); | |
| 279 }); | |
| 280 | |
| 281 return badgePool.badgeForFrame(frame, true); | |
| 282 } | |
| 283 | |
| 284 /** | |
| 285 * @param {!SDK.ExecutionContext} executionContext | |
| 269 */ | 286 */ |
| 270 _executionContextCreated(executionContext) { | 287 _executionContextCreated(executionContext) { |
| 271 // FIXME(413886): We never want to show execution context for the main threa d of shadow page in service/shared worker frontend. | 288 // FIXME(413886): We never want to show execution context for the main threa d of shadow page in service/shared worker frontend. |
| 272 // This check could be removed once we do not send this context to frontend. | 289 // This check could be removed once we do not send this context to frontend. |
| 273 if (!executionContext.target().hasJSCapability()) | 290 if (!executionContext.target().hasJSCapability()) |
| 274 return; | 291 return; |
| 275 | 292 |
| 276 this._list.insertItemWithComparator(executionContext, executionContext.runti meModel.executionContextComparator()); | 293 this._list.insertItemWithComparator(executionContext, executionContext.runti meModel.executionContextComparator()); |
| 277 | 294 |
| 278 if (executionContext === UI.context.flavor(SDK.ExecutionContext)) { | 295 if (executionContext === UI.context.flavor(SDK.ExecutionContext)) |
| 279 this._list.selectItem(executionContext); | 296 this._updateSelectionTitle(); |
| 280 this._updateSelectedContext(); | |
| 281 } | |
| 282 } | 297 } |
| 283 | 298 |
| 284 /** | 299 /** |
| 285 * @param {!Common.Event} event | 300 * @param {!Common.Event} event |
| 286 */ | 301 */ |
| 287 _onExecutionContextCreated(event) { | 302 _onExecutionContextCreated(event) { |
| 288 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); | 303 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); |
| 289 this._executionContextCreated(executionContext); | 304 this._executionContextCreated(executionContext); |
| 290 this._updateSelectionWarning(); | 305 this._updateSelectionTitle(); |
| 291 this._updateGlasspaneSize(); | 306 this._updateGlasspaneSize(); |
| 292 } | 307 } |
| 293 | 308 |
| 294 /** | 309 /** |
| 295 * @param {!Common.Event} event | 310 * @param {!Common.Event} event |
| 296 */ | 311 */ |
| 297 _onExecutionContextChanged(event) { | 312 _onExecutionContextChanged(event) { |
| 298 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); | 313 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); |
| 299 if (this._list.indexOfItem(executionContext) === -1) | 314 if (this._list.indexOfItem(executionContext) === -1) |
| 300 return; | 315 return; |
| 301 this._executionContextDestroyed(executionContext); | 316 this._executionContextDestroyed(executionContext); |
| 302 this._executionContextCreated(executionContext); | 317 this._executionContextCreated(executionContext); |
| 303 this._updateSelectionWarning(); | 318 this._updateSelectionTitle(); |
| 304 } | 319 } |
| 305 | 320 |
| 306 /** | 321 /** |
| 307 * @param {!SDK.ExecutionContext} executionContext | 322 * @param {!SDK.ExecutionContext} executionContext |
| 308 */ | 323 */ |
| 309 _executionContextDestroyed(executionContext) { | 324 _executionContextDestroyed(executionContext) { |
| 310 if (this._list.indexOfItem(executionContext) === -1) | 325 if (this._list.indexOfItem(executionContext) === -1) |
| 311 return; | 326 return; |
| 327 var dispose = this._disposeExecutionContextFunctions.get(executionContext); | |
| 328 if (dispose) | |
| 329 dispose(); | |
| 312 this._list.removeItem(executionContext); | 330 this._list.removeItem(executionContext); |
| 313 this._updateGlasspaneSize(); | 331 this._updateGlasspaneSize(); |
| 314 } | 332 } |
| 315 | 333 |
| 316 /** | 334 /** |
| 317 * @param {!Common.Event} event | 335 * @param {!Common.Event} event |
| 318 */ | 336 */ |
| 319 _onExecutionContextDestroyed(event) { | 337 _onExecutionContextDestroyed(event) { |
| 320 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); | 338 var executionContext = /** @type {!SDK.ExecutionContext} */ (event.data); |
| 321 this._executionContextDestroyed(executionContext); | 339 this._executionContextDestroyed(executionContext); |
| 322 this._updateSelectionWarning(); | 340 this._updateSelectionTitle(); |
| 323 } | 341 } |
| 324 | 342 |
| 325 /** | 343 /** |
| 326 * @param {!Common.Event} event | 344 * @param {!Common.Event} event |
| 327 */ | 345 */ |
| 328 _executionContextChangedExternally(event) { | 346 _executionContextChangedExternally(event) { |
| 329 var executionContext = /** @type {?SDK.ExecutionContext} */ (event.data); | 347 var executionContext = /** @type {?SDK.ExecutionContext} */ (event.data); |
| 330 if (!executionContext || this._list.indexOfItem(executionContext) === -1) | 348 if (!executionContext || this._list.indexOfItem(executionContext) === -1) |
| 331 return; | 349 return; |
| 332 this._list.selectItem(executionContext); | 350 this._list.selectItem(executionContext); |
| 333 this._updateSelectedContext(); | 351 this._updateSelectedContext(); |
| 334 } | 352 } |
| 335 | 353 |
| 336 _updateSelectionWarning() { | 354 _updateSelectionTitle() { |
| 337 var executionContext = UI.context.flavor(SDK.ExecutionContext); | 355 var executionContext = UI.context.flavor(SDK.ExecutionContext); |
| 356 if (executionContext) | |
| 357 this._titleElement.textContent = this._titleFor(executionContext); | |
| 358 else | |
| 359 this._titleElement.textContent = ''; | |
| 338 this._toolbarItem.element.classList.toggle( | 360 this._toolbarItem.element.classList.toggle( |
| 339 'warning', !this._isTopContext(executionContext) && this._hasTopContext( )); | 361 'warning', !this._isTopContext(executionContext) && this._hasTopContext( )); |
| 340 } | 362 } |
| 341 | 363 |
| 342 /** | 364 /** |
| 343 * @param {?SDK.ExecutionContext} executionContext | 365 * @param {?SDK.ExecutionContext} executionContext |
| 344 * @return {boolean} | 366 * @return {boolean} |
| 345 */ | 367 */ |
| 346 _isTopContext(executionContext) { | 368 _isTopContext(executionContext) { |
| 347 if (!executionContext || !executionContext.isDefault) | 369 if (!executionContext || !executionContext.isDefault) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 } | 406 } |
| 385 | 407 |
| 386 /** | 408 /** |
| 387 * @override | 409 * @override |
| 388 * @param {!SDK.ExecutionContext} item | 410 * @param {!SDK.ExecutionContext} item |
| 389 * @return {!Element} | 411 * @return {!Element} |
| 390 */ | 412 */ |
| 391 createElementForItem(item) { | 413 createElementForItem(item) { |
| 392 var element = createElementWithClass('div', 'context'); | 414 var element = createElementWithClass('div', 'context'); |
| 393 element.style.paddingLeft = (8 + this._depthFor(item) * 15) + 'px'; | 415 element.style.paddingLeft = (8 + this._depthFor(item) * 15) + 'px'; |
| 394 element.createChild('div', 'title').textContent = this._titleFor(item).trimE nd(100); | 416 // var titleArea = element.createChild('div', 'title-area'); |
| 417 var title = element.createChild('div', 'title'); | |
| 418 var badgeElement = this._badgeFor(item); | |
| 419 if (badgeElement) { | |
| 420 badgeElement.classList.add('badge'); | |
| 421 title.appendChild(badgeElement); | |
| 422 } | |
| 423 title.createTextChild(this._titleFor(item).trimEnd(100)); | |
| 395 element.createChild('div', 'subtitle').textContent = this._subtitleFor(item) ; | 424 element.createChild('div', 'subtitle').textContent = this._subtitleFor(item) ; |
| 396 element.addEventListener('mousemove', e => { | 425 element.addEventListener('mousemove', e => { |
| 397 if ((e.movementX || e.movementY) && this.isItemSelectable(item)) | 426 if ((e.movementX || e.movementY) && this.isItemSelectable(item)) |
| 398 this._list.selectItem(item, false, /* Don't scroll */ true); | 427 this._list.selectItem(item, false, /* Don't scroll */ true); |
| 399 }); | 428 }); |
| 400 element.classList.toggle('disabled', !this.isItemSelectable(item)); | 429 element.classList.toggle('disabled', !this.isItemSelectable(item)); |
| 401 return element; | 430 return element; |
| 402 } | 431 } |
| 403 | 432 |
| 404 /** | 433 /** |
| 405 * @param {!SDK.ExecutionContext} executionContext | 434 * @param {!SDK.ExecutionContext} executionContext |
| 406 * @return {string} | 435 * @return {string} |
| 407 */ | 436 */ |
| 408 _subtitleFor(executionContext) { | 437 _subtitleFor(executionContext) { |
| 409 var target = executionContext.target(); | 438 var target = executionContext.target(); |
| 410 if (executionContext.frameId) { | 439 if (executionContext.frameId) { |
| 411 var resourceTreeModel = target.model(SDK.ResourceTreeModel); | 440 var resourceTreeModel = target.model(SDK.ResourceTreeModel); |
| 412 var frame = resourceTreeModel && resourceTreeModel.frameForId(executionCon text.frameId); | 441 var frame = resourceTreeModel && resourceTreeModel.frameForId(executionCon text.frameId); |
| 413 } | 442 } |
| 414 if (executionContext.origin.startsWith('chrome-extension://')) | 443 if (executionContext.origin.startsWith('chrome-extension://')) |
| 415 return Common.UIString('Extension'); | 444 return Common.UIString('Extension'); |
| 416 if (!frame || !frame.parentFrame || frame.parentFrame.securityOrigin !== exe cutionContext.origin) { | 445 if (!frame || !frame.parentFrame || frame.parentFrame.securityOrigin !== exe cutionContext.origin) { |
| 417 var url = executionContext.origin.asParsedURL(); | 446 var url = executionContext.origin.asParsedURL(); |
| 418 if (url) { | 447 if (url) |
| 419 if (this._productRegistry) { | |
| 420 var product = this._productRegistry.nameForUrl(url); | |
| 421 if (product) | |
| 422 return product; | |
| 423 } | |
| 424 return url.domain(); | 448 return url.domain(); |
| 425 } | |
| 426 } | 449 } |
| 427 | 450 |
| 428 if (frame) { | 451 if (frame) { |
| 429 var callFrame = frame.findCreationCallFrame(callFrame => !!callFrame.url); | 452 var callFrame = frame.findCreationCallFrame(callFrame => !!callFrame.url); |
| 430 if (callFrame) { | 453 if (callFrame) |
| 431 var url = new Common.ParsedURL(callFrame.url); | 454 return new Common.ParsedURL(callFrame.url).domain(); |
| 432 if (this._productRegistry) { | |
| 433 var product = this._productRegistry.nameForUrl(url); | |
| 434 if (product) | |
| 435 return product; | |
| 436 } | |
| 437 return url.domain(); | |
| 438 } | |
| 439 } | 455 } |
| 440 return ''; | 456 return ''; |
| 441 } | 457 } |
| 442 | 458 |
| 443 /** | 459 /** |
| 444 * @override | 460 * @override |
| 445 * @param {!SDK.ExecutionContext} item | 461 * @param {!SDK.ExecutionContext} item |
| 446 * @return {number} | 462 * @return {number} |
| 447 */ | 463 */ |
| 448 heightForItem(item) { | 464 heightForItem(item) { |
| 449 return 0; | 465 return this._rowHeight; |
| 450 } | 466 } |
| 451 | 467 |
| 452 /** | 468 /** |
| 453 * @override | 469 * @override |
| 454 * @param {!SDK.ExecutionContext} item | 470 * @param {!SDK.ExecutionContext} item |
| 455 * @return {boolean} | 471 * @return {boolean} |
| 456 */ | 472 */ |
| 457 isItemSelectable(item) { | 473 isItemSelectable(item) { |
| 458 var callFrame = item.debuggerModel.selectedCallFrame(); | 474 var callFrame = item.debuggerModel.selectedCallFrame(); |
| 459 var callFrameContext = callFrame && callFrame.script.executionContext(); | 475 var callFrameContext = callFrame && callFrame.script.executionContext(); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 475 SDK.OverlayModel.hideDOMNodeHighlight(); | 491 SDK.OverlayModel.hideDOMNodeHighlight(); |
| 476 if (to && to.frameId) { | 492 if (to && to.frameId) { |
| 477 var resourceTreeModel = to.target().model(SDK.ResourceTreeModel); | 493 var resourceTreeModel = to.target().model(SDK.ResourceTreeModel); |
| 478 if (resourceTreeModel) | 494 if (resourceTreeModel) |
| 479 resourceTreeModel.domModel().overlayModel().highlightFrame(to.frameId); | 495 resourceTreeModel.domModel().overlayModel().highlightFrame(to.frameId); |
| 480 } | 496 } |
| 481 } | 497 } |
| 482 | 498 |
| 483 _updateSelectedContext() { | 499 _updateSelectedContext() { |
| 484 var context = this._list.selectedItem(); | 500 var context = this._list.selectedItem(); |
| 485 if (context) | |
| 486 this._titleElement.textContent = this._titleFor(context); | |
| 487 else | |
| 488 this._titleElement.textContent = ''; | |
| 489 UI.context.setFlavor(SDK.ExecutionContext, context); | 501 UI.context.setFlavor(SDK.ExecutionContext, context); |
| 490 this._updateSelectionWarning(); | 502 this._updateSelectionTitle(); |
| 491 } | 503 } |
| 492 | 504 |
| 493 _callFrameSelectedInUI() { | 505 _callFrameSelectedInUI() { |
| 494 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); | 506 var callFrame = UI.context.flavor(SDK.DebuggerModel.CallFrame); |
| 495 var callFrameContext = callFrame && callFrame.script.executionContext(); | 507 var callFrameContext = callFrame && callFrame.script.executionContext(); |
| 496 if (callFrameContext) | 508 if (callFrameContext) |
| 497 UI.context.setFlavor(SDK.ExecutionContext, callFrameContext); | 509 UI.context.setFlavor(SDK.ExecutionContext, callFrameContext); |
| 498 } | 510 } |
| 499 | 511 |
| 500 /** | 512 /** |
| 501 * @param {!Common.Event} event | 513 * @param {!Common.Event} event |
| 502 */ | 514 */ |
| 503 _callFrameSelectedInModel(event) { | 515 _callFrameSelectedInModel(event) { |
| 504 var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.data); | 516 var debuggerModel = /** @type {!SDK.DebuggerModel} */ (event.data); |
| 505 for (var i = 0; i < this._list.length(); i++) { | 517 for (var i = 0; i < this._list.length(); i++) { |
| 506 if (this._list.itemAtIndex(i).debuggerModel === debuggerModel) | 518 if (this._list.itemAtIndex(i).debuggerModel === debuggerModel) { |
| 519 var dispose = this._disposeExecutionContextFunctions.get(this._list.item AtIndex(i)); | |
|
pfeldman
2017/05/17 21:42:22
Why disposing when selected?
einbinder
2017/05/17 23:26:15
It remakes the element in refreshItemsInRange
| |
| 520 if (dispose) | |
| 521 dispose(); | |
| 507 this._list.refreshItemsInRange(i, i + 1); | 522 this._list.refreshItemsInRange(i, i + 1); |
| 523 } | |
| 508 } | 524 } |
| 509 } | 525 } |
| 510 | 526 |
| 511 /** | 527 /** |
| 512 * @param {!Common.Event} event | 528 * @param {!Common.Event} event |
| 513 */ | 529 */ |
| 514 _frameNavigated(event) { | 530 _frameNavigated(event) { |
| 515 var frameId = event.data.id; | 531 var frameId = event.data.id; |
| 516 for (var i = 0; i < this._list.length(); i++) { | 532 for (var i = 0; i < this._list.length(); i++) { |
| 517 if (frameId === this._list.itemAtIndex(i).frameId) | 533 if (frameId === this._list.itemAtIndex(i).frameId) { |
| 534 var dispose = this._disposeExecutionContextFunctions.get(this._list.item AtIndex(i)); | |
| 535 if (dispose) | |
| 536 dispose(); | |
| 518 this._list.refreshItemsInRange(i, i + 1); | 537 this._list.refreshItemsInRange(i, i + 1); |
| 538 } | |
| 519 } | 539 } |
| 520 } | 540 } |
| 521 }; | 541 }; |
| OLD | NEW |