Bug 989289 - Forcibly set the 'mode' attribute to 'icons' on toolbar construction. r=jaws.

This commit is contained in:
Mike Conley 2014-03-31 08:28:00 -04:00
parent 4dbb994ef5
commit 618d2667cd
3 changed files with 37 additions and 0 deletions

View File

@ -45,6 +45,11 @@
Cu.import("resource:///modules/CustomizableUI.jsm", scope);
let CustomizableUI = scope.CustomizableUI;
// Bug 989289: Forcibly set the now unsupported "mode" attribute, just
// in case it gets accidentally restored from persistence from a user
// that's been upgrading and downgrading.
this.setAttribute("mode", "icons");
// Searching for the toolbox palette in the toolbar binding because
// toolbars are constructed first.
let toolbox = this.toolbox;

View File

@ -94,4 +94,5 @@ skip-if = os == "linux"
[browser_987177_destroyWidget_xul.js]
[browser_987177_xul_wrapper_updating.js]
[browser_987492_window_api.js]
[browser_989289_force_icons_mode_attribute.js]
[browser_panel_toggle.js]

View File

@ -0,0 +1,31 @@
/* 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";
const kToolbarID = "test-toolbar";
/**
* Tests that customizable toolbars are forced to have their mode
* attribute set to "icons".
*/
add_task(function* testAddingToolbar() {
let toolbar = document.createElement("toolbar");
toolbar.setAttribute("mode", "full");
toolbar.setAttribute("customizable", "true");
toolbar.setAttribute("id", kToolbarID);
CustomizableUI.registerArea(kToolbarID, {
type: CustomizableUI.TYPE_TOOLBAR,
legacy: false,
})
gNavToolbox.appendChild(toolbar);
is(toolbar.getAttribute("mode"), "icons",
"Toolbar should have its mode attribute set to icons.")
toolbar.remove();
CustomizableUI.unregisterArea(kToolbarID);
});