Bug 1387081 - stop re-adding the sidebar button to the toolbar now that it's there by default, r=mixedpuppy
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 08 Nov 2017 18:01:53 +0100
changeset 444065 1f5043322c8899aeef2b84f4ea76453f878caaf9
parent 444064 dcf4f46ab589f77392b9a5e867c8cdc2fff99290
child 444066 3bc3d8b72947475088c68e358a70053b859e267c
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmixedpuppy
bugs1387081
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1387081 - stop re-adding the sidebar button to the toolbar now that it's there by default, r=mixedpuppy MozReview-Commit-ID: 9e1eFaVltMO
browser/components/extensions/ext-sidebarAction.js
browser/components/extensions/test/browser/browser_ext_sidebarAction.js
--- a/browser/components/extensions/ext-sidebarAction.js
+++ b/browser/components/extensions/ext-sidebarAction.js
@@ -136,26 +136,16 @@ this.sidebarAction = class extends Exten
     let install = this.extension.startupReason === "ADDON_INSTALL";
     for (let window of windowTracker.browserWindows()) {
       this.updateWindow(window);
       let {SidebarUI} = window;
       if (install || SidebarUI.lastOpenedId == this.id) {
         SidebarUI.show(this.id);
       }
     }
-
-    if (install && !Services.prefs.prefHasUserValue("extensions.sidebar-button.shown")) {
-      Services.prefs.setBoolPref("extensions.sidebar-button.shown", true);
-      // If the sidebar button has never been moved to the toolbar, move it now
-      // so the user can see/access the sidebars.
-      let widget = CustomizableUI.getWidget("sidebar-button");
-      if (!widget.areaType) {
-        CustomizableUI.addWidgetToArea("sidebar-button", CustomizableUI.AREA_NAVBAR, 0);
-      }
-    }
   }
 
   sidebarUrl(panel) {
     let url = `${sidebarURL}?panel=${encodeURIComponent(panel)}`;
 
     if (this.extension.remote) {
       url += "&remote=1";
     }
--- a/browser/components/extensions/test/browser/browser_ext_sidebarAction.js
+++ b/browser/components/extensions/test/browser/browser_ext_sidebarAction.js
@@ -46,37 +46,29 @@ let extData = {
 
 add_task(async function sidebar_initial_install() {
   ok(document.getElementById("sidebar-box").hidden, "sidebar box is not visible");
   let extension = ExtensionTestUtils.loadExtension(extData);
   await extension.startup();
   // Test sidebar is opened on install
   await extension.awaitMessage("sidebar");
   ok(!document.getElementById("sidebar-box").hidden, "sidebar box is visible");
-  // Test toolbar button is available
-  ok(document.getElementById("sidebar-button"), "sidebar button is in UI");
 
   await extension.unload();
   // Test that the sidebar was closed on unload.
   ok(document.getElementById("sidebar-box").hidden, "sidebar box is not visible");
-
-  // Move toolbar button back to customization.
-  CustomizableUI.removeWidgetFromArea("sidebar-button", CustomizableUI.AREA_NAVBAR);
-  ok(!document.getElementById("sidebar-button"), "sidebar button is not in UI");
 });
 
 
 add_task(async function sidebar_two_sidebar_addons() {
   let extension2 = ExtensionTestUtils.loadExtension(extData);
   await extension2.startup();
   // Test sidebar is opened on install
   await extension2.awaitMessage("sidebar");
   ok(!document.getElementById("sidebar-box").hidden, "sidebar box is visible");
-  // Test toolbar button is NOT available after first install
-  ok(!document.getElementById("sidebar-button"), "sidebar button is not in UI");
 
   // Test second sidebar install opens new sidebar
   let extension3 = ExtensionTestUtils.loadExtension(extData);
   await extension3.startup();
   // Test sidebar is opened on install
   await extension3.awaitMessage("sidebar");
   ok(!document.getElementById("sidebar-box").hidden, "sidebar box is visible");
   await extension3.unload();
@@ -92,13 +84,8 @@ add_task(async function sidebar_empty_pa
   await extension.startup();
   // Test sidebar is opened on install
   await extension.awaitMessage("sidebar");
   ok(!document.getElementById("sidebar-box").hidden, "sidebar box is visible in first window");
   extension.sendMessage("set-panel");
   await extension.awaitFinish();
   await extension.unload();
 });
-
-add_task(async function cleanup() {
-  // This is set on initial sidebar install.
-  Services.prefs.clearUserPref("extensions.sidebar-button.shown");
-});