Bug 956731 - Remove legacy add-on bar and statusbar shims. r?gijs
MozReview-Commit-ID: 2deeujcHYUM
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -64,38 +64,16 @@ toolbar[customizable="true"] {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-menubar-stub");
}
%endif
#toolbar-menubar[autohide="true"] {
-moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#toolbar-menubar-autohide");
}
-#addon-bar {
- -moz-binding: url("chrome://browser/content/customizableui/toolbar.xml#addonbar-delegating");
- visibility: visible;
- margin: 0;
- height: 0 !important;
- overflow: hidden;
- padding: 0;
- border: 0 none;
-}
-
-#addonbar-closebutton {
- visibility: visible;
- height: 0 !important;
-}
-
-#status-bar {
- height: 0 !important;
- -moz-binding: none;
- padding: 0;
- margin: 0;
-}
-
panelmultiview {
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#panelmultiview");
}
photonpanelmultiview {
-moz-binding: url("chrome://browser/content/customizableui/panelUI.xml#photonpanelmultiview");
}
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -8650,17 +8650,17 @@ var ToolbarIconColor = {
case "toolbarvisibilitychange":
// toolbar changes dont require reset of the cached color values
break;
case "tabsintitlebar":
this._windowState.tabsintitlebar = reasonValue;
break;
}
- let toolbarSelector = "#navigator-toolbox > toolbar:not([collapsed=true]):not(#addon-bar)";
+ let toolbarSelector = "#navigator-toolbox > toolbar:not([collapsed=true])";
if (AppConstants.platform == "macosx")
toolbarSelector += ":not([type=menubar])";
// The getComputedStyle calls and setting the brighttext are separated in
// two loops to avoid flushing layout and making it dirty repeatedly.
let cachedLuminances = this._toolbarLuminanceCache;
let luminances = new Map();
for (let toolbar of document.querySelectorAll(toolbarSelector)) {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -1127,23 +1127,16 @@
tooltip="bhTooltip" popupsinherittooltip="true"
context="placesContext"/>
</toolbarbutton>
</hbox>
</hbox>
</toolbaritem>
</toolbar>
- <!-- This is a shim which will go away ASAP. See bug 749804 for details -->
- <toolbar id="addon-bar" toolbar-delegate="nav-bar" mode="icons" iconsize="small"
- customizable="true">
- <hbox id="addonbar-closebutton"/>
- <statusbar id="status-bar"/>
- </toolbar>
-
<toolbarpalette id="BrowserToolbarPalette">
<toolbarbutton id="print-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
#ifdef XP_MACOSX
command="cmd_print"
tooltip="dynamic-shortcut-tooltip"
#else
command="cmd_printPreview"
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -245,32 +245,24 @@ var CustomizableUIInternal = {
legacy: true,
type: CustomizableUI.TYPE_TOOLBAR,
defaultPlacements: [
"personal-bookmarks",
],
defaultCollapsed: true,
}, true);
- this.registerArea(CustomizableUI.AREA_ADDONBAR, {
- type: CustomizableUI.TYPE_TOOLBAR,
- legacy: true,
- defaultPlacements: ["addonbar-closebutton", "status-bar"],
- defaultCollapsed: false,
- }, true);
-
SearchWidgetTracker.init();
},
get _builtinToolbars() {
let toolbars = new Set([
CustomizableUI.AREA_NAVBAR,
CustomizableUI.AREA_BOOKMARKS,
CustomizableUI.AREA_TABSTRIP,
- CustomizableUI.AREA_ADDONBAR,
]);
if (AppConstants.platform != "macosx") {
toolbars.add(CustomizableUI.AREA_MENUBAR);
}
return toolbars;
},
_defineBuiltInWidgets() {
@@ -2871,22 +2863,16 @@ this.CustomizableUI = {
* Constant reference to the ID of the tabstrip toolbar.
*/
AREA_TABSTRIP: "TabsToolbar",
/**
* Constant reference to the ID of the bookmarks toolbar.
*/
AREA_BOOKMARKS: "PersonalToolbar",
/**
- * Constant reference to the ID of the addon-bar toolbar shim.
- * Do not use, this will be removed as soon as reasonably possible.
- * @deprecated
- */
- AREA_ADDONBAR: "addon-bar",
- /**
* Constant reference to the ID of the non-dymanic (fixed) list in the overflow panel.
*/
AREA_FIXED_OVERFLOW_PANEL: "widget-overflow-fixed-list",
/**
* Constant indicating the area is a menu panel.
*/
TYPE_MENU_PANEL: "menu-panel",
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -383,236 +383,9 @@
draggableThis.mouseDownCheck = function(e) {
return this._dragBindingAlive;
};
} catch (e) {}
}
]]></constructor>
</implementation>
</binding>
-
-
-<!-- This is a peculiar binding. It is here to deal with overlayed/inserted add-on content,
- and immediately direct such content elsewhere. -->
- <binding id="addonbar-delegating">
- <implementation>
- <constructor><![CDATA[
- // Reading these immediately so nobody messes with them anymore:
- this._delegatingToolbar = this.getAttribute("toolbar-delegate");
- this._wasCollapsed = this.getAttribute("collapsed") == "true";
- // Leaving those in here to unbreak some code:
- if (document.readyState == "complete") {
- this._init();
- } else {
- // Need to wait until XUL overlays are loaded. See bug 554279.
- let self = this;
- document.addEventListener("readystatechange", function onReadyStateChange() {
- if (document.readyState != "complete")
- return;
- document.removeEventListener("readystatechange", onReadyStateChange);
- self._init();
- });
- }
- ]]></constructor>
-
- <method name="_init">
- <body><![CDATA[
- // 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;
- toolbox.removeChild(node);
- }
- }
- }
-
- // pass the current set of children for comparison with placements:
- let children = [];
- for (let node of this.childNodes) {
- if (node.getAttribute("skipintoolbarset") != "true" && node.id) {
- // Force everything to be removable so that buildArea can chuck stuff
- // out if the user has customized things / we've been here before:
- if (!this._whiteListed.has(node.id)) {
- node.setAttribute("removable", "true");
- }
- children.push(node);
- }
- }
- CustomizableUI.registerToolbarNode(this, children);
- let existingMigratedItems = (this.getAttribute("migratedset") || "").split(",");
- for (let migratedItem of existingMigratedItems.filter((x) => !!x)) {
- this._currentSetMigrated.add(migratedItem);
- }
- this.evictNodes();
- // We can't easily use |this| or strong bindings for the observer fn here
- // because that creates leaky circular references when the node goes away,
- // and XBL destructors are unreliable.
- let mutationObserver = new MutationObserver(function(mutations) {
- if (!mutations.length) {
- return;
- }
- let toolbar = mutations[0].target;
- // Can't use our own attribute because we might not have one if we're set to
- // collapsed
- let areCustomizing = toolbar.ownerDocument.documentElement.getAttribute("customizing");
- if (!toolbar._isModifying && !areCustomizing) {
- toolbar.evictNodes();
- }
- });
- mutationObserver.observe(this, {childList: true});
- ]]></body>
- </method>
- <method name="evictNodes">
- <body><![CDATA[
- this._isModifying = true;
- let i = this.childNodes.length;
- while (i--) {
- let node = this.childNodes[i];
- if (this.childNodes[i].id) {
- this.evictNode(this.childNodes[i]);
- } else {
- node.remove();
- }
- }
- this._isModifying = false;
- this._updateMigratedSet();
- ]]></body>
- </method>
- <method name="evictNode">
- <parameter name="aNode"/>
- <body>
- <![CDATA[
- if (this._whiteListed.has(aNode.id) || CustomizableUI.isSpecialWidget(aNode.id)) {
- return;
- }
- const kItemMaxWidth = 100;
- let oldParent = aNode.parentNode;
- aNode.setAttribute("removable", "true");
- this._currentSetMigrated.add(aNode.id);
-
- let movedOut = false;
- if (!this._wasCollapsed) {
- try {
- let nodeWidth = aNode.getBoundingClientRect().width;
- if (nodeWidth == 0 || nodeWidth > kItemMaxWidth) {
- throw new Error(aNode.id + " is too big (" + nodeWidth +
- "px wide), moving to the palette");
- }
- CustomizableUI.addWidgetToArea(aNode.id, this._delegatingToolbar);
- movedOut = true;
- } catch (ex) {
- // This will throw if the node is too big, or can't be moved there for
- // some reason. Report this:
- Cu.reportError(ex);
- }
- }
-
- /* We won't have moved the widget if either the add-on bar was collapsed,
- * or if it was too wide to be inserted into the navbar. */
- if (!movedOut) {
- try {
- CustomizableUI.removeWidgetFromArea(aNode.id);
- } catch (ex) {
- Cu.reportError(ex);
- aNode.remove();
- }
- }
-
- // Surprise: addWidgetToArea(palette) will get you nothing if the palette
- // is not constructed yet. Fix:
- if (aNode.parentNode == oldParent) {
- let palette = this.toolbox.palette;
- if (palette && oldParent != palette) {
- palette.appendChild(aNode);
- }
- }
- ]]></body>
- </method>
- <method name="insertItem">
- <parameter name="aId"/>
- <parameter name="aBeforeElt"/>
- <parameter name="aWrapper"/>
- <body><![CDATA[
- if (aWrapper) {
- Cu.reportError("Can't insert " + aId + ": using insertItem " +
- "no longer supports wrapper elements.");
- return null;
- }
-
- let widget = CustomizableUI.getWidget(aId);
- widget = widget && widget.forWindow(window);
- let node = widget && widget.node;
- if (!node) {
- return null;
- }
-
- this._isModifying = true;
- // Temporarily add it here so it can have a width, then ditch it:
- this.appendChild(node);
- this.evictNode(node);
- this._isModifying = false;
- this._updateMigratedSet();
- // We will now have moved stuff around; kick off some events
- // so add-ons know we've just moved their stuff:
- // XXXgijs: only in this window. It's hard to know for sure what's the right
- // thing to do here - typically insertItem is used on each window, so
- // this seems to make the most sense, even if some of the effects of
- // evictNode might affect multiple windows.
- CustomizableUI.dispatchToolboxEvent("customizationchange", {}, window);
- CustomizableUI.dispatchToolboxEvent("aftercustomization", {}, window);
- return node;
- ]]></body>
- </method>
- <method name="getMigratedItems">
- <body><![CDATA[
- return [...this._currentSetMigrated];
- ]]></body>
- </method>
- <method name="_updateMigratedSet">
- <body><![CDATA[
- let newMigratedItems = this.getMigratedItems().join(",");
- if (this.getAttribute("migratedset") != newMigratedItems) {
- this.setAttribute("migratedset", newMigratedItems);
- this.ownerDocument.persist(this.id, "migratedset");
- }
- ]]></body>
- </method>
- <property name="customizationTarget" readonly="true">
- <getter><![CDATA[
- return this;
- ]]></getter>
- </property>
- <property name="currentSet">
- <getter><![CDATA[
- return Array.from(this.children, node => node.id).join(",");
- ]]></getter>
- <setter><![CDATA[
- let v = val.split(",");
- let newButtons = v.filter(x => x && (!this._whiteListed.has(x) &&
- !CustomizableUI.isSpecialWidget(x) &&
- !this._currentSetMigrated.has(x)));
- for (let newButton of newButtons) {
- this._currentSetMigrated.add(newButton);
- this.insertItem(newButton);
- }
- this._updateMigratedSet();
- ]]></setter>
- </property>
- <property name="toolbox" readonly="true">
- <getter><![CDATA[
- if (!this._toolbox && this.parentNode &&
- this.parentNode.localName == "toolbox") {
- this._toolbox = this.parentNode;
- }
-
- return this._toolbox;
- ]]></getter>
- </property>
- <field name="_whiteListed" readonly="true">new Set(["addonbar-closebutton", "status-bar"])</field>
- <field name="_isModifying">false</field>
- <field name="_currentSetMigrated">new Set()</field>
- </implementation>
- </binding>
</bindings>
--- a/browser/components/customizableui/test/browser.ini
+++ b/browser/components/customizableui/test/browser.ini
@@ -51,17 +51,16 @@ skip-if = os == "mac"
[browser_934951_zoom_in_toolbar.js]
[browser_938980_navbar_collapsed.js]
[browser_938995_indefaultstate_nonremovable.js]
[browser_940013_registerToolbarNode_calls_registerArea.js]
[browser_940307_panel_click_closure_handling.js]
[browser_940946_removable_from_navbar_customizemode.js]
[browser_941083_invalidate_wrapper_cache_createWidget.js]
[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_947914_button_addons.js]
skip-if = os == "linux" # Intermittent failures
[browser_947914_button_copy.js]
subsuite = clipboard
skip-if = os == "linux" # Intermittent failures on Linux
[browser_947914_button_cut.js]
@@ -96,17 +95,16 @@ skip-if = os == "linux" # Intermittent f
[browser_967000_button_charEncoding.js]
[browser_967000_button_feeds.js]
[browser_968565_insert_before_hidden_items.js]
[browser_969427_recreate_destroyed_widget_after_reset.js]
[browser_969661_character_encoding_navbar_disabled.js]
[browser_970511_undo_restore_default.js]
[browser_972267_customizationchange_events.js]
[browser_973641_button_addon.js]
-[browser_973932_addonbar_currentset.js]
[browser_975719_customtoolbars_behaviour.js]
[browser_976792_insertNodeInWindow.js]
skip-if = os == "linux"
[browser_978084_dragEnd_after_move.js]
[browser_980155_add_overflow_toolbar.js]
[browser_981305_separator_insertion.js]
[browser_981418-widget-onbeforecreated-handler.js]
[browser_982656_restore_defaults_builtin_widgets.js]
deleted file mode 100644
--- a/browser/components/customizableui/test/browser_943683_migration_test.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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 kWidgetId = "test-addonbar-migration";
-const kWidgetId2 = "test-addonbar-migration2";
-
-var addonbar = document.getElementById(CustomizableUI.AREA_ADDONBAR);
-var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
-
-var btn;
-var btn2;
-
-// Check we migrate normal stuff to the navbar
-add_task(async function() {
- btn = createDummyXULButton(kWidgetId, "Test");
- btn2 = createDummyXULButton(kWidgetId2, "Test2");
- addonbar.insertItem(btn.id);
- ok(btn.parentNode == navbar.customizationTarget, "Button should end up in navbar");
- let migrationArray = addonbar.getMigratedItems();
- is(migrationArray.length, 1, "Should have migrated 1 item");
- is(migrationArray[0], kWidgetId, "Should have migrated our 1 item");
-
- addonbar.currentSet = addonbar.currentSet + "," + kWidgetId2;
- ok(btn2.parentNode == navbar.customizationTarget, "Second button should end up in the navbar");
- migrationArray = addonbar.getMigratedItems();
- is(migrationArray.length, 2, "Should have migrated 2 items");
- isnot(migrationArray.indexOf(kWidgetId2), -1, "Should have migrated our second item");
-
- let otherWindow = await openAndLoadWindow(undefined, true);
- try {
- let addonBar = otherWindow.document.getElementById("addon-bar");
- let otherMigrationArray = addonBar.getMigratedItems();
- is(migrationArray.length, otherMigrationArray.length,
- "Other window should have the same number of migrated items.");
- if (migrationArray.length == otherMigrationArray.length) {
- for (let widget of migrationArray) {
- isnot(otherMigrationArray.indexOf(widget), -1,
- "Migrated widget " + widget + " should also be listed as migrated in the other window.");
- }
- }
- } finally {
- await promiseWindowClosed(otherWindow);
- }
- btn.remove();
- btn2.remove();
- CustomizableUI.reset();
-});
deleted file mode 100644
--- a/browser/components/customizableui/test/browser_973932_addonbar_currentset.js
+++ /dev/null
@@ -1,30 +0,0 @@
-/* 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";
-
-var addonbarID = CustomizableUI.AREA_ADDONBAR;
-var addonbar = document.getElementById(addonbarID);
-
-// Check that currentset is correctly updated after a reset:
-add_task(async function() {
- let placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
- is(placements.join(","), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements");
- ok(CustomizableUI.inDefaultState, "Should be in default state");
- info("Adding a spring to add-on bar shim");
- CustomizableUI.addWidgetToArea("spring", addonbarID, 1);
- ok(addonbar.getElementsByTagName("toolbarspring").length, "There should be a spring in the toolbar");
- ok(!CustomizableUI.inDefaultState, "Should no longer be in default state");
- placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
- is(placements.join(","), addonbar.getAttribute("currentset"), "Addon-bar currentset should match placements after spring addition");
-
- await startCustomizing();
- await gCustomizeMode.reset();
- ok(CustomizableUI.inDefaultState, "Should be in default state after reset");
- placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
- is(placements.join(","), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements after reset");
- ok(!addonbar.getElementsByTagName("toolbarspring").length, "There should be no spring in the toolbar");
- await endCustomizing();
-});
-
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -1786,17 +1786,17 @@ BrowserGlue.prototype = {
xulStore.setValue(BROWSER_DOCURL, "nav-bar", "currentset", currentset);
}
}
}
if (currentUIVersion < 18) {
// Remove iconsize and mode from all the toolbars
let toolbars = ["navigator-toolbox", "nav-bar", "PersonalToolbar",
- "addon-bar", "TabsToolbar", "toolbar-menubar"];
+ "TabsToolbar", "toolbar-menubar"];
for (let resourceName of ["mode", "iconsize"]) {
for (let toolbarId of toolbars) {
xulStore.removeValue(BROWSER_DOCURL, toolbarId, resourceName);
}
}
}
if (currentUIVersion < 19) {
@@ -1967,17 +1967,17 @@ BrowserGlue.prototype = {
if (currentUIVersion < 38) {
LoginHelper.removeLegacySignonFiles();
}
if (currentUIVersion < 39) {
// Remove the 'defaultset' value for all the toolbars
let toolbars = ["nav-bar", "PersonalToolbar",
- "addon-bar", "TabsToolbar", "toolbar-menubar"];
+ "TabsToolbar", "toolbar-menubar"];
for (let toolbarId of toolbars) {
xulStore.removeValue(BROWSER_DOCURL, toolbarId, "defaultset");
}
}
if (currentUIVersion < 40) {
const kOldSafeBrowsingPref = "browser.safebrowsing.enabled";
// Default value is set to true, a user pref means that the pref was
--- a/browser/themes/osx/browser.css
+++ b/browser/themes/osx/browser.css
@@ -136,17 +136,17 @@
border-top: 1px solid rgba(0,0,0,0.65);
}
#navigator-toolbox > toolbar:not(#TabsToolbar) {
-moz-appearance: none;
background: var(--toolbar-bgcolor);
}
-#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar):not(#addon-bar) {
+#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar) {
/* add extra padding to compensate the bottom border */
padding-bottom: 2px;
}
/* Draw the bottom border of the tabs toolbar when it's not using
-moz-appearance: toolbar. */
#main-window:-moz-any([sizemode="fullscreen"],[customize-entered]) #TabsToolbar:not([collapsed="true"]) + #nav-bar,
#main-window:not([tabsintitlebar]) #TabsToolbar:not([collapsed="true"]) + #nav-bar,
--- a/browser/themes/shared/browser.inc.css
+++ b/browser/themes/shared/browser.inc.css
@@ -13,24 +13,24 @@
%endif
{
padding-inline-start: 40px;
}
%endif
/* Bookmark toolbar */
-#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar):not(#addon-bar) {
+#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar) {
overflow: -moz-hidden-unscrollable;
max-height: 4em;
transition: min-height 170ms ease-out, max-height 170ms ease-out;
padding: 0 4px 1px;
}
-#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar):not(#addon-bar)[collapsed=true] {
+#navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(#nav-bar)[collapsed=true] {
min-height: 0.1px;
max-height: 0;
transition: min-height 170ms ease-out, max-height 170ms ease-out, visibility 170ms linear;
}
/* Go button */
.urlbar-go-button {
padding: 0 3px;