Bug 724346 - Ctrl-Tab should not cycle through hidden tabs. r=dao
authorLim Wei Zhong <limweizhong@gmail.com>
Sat, 25 Aug 2012 17:18:43 -0400
changeset 105485 1db0e95acab859db02aedabd7c210426955693e4
parent 105484 815d9b2bd355379485bed4b2ce0aa97ab29331ac
child 105486 719af14ab13364758f9126cace04883e9733a5fb
push id55
push usershu@rfrn.org
push dateThu, 30 Aug 2012 01:33:09 +0000
reviewersdao
bugs724346
milestone17.0a1
Bug 724346 - Ctrl-Tab should not cycle through hidden tabs. r=dao
browser/base/content/browser-tabPreviews.js
--- a/browser/base/content/browser-tabPreviews.js
+++ b/browser/base/content/browser-tabPreviews.js
@@ -184,19 +184,24 @@ var ctrlTab = {
 
     // Rotate the list until the selected tab is first
     while (!list[0].selected)
       list.push(list.shift());
 
     list = list.filter(function (tab) !tab.closing);
 
     if (this.recentlyUsedLimit != 0) {
-      let recentlyUsedTabs = this._recentlyUsedTabs;
-      if (this.recentlyUsedLimit > 0)
-        recentlyUsedTabs = this._recentlyUsedTabs.slice(0, this.recentlyUsedLimit);
+      let recentlyUsedTabs = [];
+      for (let tab of this._recentlyUsedTabs) {
+        if (!tab.hidden && !tab.closing) {
+          recentlyUsedTabs.push(tab);
+          if (this.recentlyUsedLimit > 0 && recentlyUsedTabs.length >= this.recentlyUsedLimit)
+            break;
+        }
+      }
       for (let i = recentlyUsedTabs.length - 1; i >= 0; i--) {
         list.splice(list.indexOf(recentlyUsedTabs[i]), 1);
         list.unshift(recentlyUsedTabs[i]);
       }
     }
 
     return this._tabList = list;
   },