Bug 969661 - Always re-enable Australis character encoding button when it is removed from an area. r=jaws, a=gavin
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Sat, 08 Feb 2014 00:06:55 +0000
changeset 176931 2fcb2cd1befc44720725db30bb84c6d89450559a
parent 176930 14190c246d098a50ee37604bd0c76f8423164cf0
child 176932 a64ec476bedd30497f8a3865904ae2759401d3ba
push id5206
push userryanvm@gmail.com
push dateSun, 09 Feb 2014 02:31:36 +0000
treeherdermozilla-aurora@2fcb2cd1befc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, gavin
bugs969661
milestone29.0a2
Bug 969661 - Always re-enable Australis character encoding button when it is removed from an area. r=jaws, a=gavin
browser/components/customizableui/src/CustomizableWidgets.jsm
browser/components/customizableui/test/browser.ini
browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js
--- a/browser/components/customizableui/src/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/src/CustomizableWidgets.jsm
@@ -789,16 +789,17 @@ const CustomizableWidgets = [{
           if (aArea == CustomizableUI.AREA_PANEL) {
             let panel = document.getElementById(kPanelId);
             panel.addEventListener("popupshowing", updateButton);
           }
         },
         onWidgetRemoved: (aWidgetId, aPrevArea) => {
           if (aWidgetId != this.id)
             return;
+          aNode.removeAttribute("disabled");
           if (aPrevArea == CustomizableUI.AREA_PANEL) {
             let panel = document.getElementById(kPanelId);
             panel.removeEventListener("popupshowing", updateButton);
           }
         },
         onWidgetInstanceRemoved: (aWidgetId, aDoc) => {
           if (aWidgetId != this.id || aDoc != document)
             return;
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -58,9 +58,10 @@ skip-if = os == "linux"
 [browser_942581_unregisterArea_keeps_placements.js]
 [browser_943683_migration_test.js]
 [browser_944887_destroyWidget_should_destroy_in_palette.js]
 [browser_945739_showInPrivateBrowsing_customize_mode.js]
 [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_969661_character_encoding_navbar_disabled.js]
 [browser_panel_toggle.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js
@@ -0,0 +1,26 @@
+/* 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";
+
+
+// Adding the character encoding menu to the panel, exiting customize mode,
+// and moving it to the nav-bar should have it enabled, not disabled.
+add_task(function() {
+  yield startCustomizing();
+  CustomizableUI.addWidgetToArea("characterencoding-button", "PanelUI-contents");
+  yield endCustomizing();
+  yield PanelUI.show();
+  let panelHiddenPromise = promisePanelHidden(window);
+  PanelUI.hide();
+  yield panelHiddenPromise;
+  CustomizableUI.addWidgetToArea("characterencoding-button", 'nav-bar');
+  let button = document.getElementById("characterencoding-button");
+  ok(!button.hasAttribute("disabled"), "Button shouldn't be disabled");
+});
+
+add_task(function asyncCleanup() {
+  resetCustomization();
+});
+