Bug 592586 Remove code for "group tab by sites" [r+a=dietrich]
authorMichael Yoshitaka Erlewine <mitcho@mitcho.com>
Fri, 03 Sep 2010 15:00:09 -0400
changeset 52124 e1b1e9dfcdaf4b29db888e3cb11682424fcca91d
parent 52123 4e0ade1d0968553368fda678550faa5a7976683a
child 52125 7b4ebf471dd04f340357a92529a66ceab82595c6
child 52145 daa97e0bc5f92e17310bde8b15845efe2b98e14e
push id15551
push usereakhgari@mozilla.com
push dateTue, 07 Sep 2010 22:09:01 +0000
treeherdermozilla-central@7b4ebf471dd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs592586
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 592586 Remove code for "group tab by sites" [r+a=dietrich]
browser/base/content/tabview/groupitems.js
browser/base/content/tabview/ui.js
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -1400,31 +1400,16 @@ window.GroupItems = {
       Utils.log('GroupItems.groupItemStorageSanity: bad bounds', groupItemData.bounds);
       sane = false;
     }
 
     return sane;
   },
 
   // ----------
-  // Function: getGroupItemWithTitle
-  // Returns the <GroupItem> that has the given title, or null if none found.
-  // TODO: what if there are multiple groupItems with the same title??
-  //       Right now, looks like it'll return the last one. Bug 586557
-  getGroupItemWithTitle: function(title) {
-    var result = null;
-    this.groupItems.forEach(function(groupItem) {
-      if (groupItem.getTitle() == title)
-        result = groupItem;
-    });
-
-    return result;
-  },
-
-  // ----------
   // Function: register
   // Adds the given <GroupItem> to the list of groupItems we're tracking.
   register: function(groupItem) {
     Utils.assert(groupItem, 'groupItem');
     Utils.assert(this.groupItems.indexOf(groupItem) == -1, 'only register once per groupItem');
     this.groupItems.push(groupItem);
   },
 
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -935,21 +935,16 @@ var UIManager = {
           self._reset();
         }
       }, {
 */
         name: "save",
         code: function() {
           self._saveAll();
         }
-      }, {
-        name: "group sites",
-        code: function() {
-          self._arrangeBySite();
-        }
       }];
 
       var count = commands.length;
       var a;
       for (a = 0; a < count; a++) {
         commands[a].element = (iQ("<option>")
           .val(a)
           .html(commands[a].name)
@@ -1003,65 +998,15 @@ var UIManager = {
   // Function: _saveAll
   // Saves all data associated with TabView.
   // TODO: Save info items
   _saveAll: function() {
     this._save();
     GroupItems.saveAll();
     TabItems.saveAll();
   },
-
-  // ----------
-  // Function: _arrangeBySite
-  // Blows away all existing groupItems and organizes the tabs into new groupItems based
-  // on domain.
-  _arrangeBySite: function() {
-    function putInGroupItem(set, key) {
-      var groupItem = GroupItems.getGroupItemWithTitle(key);
-      if (groupItem) {
-        set.forEach(function(el) {
-          groupItem.add(el);
-        });
-      } else
-        new GroupItem(set, { dontPush: true, dontArrange: true, title: key });
-    }
-
-    GroupItems.removeAll();
-
-    var groupItems = [];
-    var leftovers = [];
-    var items = TabItems.getItems();
-    items.forEach(function(item) {
-      var url = item.tab.linkedBrowser.currentURI.spec;
-      var domain = url.split('/')[2];
-
-      if (!domain)
-        leftovers.push(item.container);
-      else {
-        var domainParts = domain.split(".");
-        var mainDomain = domainParts[domainParts.length - 2];
-        if (groupItems[mainDomain])
-          groupItems[mainDomain].push(item.container);
-        else
-          groupItems[mainDomain] = [item.container];
-      }
-    });
-
-    for (key in groupItems) {
-      var set = groupItems[key];
-      if (set.length > 1) {
-        putInGroupItem(set, key);
-      } else
-        leftovers.push(set[0]);
-    }
-
-    if (leftovers.length)
-      putInGroupItem(leftovers, "mixed");
-
-    GroupItems.arrange();
-  },
 };
 
 // ----------
 window.UI = UIManager;
 window.UI.init();
 
 })();