Bug 973932 - Australis' CustomizeMode isn't resetting the currentset attribute on the addon-bar, r=mconley, a=sylvestre
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Thu, 27 Feb 2014 13:12:18 +0000
changeset 183096 92d59571bddaeb41a412ef95c4db987497a6bd1a
parent 183095 5dfb3f29f55c8ab4b9627bd605166f95ed56605d
child 183097 cb995c6b9ca083fca9fe7932ef26957ae62690e4
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, sylvestre
bugs973932
milestone29.0a2
Bug 973932 - Australis' CustomizeMode isn't resetting the currentset attribute on the addon-bar, r=mconley, a=sylvestre
browser/base/content/browser.xul
browser/components/customizableui/test/browser.ini
browser/components/customizableui/test/browser_973932_addonbar_currentset.js
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -961,17 +961,18 @@
                          context="placesContext"/>
             </toolbarbutton>
           </hbox>
         </hbox>
       </toolbaritem>
     </toolbar>
 
     <!-- This is a shim which will go away ASAP. See bug 749804 for details -->
-    <toolbar id="addon-bar" toolbar-delegate="nav-bar" mode="icons" iconsize="small">
+    <toolbar id="addon-bar" toolbar-delegate="nav-bar" mode="icons" iconsize="small"
+             customizable="true">
       <hbox id="addonbar-closebutton"/>
       <statusbar id="status-bar"/>
     </toolbar>
 
     <toolbarpalette id="BrowserToolbarPalette">
 
 # Update primaryToolbarButtons in browser/themes/shared/browser.inc when adding
 # or removing default items with the toolbarbutton-1 class.
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -64,9 +64,10 @@ skip-if = os == "linux"
 [browser_947987_removable_default.js]
 [browser_948985_non_removable_defaultArea.js]
 [browser_952963_areaType_getter_no_area.js]
 [browser_956602_remove_special_widget.js]
 [browser_969427_recreate_destroyed_widget_after_reset.js]
 [browser_969661_character_encoding_navbar_disabled.js]
 [browser_970511_undo_restore_default.js]
 [browser_972267_customizationchange_events.js]
+[browser_973932_addonbar_currentset.js]
 [browser_panel_toggle.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/customizableui/test/browser_973932_addonbar_currentset.js
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+let addonbarID = CustomizableUI.AREA_ADDONBAR;
+let addonbar = document.getElementById(addonbarID);
+
+// Check that currentset is correctly updated after a reset:
+add_task(function() {
+  let placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
+  is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements");
+  ok(CustomizableUI.inDefaultState, "Should be in default state");
+  info("Adding a spring to add-on bar shim");
+  CustomizableUI.addWidgetToArea("spring", addonbarID, 1);
+  ok(addonbar.getElementsByTagName("toolbarspring").length, "There should be a spring in the toolbar");
+  ok(!CustomizableUI.inDefaultState, "Should no longer be in default state");
+  placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
+  is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match placements after spring addition");
+
+  yield startCustomizing();
+  yield gCustomizeMode.reset();
+  ok(CustomizableUI.inDefaultState, "Should be in default state after reset");
+  placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
+  is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements after reset");
+  ok(!addonbar.getElementsByTagName("toolbarspring").length, "There should be no spring in the toolbar");
+  yield endCustomizing();
+});
+