Bug 1538632 - Show a deprecation message inside of WebIDE;r=daisuke
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 10 Apr 2019 06:23:48 +0000
changeset 468727 473b3a558405d1d0661101909a17cb1c58208f40
parent 468726 f704b21e1ab590ed60b5372fb77c10c6cf6a0fc1
child 468728 3ca06a20dfac8a19479dc2653327d04cf579170c
push id35850
push userdvarga@mozilla.com
push dateWed, 10 Apr 2019 21:52:56 +0000
treeherdermozilla-central@9d3dbe3fef26 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke
bugs1538632
milestone68.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 1538632 - Show a deprecation message inside of WebIDE;r=daisuke Differential Revision: https://phabricator.services.mozilla.com/D26085
devtools/client/locales/en-US/webide.properties
devtools/client/webide/content/webide.js
devtools/client/webide/preferences/webide.js
--- a/devtools/client/locales/en-US/webide.properties
+++ b/devtools/client/locales/en-US/webide.properties
@@ -55,16 +55,24 @@ error_runtimeVersionTooOld=The connected
 # for a backward compatibility issue that occurs when connecting:
 # - from Fx 67 to 66 or to 65
 # - from Fx 68 to 66
 # Those are normally in range for DevTools compatibility policy, but specific non
 # backward compatible changes broke the debugger in those scenarios (Bug 1528219).
 # Variable: runtime app version (looks like this 52.a3)
 error_runtimeVersionTooOld67Debugger=The Debugger panel may not work with the connected runtime. Please use Firefox %S if you need to use the Debugger with this runtime.
 
+# LOCALIZATION NOTE (error_webIDEDeprecated): Text for the deprecation message displayed when starting WebIDE.
+error_webIDEDeprecated=WebIDE will be disabled in release 69. Remote debugging is now available in about:debugging.
+
+# LOCALIZATION NOTE (notification_openAboutDebugging): Text for a button displayed in the deprecation message for WebIDE.
+# Clicking on the button will open a tab on about:debugging.
+notification_openAboutDebugging.label=Open about:debugging
+notification_openAboutDebugging.accesskey=O
+
 addons_stable=stable
 addons_unstable=unstable
 addons_install_button=install
 addons_uninstall_button=uninstall
 addons_adb_warning=USB devices won’t be detected without this add-on
 addons_status_unknown=?
 addons_status_installed=Installed
 addons_status_uninstalled=Not Installed
--- a/devtools/client/webide/content/webide.js
+++ b/devtools/client/webide/content/webide.js
@@ -62,20 +62,27 @@ window.addEventListener("unload", functi
 var UI = {
   init: function() {
     this._telemetry = new Telemetry();
 
     // webide is not connected with a toolbox so we pass -1 as the
     // toolbox session id.
     this._telemetry.toolOpened("webide", -1, this);
 
-    this.notificationBox = new window.MozElements.NotificationBox(element => {
-      document.getElementById("containerbox")
-              .insertAdjacentElement("afterbegin", element);
-    });
+    function createNotificationBox() {
+      return new window.MozElements.NotificationBox(element => {
+        document.getElementById("containerbox")
+                .insertAdjacentElement("afterbegin", element);
+      });
+    }
+    // Create two distinct NotificationBox to be able to show the deprecation message and
+    // the error messages simultaneously.
+    this.notificationBox = createNotificationBox();
+    this.deprecationBox = createNotificationBox();
+
     AppManager.init();
 
     this.appManagerUpdate = this.appManagerUpdate.bind(this);
     AppManager.on("app-manager-update", this.appManagerUpdate);
 
     Cmds.showProjectPanel();
     Cmds.showRuntimePanel();
 
@@ -103,16 +110,21 @@ var UI = {
 
     Services.prefs.setBoolPref("devtools.webide.autoinstallADBExtension", false);
 
     this.setupDeck();
 
     this.contentViewer = window.docShell.contentViewer;
     this.contentViewer.fullZoom = Services.prefs.getCharPref("devtools.webide.zoom");
 
+    // Show a deprecation message to encourage users to open the new Remote Debugging
+    if (Services.prefs.getBoolPref("devtools.webide.showDeprecationMessage", false)) {
+      this.showDeprecationMessage();
+    }
+
     gDevToolsBrowser.isWebIDEInitialized.resolve();
   },
 
   destroy: function() {
     window.removeEventListener("focus", this.onfocus, true);
     AppManager.off("app-manager-update", this.appManagerUpdate);
     AppManager.destroy();
     this.updateConnectionTelemetry();
@@ -297,17 +309,34 @@ var UI = {
       callback: function() {
         Cmds.showTroubleShooting();
       },
     }];
 
     const nbox = this.notificationBox;
     nbox.removeAllNotifications(true);
     nbox.appendNotification(text, "webide:errornotification", null,
-                            nbox.PRIORITY_WARNING_LOW, buttons);
+      nbox.PRIORITY_WARNING_LOW, buttons);
+  },
+
+  showDeprecationMessage: function() {
+    const text = Strings.GetStringFromName("error_webIDEDeprecated");
+    const buttons = [{
+      label: Strings.GetStringFromName("notification_openAboutDebugging.label"),
+      accessKey: Strings.GetStringFromName("notification_openAboutDebugging.accesskey"),
+      callback: function() {
+        const { openTrustedLink } = require("devtools/client/shared/link");
+        openTrustedLink("about:debugging");
+      },
+    }];
+
+    const nbox = this.deprecationBox;
+    nbox.removeAllNotifications(true);
+    nbox.appendNotification(text, "webide:deprecationnotification", null,
+      nbox.PRIORITY_WARNING_LOW, buttons);
   },
 
   dismissErrorNotification: function() {
     this.notificationBox.removeAllNotifications(true);
   },
 
   /** ******** COMMANDS **********/
 
--- a/devtools/client/webide/preferences/webide.js
+++ b/devtools/client/webide/preferences/webide.js
@@ -6,8 +6,11 @@ pref("devtools.webide.templatesURL", "ht
 pref("devtools.webide.autoinstallADBExtension", true);
 pref("devtools.webide.autoConnectRuntime", true);
 pref("devtools.webide.restoreLastProject", true);
 pref("devtools.webide.enableLocalRuntime", false);
 pref("devtools.webide.lastConnectedRuntime", "");
 pref("devtools.webide.lastSelectedProject", "");
 pref("devtools.webide.zoom", "1");
 pref("devtools.webide.busyTimeout", 10000);
+
+// Show a deprecation message when starting WebIDE.
+pref("devtools.webide.showDeprecationMessage", true);