Bug 1373650. Unteach CustomizableUI about the Report Site Issue button. r=gijs draft
authorMike Taylor <miket@mozilla.com>
Thu, 03 Aug 2017 16:17:16 -0500
changeset 620763 0c3a8cce555e
parent 620762 aa59366e0428
child 640795 b9da2ba116a8
push id72142
push userbmo:miket@mozilla.com
push dateThu, 03 Aug 2017 21:26:11 +0000
reviewersgijs
bugs1373650
milestone57.0a1
Bug 1373650. Unteach CustomizableUI about the Report Site Issue button. r=gijs MozReview-Commit-ID: BGDIpD32sUi
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
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
@@ -228,22 +228,16 @@ var CustomizableUIInternal = {
     let showCharacterEncoding = Services.prefs.getComplexValue(
       "browser.menu.showCharacterEncoding",
       Ci.nsIPrefLocalizedString
     ).data;
     if (showCharacterEncoding == "true") {
       panelPlacements.push("characterencoding-button");
     }
 
-    if (AppConstants.MOZ_DEV_EDITION || AppConstants.NIGHTLY_BUILD) {
-      if (Services.prefs.getBoolPref("extensions.webcompat-reporter.enabled")) {
-        panelPlacements.push("webcompat-reporter-button");
-      }
-    }
-
     gDefaultPanelPlacements = panelPlacements;
     this._updateAreasForPhoton();
 
     let navbarPlacements = [
       "back-button",
       "forward-button",
       "stop-reload-button",
       "home-button",
--- a/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
+++ b/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
@@ -26,29 +26,26 @@ add_task(async function testWrapUnwrap()
 });
 
 // Creating and destroying a widget should correctly deal with panel placeholders
 add_task(async function testPanelPlaceholders() {
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   // The value of expectedPlaceholders depends on the default palette layout.
   // Bug 1229236 is for these tests to be smarter so the test doesn't need to
   // change when the default placements change.
-  let expectedPlaceholders = 1;
-  if (isInNightly()) {
-    expectedPlaceholders += 2;
-  }
+  let expectedPlaceholders = 1 + (isInDevEdition() ? 1 : 0);
   is(panel.querySelectorAll(".panel-customization-placeholder").length, expectedPlaceholders, "The number of placeholders should be correct.");
   CustomizableUI.createWidget({id: kTestWidget2, label: "Pretty label", tooltiptext: "Pretty tooltip", defaultArea: CustomizableUI.AREA_PANEL});
   let elem = document.getElementById(kTestWidget2);
   let wrapper = document.getElementById("wrapper-" + kTestWidget2);
   ok(elem, "There should be an item");
   ok(wrapper, "There should be a wrapper");
   is(wrapper.firstChild.id, kTestWidget2, "Wrapper should have test widget");
   is(wrapper.parentNode, panel, "Wrapper should be in panel");
-  expectedPlaceholders = (expectedPlaceholders - 1) || 3;
+  expectedPlaceholders = isInDevEdition() ? 1 : 3;
   is(panel.querySelectorAll(".panel-customization-placeholder").length, expectedPlaceholders, "The number of placeholders should be correct.");
   CustomizableUI.destroyWidget(kTestWidget2);
   wrapper = document.getElementById("wrapper-" + kTestWidget2);
   ok(!wrapper, "There should be a wrapper");
   let item = document.getElementById(kTestWidget2);
   ok(!item, "There should no longer be an item");
   await endCustomizing();
 });
--- a/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
+++ b/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
@@ -20,17 +20,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(zoomControls, printButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
@@ -49,17 +48,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(zoomControls, savePageButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(CustomizableUI.inDefaultState, "Should be in default state.");
 });
 
 
@@ -76,17 +74,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(zoomControls, newWindowButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the zoom controls to be before the history-panelmenu should move the zoom-controls in to the row higher than the history-panelmenu.
@@ -102,17 +99,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(zoomControls, historyPanelMenu);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
@@ -132,17 +128,16 @@ add_task(async function() {
                              "history-panelmenu",
                              "fullscreen-button",
                              "zoom-controls",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(zoomControls, preferencesButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
@@ -162,17 +157,16 @@ add_task(async function() {
                                "print-button",
                                "history-panelmenu",
                                "fullscreen-button",
                                "find-button",
                                "preferences-button",
                                "add-ons-button",
                                "developer-button",
                                "sync-button",
-                               "webcompat-reporter-button"
                               ];
   removeNonReleaseButtons(placementsAfterInsert);
   simulateItemDrag(openFileButton, zoomControls);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let palette = document.getElementById("customization-palette");
   // Check that the palette items are re-wrapped correctly.
   let feedWrapper = document.getElementById("wrapper-feed-button");
@@ -204,17 +198,16 @@ add_task(async function() {
                                "print-button",
                                "history-panelmenu",
                                "fullscreen-button",
                                "find-button",
                                "preferences-button",
                                "add-ons-button",
                                "developer-button",
                                "sync-button",
-                               "webcompat-reporter-button"
                               ];
   removeNonReleaseButtons(placementsAfterInsert);
   simulateItemDrag(openFileButton, editControls);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let palette = document.getElementById("customization-palette");
   // Check that the palette items are re-wrapped correctly.
   let feedWrapper = document.getElementById("wrapper-feed-button");
@@ -243,17 +236,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(editControls, zoomControls);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to be before the new-window-button should
@@ -270,17 +262,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(editControls, newWindowButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
@@ -300,17 +291,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(editControls, privateBrowsingButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
@@ -330,17 +320,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button"
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   simulateItemDrag(editControls, savePageButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
@@ -361,26 +350,20 @@ add_task(async function editControlsToPa
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "edit-controls",
                              "developer-button",
                              "sync-button",
                             ];
   removeNonReleaseButtons(placementsAfterMove);
-  if (isNotReleaseOrBeta()) {
-    CustomizableUI.removeWidgetFromArea("webcompat-reporter-button");
-  }
   simulateItemDrag(editControls, panel);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
-  if (isNotReleaseOrBeta()) {
-    CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_PANEL);
-  }
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to the customization-palette and
 // back should work.
 add_task(async function() {
   await startCustomizing();
   let editControls = document.getElementById("edit-controls");
@@ -392,17 +375,16 @@ add_task(async function() {
                              "print-button",
                              "history-panelmenu",
                              "fullscreen-button",
                              "find-button",
                              "preferences-button",
                              "add-ons-button",
                              "developer-button",
                              "sync-button",
-                             "webcompat-reporter-button",
                             ];
   removeNonReleaseButtons(placementsAfterMove);
   let paletteChildElementCount = palette.childElementCount;
   simulateItemDrag(editControls, palette);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   is(paletteChildElementCount + 1, palette.childElementCount,
      "The palette should have a new child, congratulations!");
   is(editControls.parentNode.id, "wrapper-edit-controls",
@@ -420,20 +402,20 @@ add_task(async function() {
 // should append the edit-controls to the bottom of the panel.
 add_task(async function editControlsToPanelPlaceholders() {
   await startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let numPlaceholders = 2;
   for (let i = 0; i < numPlaceholders; i++) {
     // This test relies on there being a specific number of widgets in the
-    // panel. The addition of sync-button and webcompat-reporter-button screwed
-    // this up, so we remove them here. We should either fix the tests to not
-    // rely on the specific layout, or fix bug 1007910 which would change the
-    // placeholder logic in different ways. Bug 1229236 is for these tests to
+    // panel. The addition of sync-button screws this up, so we remove it
+    // here. We should either fix the tests to not rely on the specific layout,
+    // or fix bug 1007910 which would change the placeholder logic in
+    // different ways. Bug 1229236 is for these tests to
     // be smarter.
     removeNonOriginalButtons();
     // NB: We can't just iterate over all of the placeholders
     // because each drag-drop action recreates them.
     let placeholder = panel.getElementsByClassName("panel-customization-placeholder")[i];
     let placementsAfterMove = ["zoom-controls",
                                "new-window-button",
                                "privatebrowsing-button",
@@ -470,19 +452,19 @@ add_task(async function() {
   is(editControls.parentNode.tagName, "toolbarpaletteitem",
      "edit-controls should be wrapped by a toolbarpaletteitem");
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging a small button onto the last big button should work.
 add_task(async function() {
   // Bug 1007910 requires there be a placeholder on the final row for this
-  // test to work as written. The addition of sync-button and
-  // webcompat-reporter-button meant that's not true so we remove them from
-  // here. Bug 1229236 is for these tests to be smarter.
+  // test to work as written. The addition of sync-button means
+  // that's not true so we remove them from here.
+  // Bug 1229236 is for these tests to be smarter.
   removeNonOriginalButtons();
   await startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let target = panel.getElementsByClassName("panel-customization-placeholder")[0];
   let placementsAfterMove = ["zoom-controls",
                              "new-window-button",
                              "privatebrowsing-button",
--- 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) {