diff --git a/browser/components/customizableui/src/CustomizeMode.jsm b/browser/components/customizableui/src/CustomizeMode.jsm index 4b4ba4c9d84a..9cb9da6e95bc 100644 --- a/browser/components/customizableui/src/CustomizeMode.jsm +++ b/browser/components/customizableui/src/CustomizeMode.jsm @@ -527,6 +527,11 @@ CustomizeMode.prototype = { aNode.removeAttribute("command"); } + if (aNode.hasAttribute("observes")) { + wrapper.setAttribute("itemobserves", aNode.getAttribute("observes")); + aNode.removeAttribute("observes"); + } + if (aNode.checked) { wrapper.setAttribute("itemchecked", "true"); aNode.checked = false; @@ -602,6 +607,10 @@ CustomizeMode.prototype = { return null; } + if (aWrapper.hasAttribute("itemobserves")) { + toolbarItem.setAttribute("observes", aWrapper.getAttribute("itemobserves")); + } + if (aWrapper.hasAttribute("itemchecked")) { toolbarItem.checked = true; } diff --git a/browser/components/customizableui/test/browser.ini b/browser/components/customizableui/test/browser.ini index 8db2b457a2e4..3a7dfad508bf 100644 --- a/browser/components/customizableui/test/browser.ini +++ b/browser/components/customizableui/test/browser.ini @@ -11,6 +11,7 @@ support-files = [browser_878452_drag_to_panel.js] [browser_880164_customization_context_menus.js] [browser_880382_drag_wide_widgets_in_panel.js] +[browser_885052_customize_mode_observers_disabed.js] [browser_885530_showInPrivateBrowsing.js] [browser_886323_buildArea_removable_nodes.js] [browser_887438_currentset_shim.js] diff --git a/browser/components/customizableui/test/browser_885052_customize_mode_observers_disabed.js b/browser/components/customizableui/test/browser_885052_customize_mode_observers_disabed.js new file mode 100644 index 000000000000..1d9b88cf09f4 --- /dev/null +++ b/browser/components/customizableui/test/browser_885052_customize_mode_observers_disabed.js @@ -0,0 +1,37 @@ +/* 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"; + +// Observers should be disabled when in customization mode. +add_task(function() { + BrowserFullScreen(); + let shownPanelPromise = promisePanelShown(window); + PanelUI.toggle({type: "command"}); + yield shownPanelPromise; + + let fullscreenButton = document.getElementById("fullscreen-button"); + ok(fullscreenButton.checked, "Fullscreen button should be checked when in fullscreen.") + + yield startCustomizing(); + + let fullscreenButtonWrapper = document.getElementById("wrapper-fullscreen-button"); + ok(fullscreenButtonWrapper.hasAttribute("itemobserves"), "Observer should be moved to wrapper"); + fullscreenButton = document.getElementById("fullscreen-button"); + ok(!fullscreenButton.hasAttribute("observes"), "Observer should be removed from button"); + ok(!fullscreenButton.checked, "Fullscreen button should no longer be checked during customization mode"); + + yield endCustomizing(); + BrowserFullScreen(); + shownPanelPromise = promisePanelShown(window); + PanelUI.toggle({type: "command"}); + yield shownPanelPromise; + + fullscreenButton = document.getElementById("fullscreen-button"); + ok(!fullscreenButton.checked, "Fullscreen button should not be checked when not in fullscreen.") + + let hiddenPanelPromise = promisePanelHidden(window); + PanelUI.toggle({type: "command"}); + yield hiddenPanelPromise; +});