Bug 1183962 - stop installing webide button in menu or navbar automatically;r=jryans
authorJulian Descottes <jdescottes@mozilla.com>
Tue, 02 May 2017 22:56:40 +0200
changeset 572031 03cfa568b94046e31d6d6dddd200cb9f60bb91cd
parent 572030 040f581bbbd9bc96fc4babf85000b586aeef92b9
child 572032 c14a5ab2c320fc099fd7f10374007ad72ba19cf8
child 573332 017bf37e4176c50db0153120375e91da861fb167
push id56986
push userbmo:tcampbell@mozilla.com
push dateWed, 03 May 2017 17:38:15 +0000
reviewersjryans
bugs1183962
milestone55.0a1
Bug 1183962 - stop installing webide button in menu or navbar automatically;r=jryans MozReview-Commit-ID: CACgml3Xijf
browser/components/customizableui/CustomizableUI.jsm
browser/components/uitour/UITour.jsm
browser/components/uitour/test/browser_UITour_availableTargets.js
devtools/client/framework/devtools-browser.js
devtools/client/framework/gDevTools.jsm
devtools/client/webide/content/webide.js
devtools/client/webide/moz.build
devtools/client/webide/test/browser.ini
devtools/client/webide/test/browser_widget.js
devtools/client/webide/test/head.js
devtools/client/webide/webide-prefs.js
testing/talos/talos/config.py
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -33,17 +33,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
 const kSpecialWidgetPfx = "customizableui-special-";
 
 const kPrefCustomizationState        = "browser.uiCustomization.state";
 const kPrefCustomizationAutoAdd      = "browser.uiCustomization.autoAdd";
 const kPrefCustomizationDebug        = "browser.uiCustomization.debug";
 const kPrefDrawInTitlebar            = "browser.tabs.drawInTitlebar";
-const kPrefWebIDEInNavbar            = "devtools.webide.widget.inNavbarByDefault";
 
 const kExpectedWindowURL = "chrome://browser/content/browser.xul";
 
 /**
  * The keys are the handlers that are fired when the event type (the value)
  * is fired on the subview. A widget that provides a subview has the option
  * of providing onViewShowing and onViewHiding event handlers.
  */
@@ -248,20 +247,16 @@ var CustomizableUIInternal = {
       "downloads-button",
       "home-button",
     ];
 
     if (AppConstants.MOZ_DEV_EDITION) {
       navbarPlacements.splice(2, 0, "developer-button");
     }
 
