Index: third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js b/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js |
index 432e683495b63b90568647a370573676ba07d406..258975aa11efcdc4d72ef1df09f8631e4b8ef498 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js |
+++ b/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js |
@@ -51,8 +51,8 @@ UI.TabbedPane = class extends UI.VBox { |
this._tabs = []; |
/** @type {!Array.<!UI.TabbedPaneTab>} */ |
this._tabsHistory = []; |
- /** @type {!Object.<string, !UI.TabbedPaneTab>} */ |
- this._tabsById = {}; |
+ /** @type {!Map<string, !UI.TabbedPaneTab>} */ |
+ this._tabsById = new Map(); |
this._currentTabLocked = false; |
this._autoSelectFirstItemOnShow = true; |
@@ -109,7 +109,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @return {?UI.Widget} |
*/ |
tabView(tabId) { |
- return this._tabsById[tabId] ? this._tabsById[tabId].view : null; |
+ return this._tabsById.has(tabId) ? this._tabsById.get(tabId).view : null; |
} |
/** |
@@ -164,7 +164,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @return {boolean} |
*/ |
isTabCloseable(id) { |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
return tab ? tab.isCloseable() : false; |
} |
@@ -191,8 +191,8 @@ UI.TabbedPane = class extends UI.VBox { |
isCloseable = typeof isCloseable === 'boolean' ? isCloseable : this._closeableTabs; |
var tab = new UI.TabbedPaneTab(this, id, tabTitle, isCloseable, view, tabTooltip); |
tab.setDelegate(this._delegate); |
- console.assert(!this._tabsById[id], `Tabbed pane already contains a tab with id '${id}'`); |
- this._tabsById[id] = tab; |
+ console.assert(!this._tabsById.has(id), `Tabbed pane already contains a tab with id '${id}'`); |
+ this._tabsById.set(id, tab); |
if (index !== undefined) |
this._tabs.splice(index, 0, tab); |
else |
@@ -232,15 +232,15 @@ UI.TabbedPane = class extends UI.VBox { |
* @param {boolean=} userGesture |
*/ |
_innerCloseTab(id, userGesture) { |
- if (!this._tabsById[id]) |
+ if (!this._tabsById.has(id)) |
return; |
- if (userGesture && !this._tabsById[id]._closeable) |
+ if (userGesture && !this._tabsById.get(id)._closeable) |
return; |
if (this._currentTab && this._currentTab.id === id) |
this._hideCurrentTab(); |
- var tab = this._tabsById[id]; |
- delete this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
+ this._tabsById.delete(id); |
this._tabsHistory.splice(this._tabsHistory.indexOf(tab), 1); |
this._tabs.splice(this._tabs.indexOf(tab), 1); |
@@ -258,7 +258,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @return {boolean} |
*/ |
hasTab(tabId) { |
- return !!this._tabsById[tabId]; |
+ return this._tabsById.has(tabId); |
} |
/** |
@@ -311,7 +311,7 @@ UI.TabbedPane = class extends UI.VBox { |
if (this._currentTabLocked) |
return false; |
var focused = this.hasFocus(); |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
if (!tab) |
return false; |
if (this._currentTab && this._currentTab.id === id) |
@@ -353,7 +353,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @param {string=} iconTooltip |
*/ |
setTabIcon(id, iconType, iconTooltip) { |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
if (tab._setIconType(iconType, iconTooltip)) |
this._updateTabElements(); |
} |
@@ -363,7 +363,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @param {boolean} enabled |
*/ |
setTabEnabled(id, enabled) { |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
tab.tabElement.classList.toggle('disabled', !enabled); |
} |
@@ -373,7 +373,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @param {boolean=} force |
*/ |
toggleTabClass(id, className, force) { |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
if (tab._toggleClass(className, force)) |
this._updateTabElements(); |
} |
@@ -394,7 +394,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @param {string=} tabTooltip |
*/ |
changeTabTitle(id, tabTitle, tabTooltip) { |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
if (tabTooltip !== undefined) |
tab.tooltip = tabTooltip; |
if (tab.title !== tabTitle) { |
@@ -408,7 +408,7 @@ UI.TabbedPane = class extends UI.VBox { |
* @param {!UI.Widget} view |
*/ |
changeTabView(id, view) { |
- var tab = this._tabsById[id]; |
+ var tab = this._tabsById.get(id); |
if (tab.view === view) |
return; |
@@ -543,7 +543,7 @@ UI.TabbedPane = class extends UI.VBox { |
*/ |
_dropDownMenuItemSelected(event) { |
var tabId = /** @type {string} */ (event.data); |
- this._lastSelectedOverflowTab = this._tabsById[tabId]; |
+ this._lastSelectedOverflowTab = this._tabsById.get(tabId); |
this.selectTab(tabId, true); |
} |