Bug 1373650. Unteach CustomizableUI about the Report Site Issue button. r=gijs draft
authorMike Taylor <miket@mozilla.com>
Fri, 04 Aug 2017 15:35:18 -0500
changeset 645006 391768c83b7b
parent 645005 8a392f910157
child 645007 89c2328491ff
push id73626
push userbmo:miket@mozilla.com
push dateFri, 11 Aug 2017 18:27:24 +0000
reviewersgijs
bugs1373650
milestone57.0a1
Bug 1373650. Unteach CustomizableUI about the Report Site Issue button. r=gijs MozReview-Commit-ID: BCXVJChZ0mt
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/test/browser_overflow_use_subviews.js
browser/components/customizableui/test/head.js
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -52,17 +52,17 @@ const kSubviewEvents = [
   "ViewShowing",
   "ViewHiding"
 ];
 
 /**
  * The current version. We can use this to auto-add new default widgets as necessary.
  * (would be const but isn't because of testing purposes)
  */
-var kVersion = 9;
+var kVersion = 10;
 
 /**
  * Buttons removed from built-ins by version they were removed. kVersion must be
  * bumped any time a new id is added to this. Use the button id as key, and
  * version the button is removed in as the value.  e.g. "pocket-button": 5
  */
 var ObsoleteBuiltinButtons = {
   "pocket-button": 6
@@ -370,21 +370,16 @@ var CustomizableUIInternal = {
       let showCharacterEncoding = Services.prefs.getComplexValue(
         "browser.menu.showCharacterEncoding",
         Ci.nsIPrefLocalizedString
       ).data;
       if (showCharacterEncoding == "true") {
         defaultPlacements.push("characterencoding-button");
       }
 
-      if (AppConstants.MOZ_DEV_EDITION || AppConstants.NIGHTLY_BUILD) {
-        if (Services.prefs.getBoolPref("extensions.webcompat-reporter.enabled")) {
-          defaultPlacements.push("webcompat-reporter-button");
-        }
-      }
       savedPanelPlacements = savedPanelPlacements.filter(id => defaultPlacements.includes(id));
       if (savedPanelPlacements.length) {
         gSavedState.placements[this.AREA_FIXED_OVERFLOW_PANEL] = savedPanelPlacements;
       }
     }
 
     if (currentVersion < 9 && gSavedState.placements && gSavedState.placements["nav-bar"]) {
       let placements = gSavedState.placements["nav-bar"];
@@ -414,16 +409,25 @@ var CustomizableUIInternal = {
       if (placements.includes("bookmarks-menu-button")) {
         let bmbIndex = placements.indexOf("bookmarks-menu-button");
         placements.splice(bmbIndex, 1);
         let downloadButtonIndex = placements.indexOf("downloads-button");
         let libraryIndex = downloadButtonIndex == -1 ? bmbIndex : (downloadButtonIndex + 1);
         placements.splice(libraryIndex, 0, "library-button");
       }
     }
+
+    if (currentVersion < 10 && gSavedState && gSavedState.placements) {
+      for (let placements of Object.values(gSavedState.placements)) {
+        if (placements.includes("webcompat-reporter-button")) {
+          placements.splice(placements.indexOf("webcompat-reporter-button"), 1);
+          break;
+        }
+      }
+    }
   },
 
   /**
    * _markObsoleteBuiltinButtonsSeen
    * when upgrading, ensure obsoleted buttons are in seen state.
    */
   _markObsoleteBuiltinButtonsSeen() {
     if (!gSavedState)
--- a/browser/components/customizableui/test/browser_overflow_use_subviews.js
+++ b/browser/components/customizableui/test/browser_overflow_use_subviews.js
@@ -15,20 +15,16 @@ registerCleanupFunction(async function()
  * re-anchored panels. If we ever remove the developer widget, please
  * replace this test with another subview - don't remove it.
  */
 add_task(async function check_developer_subview_in_overflow() {
   kOverflowPanel.setAttribute("animate", "false");
   gOriginalWidth = window.outerWidth;
 
   CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR);
-  if (isNotReleaseOrBeta()) {
-    CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_NAVBAR);
-  }
-
 
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   window.resizeTo(400, window.outerHeight);
 
   await waitForCondition(() => navbar.hasAttribute("overflowing"));
 
   let chevron = document.getElementById("nav-bar-overflow-button");
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -113,48 +113,28 @@ function getToolboxCustomToolbarId(toolb
 function resetCustomization() {
   return CustomizableUI.reset();
 }
 
 function isInDevEdition() {
   return AppConstants.MOZ_DEV_EDITION;
 }
 
-function isInNightly() {
-  return AppConstants.NIGHTLY_BUILD;
-}
-
-function isNotReleaseOrBeta() {
-  return (isInDevEdition() || isInNightly());
-}
-
 function removeNonReleaseButtons(areaPanelPlacements) {
   if (isInDevEdition() && areaPanelPlacements.includes("developer-button")) {
     areaPanelPlacements.splice(areaPanelPlacements.indexOf("developer-button"), 1);
   }
-
-  if (AppConstants.RELEASE_OR_BETA && !AppConstants.MOZ_DEV_EDITION) {
-    if (areaPanelPlacements.includes("webcompat-reporter-button")) {
-      areaPanelPlacements.splice(areaPanelPlacements.indexOf("webcompat-reporter-button"), 1);
-    }
-  }
 }
 
 function removeNonOriginalButtons() {
   CustomizableUI.removeWidgetFromArea("sync-button");
-  if (isNotReleaseOrBeta()) {
-    CustomizableUI.removeWidgetFromArea("webcompat-reporter-button");
-  }
 }
 
 function restoreNonOriginalButtons() {
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
-  if (isNotReleaseOrBeta()) {
-    CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_PANEL);
-  }
 }
 
 function assertAreaPlacements(areaId, expectedPlacements) {
   let actualPlacements = getAreaWidgetIds(areaId);
   placementArraysEqual(areaId, actualPlacements, expectedPlacements);
 }
 
 function placementArraysEqual(areaId, actualPlacements, expectedPlacements) {