-    if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) {
-      navbarPlacements.push("webide-button");
-    }
-
     // Place this last, when createWidget is called for pocket, it will
     // append to the toolbar.
     if (Services.prefs.getPrefType("extensions.pocket.enabled") != Services.prefs.PREF_INVALID &&
         Services.prefs.getBoolPref("extensions.pocket.enabled")) {
         navbarPlacements.push("pocket-button");
     }
 
     this.registerArea(CustomizableUI.AREA_NAVBAR, {
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -203,17 +203,16 @@ this.UITour = {
     }],
     ["trackingProtection", {
       query: "#tracking-protection-icon",
     }],
     ["urlbar",      {
       query: "#urlbar",
       widgetName: "urlbar-container",
     }],
-    ["webide",      {query: "#webide-button"}],
   ]),
 
   init() {
     log.debug("Initializing UITour");
     // Lazy getter is initialized here so it can be replicated any time
     // in a test.
     delete this.seenPageIDs;
     Object.defineProperty(this, "seenPageIDs", {
--- a/browser/components/uitour/test/browser_UITour_availableTargets.js
+++ b/browser/components/uitour/test/browser_UITour_availableTargets.js
@@ -1,15 +1,14 @@
 "use strict";
 
 var gTestTab;
 var gContentAPI;
 var gContentWindow;
 
-var hasWebIDE = Services.prefs.getBoolPref("devtools.webide.widget.enabled");
 var hasPocket = Services.prefs.getBoolPref("extensions.pocket.enabled");
 
 requestLongerTimeout(2);
 add_task(setup_UITourTest);
 
 add_UITour_task(function* test_availableTargets() {
   let data = yield getConfigurationPromise("availableTargets");
   ok_targets(data, [
@@ -25,17 +24,16 @@ add_UITour_task(function* test_available
       ...(hasPocket ? ["pocket"] : []),
     "privateWindow",
     "quit",
     "readerMode-urlBar",
     "search",
     "searchIcon",
     "trackingProtection",
     "urlbar",
-      ...(hasWebIDE ? ["webide"] : [])
   ]);
 
   ok(UITour.availableTargetsCache.has(window),
      "Targets should now be cached");
 });
 
 add_UITour_task(function* test_availableTargets_changeWidgets() {
   CustomizableUI.removeWidgetFromArea("bookmarks-menu-button");
@@ -54,17 +52,16 @@ add_UITour_task(function* test_available
       ...(hasPocket ? ["pocket"] : []),
     "privateWindow",
     "quit",
     "readerMode-urlBar",
     "search",
     "searchIcon",
     "trackingProtection",
     "urlbar",
-      ...(hasWebIDE ? ["webide"] : [])
   ]);
 
   ok(UITour.availableTargetsCache.has(window),
      "Targets should now be cached again");
   CustomizableUI.reset();
   ok(!UITour.availableTargetsCache.has(window),
      "Targets should not be cached after reset");
 });
@@ -86,17 +83,16 @@ add_UITour_task(function* test_available
     "home",
     "devtools",
       ...(hasPocket ? ["pocket"] : []),
     "privateWindow",
     "quit",
     "readerMode-urlBar",
     "trackingProtection",
     "urlbar",
-      ...(hasWebIDE ? ["webide"] : [])
   ]);
 
   CustomizableUI.reset();
 });
 
 function ok_targets(actualData, expectedTargets) {
   // Depending on how soon after page load this is called, the selected tab icon
   // may or may not be showing the loading throbber.  Check for its presence and
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -118,18 +118,17 @@ var gDevToolsBrowser = exports.gDevTools
     if (devToolbarEnabled && Services.prefs.getBoolPref("devtools.toolbar.visible")) {
       win.DeveloperToolbar.show(false).catch(console.error);
     }
 
     // Enable WebIDE?
     let webIDEEnabled = Services.prefs.getBoolPref("devtools.webide.enabled");
     toggleMenuItem("menu_webide", webIDEEnabled);
 
-    let showWebIDEWidget = Services.prefs.getBoolPref("devtools.webide.widget.enabled");
-    if (webIDEEnabled && showWebIDEWidget) {
+    if (webIDEEnabled) {
       gDevToolsBrowser.installWebIDEWidget();
     } else {
       gDevToolsBrowser.uninstallWebIDEWidget();
     }
 
     // Enable Browser Toolbox?
     let chromeEnabled = Services.prefs.getBoolPref("devtools.chrome.enabled");
     let devtoolsRemoteEnabled = Services.prefs.getBoolPref(
@@ -470,29 +469,21 @@ var gDevToolsBrowser = exports.gDevTools
    * Install WebIDE widget
    */
   // Used by itself
   installWebIDEWidget() {
     if (this.isWebIDEWidgetInstalled()) {
       return;
     }
 
-    let defaultArea;
-    if (Services.prefs.getBoolPref("devtools.webide.widget.inNavbarByDefault")) {
-      defaultArea = CustomizableUI.AREA_NAVBAR;
-    } else {
-      defaultArea = CustomizableUI.AREA_PANEL;
-    }
-
     CustomizableUI.createWidget({
       id: "webide-button",
       shortcutId: "key_webide",
       label: "devtools-webide-button2.label",
       tooltiptext: "devtools-webide-button2.tooltiptext",
-      defaultArea: defaultArea,
       onCommand(event) {
         gDevToolsBrowser.openWebIDE();
       }
     });
   },
 
   isWebIDEWidgetInstalled() {
     let widgetWrapper = CustomizableUI.getWidget("webide-button");
@@ -529,24 +520,16 @@ var gDevToolsBrowser = exports.gDevTools
   uninstallWebIDEWidget() {
     if (this.isWebIDEWidgetInstalled()) {
       CustomizableUI.removeWidgetFromArea("webide-button");
     }
     CustomizableUI.destroyWidget("webide-button");
   },
 
   /**
-   * Move WebIDE widget to the navbar
-   */
-   // Used by webide.js
-  moveWebIDEWidgetInNavbar() {
-    CustomizableUI.addWidgetToArea("webide-button", CustomizableUI.AREA_NAVBAR);
-  },
-
-  /**
    * Add this DevTools's presence to a browser window's document
    *
    * @param {XULDocument} doc
    *        The document to which devtools should be hooked to.
    */
   _registerBrowserWindow(win) {
     if (gDevToolsBrowser._trackedBrowserWindows.has(win)) {
       return;
--- a/devtools/client/framework/gDevTools.jsm
+++ b/devtools/client/framework/gDevTools.jsm
@@ -128,19 +128,16 @@ let gDevToolsBrowserMethods = [
 
   // Used by browser-sets.inc, command
   //         itself, webide widget
   "openWebIDE",
 
   // Used by browser-sets.inc, command
   "openContentProcessToolbox",
 
-  // Used by webide.js
-  "moveWebIDEWidgetInNavbar",
-
   // Used by browser.js
   "registerBrowserWindow",
 
   // Used by reload addon
   "hasToolboxOpened",
 
   // Used by browser.js
   "forgetBrowserWindow"
--- a/devtools/client/webide/content/webide.js
+++ b/devtools/client/webide/content/webide.js
@@ -101,22 +101,16 @@ var UI = {
     if (autoinstallFxdtAdapters) {
       GetAvailableAddons().then(addons => {
         addons.adapters.install();
       }, console.error);
     }
     Services.prefs.setBoolPref("devtools.webide.autoinstallADBHelper", false);
     Services.prefs.setBoolPref("devtools.webide.autoinstallFxdtAdapters", false);
 
-    if (Services.prefs.getBoolPref("devtools.webide.widget.autoinstall") &&
-        !Services.prefs.getBoolPref("devtools.webide.widget.enabled")) {
-      Services.prefs.setBoolPref("devtools.webide.widget.enabled", true);
-      gDevToolsBrowser.moveWebIDEWidgetInNavbar();
-    }
-
     this.setupDeck();
 
     this.contentViewer = window.QueryInterface(Ci.nsIInterfaceRequestor)
                                .getInterface(Ci.nsIWebNavigation)
                                .QueryInterface(Ci.nsIDocShell)
                                .contentViewer;
     this.contentViewer.fullZoom = Services.prefs.getCharPref("devtools.webide.zoom");
 
--- a/devtools/client/webide/moz.build
+++ b/devtools/client/webide/moz.build
@@ -13,14 +13,14 @@ DIRS += [
 
 BROWSER_CHROME_MANIFESTS += [
     'test/browser.ini'
 ]
 MOCHITEST_CHROME_MANIFESTS += [
     'test/chrome.ini'
 ]
 
-JS_PREFERENCE_PP_FILES += [
+JS_PREFERENCE_FILES += [
     'webide-prefs.js',
 ]
 
-with Files('**'):
-    BUG_COMPONENT = ('Firefox', 'Developer Tools: WebIDE')
+with Files('**'):
+    BUG_COMPONENT = ('Firefox', 'Developer Tools: WebIDE')
--- a/devtools/client/webide/test/browser.ini
+++ b/devtools/client/webide/test/browser.ini
@@ -4,9 +4,8 @@ subsuite = devtools
 support-files =
   addons/simulators.json
   doc_tabs.html
   head.js
   templates.json
 
 [browser_tabs.js]
 skip-if = e10s # Bug 1072167 - browser_tabs.js test fails under e10s
-[browser_widget.js]
deleted file mode 100644
--- a/devtools/client/webide/test/browser_widget.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-"use strict";
-
-function test() {
-  waitForExplicitFinish();
-  Task.spawn(function* () {
-    let win = yield openWebIDE();
-    ok(document.querySelector("#webide-button"), "Found WebIDE button");
-    Services.prefs.setBoolPref("devtools.webide.widget.enabled", false);
-    ok(!document.querySelector("#webide-button"), "WebIDE button uninstalled");
-    yield closeWebIDE(win);
-    Services.prefs.clearUserPref("devtools.webide.widget.enabled");
-  }).then(finish, handleError);
-}
--- a/devtools/client/webide/test/head.js
+++ b/devtools/client/webide/test/head.js
@@ -68,18 +68,16 @@ var openWebIDE = Task.async(function* (a
   return win;
 });
 
 function closeWebIDE(win) {
   info("Closing WebIDE");
 
   let deferred = promise.defer();
 
-  Services.prefs.clearUserPref("devtools.webide.widget.enabled");
-
   win.addEventListener("unload", function () {
     info("WebIDE closed");
     SimpleTest.executeSoon(() => {
       deferred.resolve();
     });
   }, {once: true});
 
   win.close();
--- a/devtools/client/webide/webide-prefs.js
+++ b/devtools/client/webide/webide-prefs.js
@@ -1,12 +1,11 @@
-# -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
-# 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/.
+/* 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/. */
 
 pref("devtools.webide.showProjectEditor", true);
 pref("devtools.webide.templatesURL", "https://code.cdn.mozilla.net/templates/list.json");
 pref("devtools.webide.autoinstallADBHelper", true);
 pref("devtools.webide.autoinstallFxdtAdapters", true);
 pref("devtools.webide.autoConnectRuntime", true);
 pref("devtools.webide.restoreLastProject", true);
 pref("devtools.webide.enableLocalRuntime", false);
@@ -17,19 +16,11 @@ pref("devtools.webide.simulatorAddonRegE
 pref("devtools.webide.adbAddonURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/fxos-simulator/adb-helper/#OS#/adbhelper-#OS#-latest.xpi");
 pref("devtools.webide.adbAddonID", "adbhelper@mozilla.org");
 pref("devtools.webide.adaptersAddonURL", "https://ftp.mozilla.org/pub/mozilla.org/labs/valence/#OS#/valence-#OS#-latest.xpi");
 pref("devtools.webide.adaptersAddonID", "fxdevtools-adapters@mozilla.org");
 pref("devtools.webide.monitorWebSocketURL", "ws://localhost:9000");
 pref("devtools.webide.lastConnectedRuntime", "");
 pref("devtools.webide.lastSelectedProject", "");
 pref("devtools.webide.logSimulatorOutput", false);
-pref("devtools.webide.widget.autoinstall", true);
-#ifdef MOZ_DEV_EDITION
-pref("devtools.webide.widget.enabled", true);
-pref("devtools.webide.widget.inNavbarByDefault", true);
-#else
-pref("devtools.webide.widget.enabled", false);
-pref("devtools.webide.widget.inNavbarByDefault", false);
-#endif
 pref("devtools.webide.zoom", "1");
 pref("devtools.webide.busyTimeout", 10000);
 pref("devtools.webide.autosaveFiles", true);
--- a/testing/talos/talos/config.py
+++ b/testing/talos/talos/config.py
@@ -170,18 +170,16 @@ DEFAULTS = dict(
         'browser.search.geoSpecificDefaults': False,
         'browser.snippets.enabled': False,
         'browser.snippets.syncPromo.enabled': False,
         'toolkit.telemetry.server': 'https://127.0.0.1/telemetry-dummy/',
         'experiments.manifest.uri':
             'https://127.0.0.1/experiments-dummy/manifest',
         'network.http.speculative-parallel-limit': 0,
         'lightweightThemes.selectedThemeID': "",
-        'devtools.webide.widget.enabled': False,
-        'devtools.webide.widget.inNavbarByDefault': False,
         'devtools.chrome.enabled': False,
         'devtools.debugger.remote-enabled': False,
         'devtools.theme': "light",
         'devtools.timeline.enabled': False,
         'identity.fxaccounts.migrateToDevEdition': False,
         'media.libavcodec.allow-obsolete': True
     }
 )