Bug 989289 - Forcibly set the 'mode' attribute to 'icons' on toolbar construction. r=jaws, a=sledru.
💩💩 backed out by 1244d500650c 💩 💩
authorMike Conley <mconley@mozilla.com>
Tue, 08 Apr 2014 10:38:45 -0400
changeset 183659 85d2c5b844bc
parent 183658 1a92004a684f
child 183660 5e0b16fe8951
push id3439
push usermconley@mozilla.com
push date2014-04-08 14:42 +0000
Treeherderresults
reviewersjaws, sledru
bugs989289
milestone29.0
Bug 989289 - Forcibly set the 'mode' attribute to 'icons' on toolbar construction. r=jaws, a=sledru.
browser/components/customizableui/content/toolbar.xml
browser/components/customizableui/test/browser.ini
browser/components/customizableui/test/browser_989289_force_icons_mode_attribute.js
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -40,16 +40,21 @@
       ]]></constructor>
 
       <method name="_init">
         <body><![CDATA[
           let scope = {};
           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;
           if (toolbox && !toolbox.palette) {
             for (let node of toolbox.children) {
               if (node.localName == "toolbarpalette") {
                 // Hold on to the palette but remove it from the document.
                 toolbox.palette = node;
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -80,9 +80,10 @@ skip-if = os == "linux"
 
 [browser_978084_dragEnd_after_move.js]
 [browser_980155_add_overflow_toolbar.js]
 [browser_981418-widget-onbeforecreated-handler.js]
 [browser_985815_propagate_setToolbarVisibility.js]
 [browser_981305_separator_insertion.js]
 [browser_987177_destroyWidget_xul.js]
 [browser_987177_xul_wrapper_updating.js]
+[browser_989289_force_icons_mode_attribute.js]
 [browser_panel_toggle.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/customizableui/test/browser_989289_force_icons_mode_attribute.js
@@ -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);
+});
\ No newline at end of file