From 3e73d4d7ace6350f79b1f9a921229e27f8085d28 Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Sat, 8 Feb 2014 00:06:55 +0000 Subject: [PATCH] Bug 969661 - always re-enable Australis character encoding button when it is removed from an area, r=jaws --HG-- extra : rebase_source : 5c3cc7cbf7c857ec7aaced350aa8864c9cd939ba --- .../src/CustomizableWidgets.jsm | 1 + .../customizableui/test/browser.ini | 1 + ...9661_character_encoding_navbar_disabled.js | 26 +++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js diff --git a/browser/components/customizableui/src/CustomizableWidgets.jsm b/browser/components/customizableui/src/CustomizableWidgets.jsm index 49eaf02e4ca..343bee9076a 100644 --- a/browser/components/customizableui/src/CustomizableWidgets.jsm +++ b/browser/components/customizableui/src/CustomizableWidgets.jsm @@ -794,6 +794,7 @@ const CustomizableWidgets = [{ 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); diff --git a/browser/components/customizableui/test/browser.ini b/browser/components/customizableui/test/browser.ini index 3497cce6756..5837a5bb793 100644 --- a/browser/components/customizableui/test/browser.ini +++ b/browser/components/customizableui/test/browser.ini @@ -63,4 +63,5 @@ skip-if = os == "linux" [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] diff --git a/browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js b/browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js new file mode 100644 index 00000000000..dc58815a5a2 --- /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(); +}); +