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

Unified Diff: chrome/browser/resources/net_internals/tab_switcher_view.js

Issue 2121763002: [net-internals] Fix JS exception on stopping capturing while in Capture view (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/net_internals/tab_switcher_view.js
diff --git a/chrome/browser/resources/net_internals/tab_switcher_view.js b/chrome/browser/resources/net_internals/tab_switcher_view.js
index fadc3d7af0462396afdc50ee0ed0723a987387a7..8badcf0fda46db095947b5e6fd031ef4c4e64b10 100644
--- a/chrome/browser/resources/net_internals/tab_switcher_view.js
+++ b/chrome/browser/resources/net_internals/tab_switcher_view.js
@@ -31,8 +31,8 @@ var TabSwitcherView = (function() {
this.tabIdToView_ = {};
this.tabIdToLink_ = {};
- // Ordered list of views.
- this.viewList_ = [];
+ // Map from tab id to the views link visiblity.
+ this.tabIdsLinkVisibility_ = new Map();
this.activeTabId_ = null;
this.onTabSwitched_ = opt_onTabSwitched;
@@ -98,7 +98,7 @@ var TabSwitcherView = (function() {
}
this.tabIdToView_[tabId] = view;
- this.viewList_.push(view);
+ this.tabIdsLinkVisibility_.set(tabId, true);
var node = addNodeWithText($(TAB_LIST_ID), 'a', name);
node.href = hash;
@@ -115,13 +115,16 @@ var TabSwitcherView = (function() {
var wasActive = this.activeTabId_ == tabId;
setNodeDisplay(this.tabIdToLink_[tabId], isVisible);
+ this.tabIdsLinkVisibility_.set(tabId, isVisible);
if (wasActive && !isVisible) {
// If the link for active tab is being hidden, then switch to the first
// tab which is still visible.
- for (var view in this.viewList_) {
eroman 2016/07/06 20:06:29 I agree that the current code is quite wrong. The
- if (view.isVisible())
- this.switchToTab(option.value);
+ for (var [localTabId, enabled] of this.tabIdsLinkVisibility_) {
+ if (enabled) {
+ this.switchToTab(localTabId);
+ break;
+ }
}
}
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698