Bug 972822 - Australis - persist the currentset attribute correctly when appending tabgroups button, r=dao
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 20 Feb 2014 17:27:15 +0000
changeset 170408 cf82ac9f81410023b6c76fd8c36f2dd88bf42030
parent 170407 0f152676a9f184fe63743a269498744e795ad337
child 170409 aacb9513c0b55cd9e8c792cd1a919f4af1837394
push id26288
push userryanvm@gmail.com
push dateTue, 25 Feb 2014 20:20:43 +0000
treeherdermozilla-central@22650589a724 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdao
bugs972822
milestone30.0a1
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 972822 - Australis - persist the currentset attribute correctly when appending tabgroups button, r=dao
browser/base/content/browser-tabview.js
--- a/browser/base/content/browser-tabview.js
+++ b/browser/base/content/browser-tabview.js
@@ -416,28 +416,26 @@ let TabView = {
   },
 
   // ----------
   // Function: _addToolbarButton
   // Adds the TabView button to the TabsToolbar.
   _addToolbarButton: function TabView__addToolbarButton() {
     let buttonId = "tabview-button";
 
-    if (document.getElementById(buttonId))
+    if (CustomizableUI.getPlacementOfWidget(buttonId))
       return;
 
-    let toolbar = document.getElementById("TabsToolbar");
-    let currentSet = toolbar.currentSet.split(",");
-    let alltabsPos = currentSet.indexOf("alltabs-button");
-    if (-1 == alltabsPos)
-      return;
-
-    let allTabsBtn = document.getElementById("alltabs-button");
-    let nextItem = allTabsBtn.nextSibling;
-    toolbar.insertItem(buttonId, nextItem);
+    let allTabsBtnPlacement = CustomizableUI.getPlacementOfWidget("alltabs-button");
+    // allTabsBtnPlacement can never be null because the button isn't removable
+    let desiredPosition = allTabsBtnPlacement.position + 1;
+    CustomizableUI.addWidgetToArea(buttonId, "TabsToolbar", desiredPosition);
+    // NB: this is for backwards compatibility, and should be removed by
+    // https://bugzilla.mozilla.org/show_bug.cgi?id=976041
+    document.persist("TabsToolbar", "currentset");
   },
 
   // ----------
   // Function: updateGroupNumberBroadcaster
   // Updates the group number broadcaster.
   updateGroupNumberBroadcaster: function TabView_updateGroupNumberBroadcaster(number) {
     let groupsNumber = document.getElementById("tabviewGroupsNumber");
     groupsNumber.setAttribute("groups", number);