Bug 1528219 - Display explicit non-backward message when trying to connect from 67 to older version r=daisuke,loganfsmyth
authorJulian Descottes <jdescottes@mozilla.com>
Sat, 09 Mar 2019 00:59:03 +0000
changeset 521215 3e43e15218d9
parent 521214 835fc236080c
child 521216 8e4f92791cd3
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaisuke, loganfsmyth
bugs1528219
milestone67.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 1528219 - Display explicit non-backward message when trying to connect from 67 to older version r=daisuke,loganfsmyth Differential Revision: https://phabricator.services.mozilla.com/D19939
devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js
devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js
devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl
devtools/client/accessibility/accessibility-startup.js
devtools/client/locales/en-US/webide.properties
devtools/client/shared/remote-debugging/test/unit/test_version_checker.js
devtools/client/shared/remote-debugging/version-checker.js
devtools/client/webide/content/webide.js
--- a/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js
+++ b/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js
@@ -29,24 +29,31 @@ class CompatibilityWarning extends PureC
   render() {
     const { localID, localVersion, minVersion, runtimeID, runtimeVersion, status } =
       this.props.compatibilityReport;
 
     if (status === COMPATIBILITY_STATUS.COMPATIBLE) {
       return null;
     }
 
-    const isTooOld = status === COMPATIBILITY_STATUS.TOO_OLD;
-    const localizationId = isTooOld ?
-      "about-debugging-runtime-version-too-old" :
-      "about-debugging-runtime-version-too-recent";
-
-    const statusClassName = isTooOld ?
-      "js-compatibility-warning-too-old" :
-      "js-compatibility-warning-too-recent";
+    let localizationId, statusClassName;
+    switch (status) {
+      case COMPATIBILITY_STATUS.TOO_OLD:
+        statusClassName = "js-compatibility-warning-too-old";
+        localizationId = "about-debugging-runtime-version-too-old";
+        break;
+      case COMPATIBILITY_STATUS.TOO_RECENT:
+        statusClassName = "js-compatibility-warning-too-recent";
+        localizationId = "about-debugging-runtime-version-too-recent";
+        break;
+      case COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER:
+        statusClassName = "js-compatibility-warning-too-old-67-debugger";
+        localizationId = "about-debugging-runtime-version-too-old-67-debugger";
+        break;
+    }
 
     return Message(
       {
         level: MESSAGE_LEVEL.WARNING,
       },
       Localized(
         {
           id: localizationId,
--- a/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js
+++ b/devtools/client/aboutdebugging-new/test/browser/browser_aboutdebugging_runtime_compatibility_warning.js
@@ -2,53 +2,63 @@
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
 const COMPATIBLE_RUNTIME = "Compatible Runtime";
 const COMPATIBLE_DEVICE = "Compatible Device";
 const OLD_RUNTIME = "Old Runtime";
 const OLD_DEVICE = "Old Device";
+const DEBUGGER_67_RUNTIME = "Bad Runtime Debugger 67";
+const DEBUGGER_67_DEVICE = "Bad Device Debugger 67";
 const RECENT_RUNTIME = "Recent Runtime";
 const RECENT_DEVICE = "Recent Device";
 
 add_task(async function() {
   const { COMPATIBILITY_STATUS } =
         require("devtools/client/shared/remote-debugging/version-checker");
-  const { COMPATIBLE, TOO_OLD, TOO_RECENT } = COMPATIBILITY_STATUS;
+  const { COMPATIBLE, TOO_OLD, TOO_OLD_67_DEBUGGER, TOO_RECENT } = COMPATIBILITY_STATUS;
 
-  info("Create three mocked runtimes, with different compatibility reports");
+  info("Create several mocked runtimes, with different compatibility reports");
   const mocks = new Mocks();
   createRuntimeWithReport(mocks, COMPATIBLE_RUNTIME, COMPATIBLE_DEVICE, COMPATIBLE);
   createRuntimeWithReport(mocks, OLD_RUNTIME, OLD_DEVICE, TOO_OLD);
   createRuntimeWithReport(mocks, RECENT_RUNTIME, RECENT_DEVICE, TOO_RECENT);
+  createRuntimeWithReport(mocks, DEBUGGER_67_RUNTIME, DEBUGGER_67_DEVICE,
+    TOO_OLD_67_DEBUGGER);
 
   const { document, tab } = await openAboutDebugging();
   mocks.emitUSBUpdate();
 
   info("Connect to all runtimes");
   await connectToRuntime(COMPATIBLE_DEVICE, document);
   await connectToRuntime(OLD_DEVICE, document);
   await connectToRuntime(RECENT_DEVICE, document);
+  await connectToRuntime(DEBUGGER_67_DEVICE, document);
 
   info("Select the compatible runtime and check that no warning is displayed");
   await selectRuntime(COMPATIBLE_DEVICE, COMPATIBLE_RUNTIME, document);
   ok(!document.querySelector(".js-compatibility-warning"),
     "Compatibility warning is not displayed");
 
   info("Select the old runtime and check that the too-old warning is displayed");
   await selectRuntime(OLD_DEVICE, OLD_RUNTIME, document);
   ok(document.querySelector(".js-compatibility-warning-too-old"),
     "Expected compatibility warning is displayed (too-old)");
 
   info("Select the recent runtime and check that the too-recent warning is displayed");
   await selectRuntime(RECENT_DEVICE, RECENT_RUNTIME, document);
   ok(document.querySelector(".js-compatibility-warning-too-recent"),
     "Expected compatibility warning is displayed (too-recent)");
 
+  info("Select the runtime incompatible with Fx 67 " +
+    "and check that the debugger 67 warning is displayed");
+  await selectRuntime(DEBUGGER_67_DEVICE, DEBUGGER_67_RUNTIME, document);
+  ok(document.querySelector(".js-compatibility-warning-too-old-67-debugger"));
+
   await removeTab(tab);
 });
 
 function createRuntimeWithReport(mocks, name, deviceName, status) {
   const runtimeId = [name, deviceName].join("-");
   const compatibleUsbClient = mocks.createUSBRuntime(runtimeId, { deviceName, name });
   const report = { status };
   compatibleUsbClient.checkVersionCompatibility = () => report;
--- a/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl
+++ b/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl
@@ -136,16 +136,24 @@ about-debugging-runtime-profile-button =
 about-debugging-runtime-service-workers-not-compatible = Your browser configuration is not compatible with Service Workers. <a>Learn more</a>
 
 # This string is displayed in the runtime page if the remote runtime version is too old.
 # "Troubleshooting" link points to https://developer.mozilla.org/docs/Tools/WebIDE/Troubleshooting
 # { $runtimeVersion } is the version of the remote runtime (for instance "67.0a1")
 # { $minVersion } is the minimum version that is compatible with the current Firefox instance (same format)
 about-debugging-runtime-version-too-old = The connected runtime has an old version ({ $runtimeVersion }). The minimum supported version is ({ $minVersion }). This is an unsupported setup and may cause DevTools to fail. Please update the connected runtime. <a>Troubleshooting</a>
 
+# Dedicated message 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).
+# { $runtimeVersion } is the version of the remote runtime (for instance "67.0a1")
+about-debugging-runtime-version-too-old-67-debugger = The Debugger panel may not work with the connected runtime. Please use Firefox { $runtimeVersion } if you need to use the Debugger with this runtime.
+
 # This string is displayed in the runtime page if the remote runtime version is too recent.
 # "Troubleshooting" link points to https://developer.mozilla.org/en-US/docs/Tools/WebIDE/Troubleshooting
 # { $runtimeID } is the build ID of the remote runtime (for instance "20181231", format is yyyyMMdd)
 # { $localID } is the build ID of the current Firefox instance (same format)
 # { $runtimeVersion } is the version of the remote runtime (for instance "67.0a1")
 # { $localVersion } is the version of your current runtime (same format)
 about-debugging-runtime-version-too-recent = The connected runtime is more recent ({ $runtimeVersion }, buildID { $runtimeID }) than your desktop Firefox ({ $localVersion }, buildID { $localID }). This is an unsupported setup and may cause DevTools to fail. Please update Firefox. <a>Troubleshooting</a>
 
--- a/devtools/client/accessibility/accessibility-startup.js
+++ b/devtools/client/accessibility/accessibility-startup.js
@@ -41,17 +41,16 @@ class AccessibilityStartup {
    *         the actor.
    */
   async prepareAccessibility() {
     // We must call a method on an accessibility front here (such as getWalker), in
     // oreder to be able to check actor's backward compatibility via actorHasMethod.
     // See targe.js@getActorDescription for more information.
     try {
       this._walker = await this._accessibility.getWalker();
-
       this._supports = {};
       // Only works with FF61+ targets
       this._supports.enableDisable =
         await this.target.actorHasMethod("accessibility", "enable");
 
       if (this._supports.enableDisable) {
         ([
           this._supports.relations,
--- a/devtools/client/locales/en-US/webide.properties
+++ b/devtools/client/locales/en-US/webide.properties
@@ -46,16 +46,25 @@ error_appProjectsLoadFailed=Unable to load project list. This can occur if you’ve used this profile with a newer version of Firefox.
 error_folderCreationFailed=Unable to create project folder in the selected directory.
 
 # Variable: runtime app build ID (looks like this %Y%M%D format) and firefox build ID (same format)
 error_runtimeVersionTooRecent=The connected runtime has a more recent build date (%1$S) than your desktop Firefox (%2$S) does. This is an unsupported setup and may cause DevTools to fail. Please update Firefox.
 
 # Variable: runtime app version (looks like this 52.a3) and firefox version (same format)
 error_runtimeVersionTooOld=The connected runtime has an old version (%1$S). The minimum supported version is (%2$S). This is an unsupported setup and may cause DevTools to fail. Please update the connected runtime.
 
+# LOCALIZATION NOTE (error_runtimeVersionTooOld67Debugger): Dedicated message
+# 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.
+
 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/shared/remote-debugging/test/unit/test_version_checker.js
+++ b/devtools/client/shared/remote-debugging/test/unit/test_version_checker.js
@@ -76,16 +76,56 @@ const TEST_DATA = [
   {
     description: "same major version and build date out of range (+8 days)",
     localBuildId: "20190131000000",
     localVersion: "60.0",
     runtimeBuildId: "20190208000000",
     runtimeVersion: "60.0",
     expected: COMPATIBILITY_STATUS.TOO_RECENT,
   },
+  {
+    description: "debugger backward compatibility issue for 67 -> 66",
+    localBuildId: "20190131000000",
+    localVersion: "67.0",
+    runtimeBuildId: "20190131000000",
+    runtimeVersion: "66.0",
+    expected: COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER,
+  },
+  {
+    description: "debugger backward compatibility issue for 67 -> 65",
+    localBuildId: "20190131000000",
+    localVersion: "67.0",
+    runtimeBuildId: "20190131000000",
+    runtimeVersion: "65.0",
+    expected: COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER,
+  },
+  {
+    description: "debugger backward compatibility issue for 68 -> 66",
+    localBuildId: "20190131000000",
+    localVersion: "68.0",
+    runtimeBuildId: "20190131000000",
+    runtimeVersion: "66.0",
+    expected: COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER,
+  },
+  {
+    description: "regular compatibility issue for 67 -> 64 (not debugger-related)",
+    localBuildId: "20190131000000",
+    localVersion: "67.0",
+    runtimeBuildId: "20190131000000",
+    runtimeVersion: "64.0",
+    expected: COMPATIBILITY_STATUS.TOO_OLD,
+  },
+  {
+    description: "debugger backward compatibility error not raised for 68 -> 67",
+    localBuildId: "20190131000000",
+    localVersion: "68.0",
+    runtimeBuildId: "20190202000000",
+    runtimeVersion: "67.0",
+    expected: COMPATIBILITY_STATUS.COMPATIBLE,
+  },
 ];
 
 add_task(async function testVersionChecker() {
   for (const testData of TEST_DATA) {
     const localDescription = {
       appbuildid: testData.localBuildId,
       platformversion: testData.localVersion,
     };
--- a/devtools/client/shared/remote-debugging/version-checker.js
+++ b/devtools/client/shared/remote-debugging/version-checker.js
@@ -7,16 +7,17 @@
 const Services = require("Services");
 const {AppConstants} = require("resource://gre/modules/AppConstants.jsm");
 
 const MS_PER_DAY = 1000 * 60 * 60 * 24;
 
 const COMPATIBILITY_STATUS = {
   COMPATIBLE: "compatible",
   TOO_OLD: "too-old",
+  TOO_OLD_67_DEBUGGER: "too-old-67-debugger",
   TOO_RECENT: "too-recent",
 };
 exports.COMPATIBILITY_STATUS = COMPATIBILITY_STATUS;
 
 function getDateFromBuildID(buildID) {
   // Build IDs are a timestamp in the yyyyMMddHHmmss format.
   // Extract the year, month and day information.
   const fields = buildID.match(/(\d{4})(\d{2})(\d{2})/);
@@ -126,16 +127,18 @@ function _compareVersionCompatibility(lo
     status = COMPATIBILITY_STATUS.TOO_RECENT;
   } else if (isSameMajorVersion && runtimeDate - localDate > 7 * MS_PER_DAY) {
     // If both local and remote runtimes have the same major version, compare build dates.
     // This check is useful for Gecko developers as we might introduce breaking changes
     // within a Nightly cycle.
     // Still allow devices to be newer by up to a week. This accommodates those with local
     // device builds, since their devices will almost always be newer than the client.
     status = COMPATIBILITY_STATUS.TOO_RECENT;
+  } else if (localMajorVersion >= 67 && runtimeMajorVersion < 67) {
+    status = COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER;
   } else {
     status = COMPATIBILITY_STATUS.COMPATIBLE;
   }
 
   return {
     localID,
     localVersion,
     minVersion,
--- a/devtools/client/webide/content/webide.js
+++ b/devtools/client/webide/content/webide.js
@@ -746,16 +746,20 @@ var UI = {
       if (report.status == COMPATIBILITY_STATUS.TOO_RECENT) {
         this.reportError("error_runtimeVersionTooRecent", report.runtimeID,
           report.localID);
       }
       if (report.status == COMPATIBILITY_STATUS.TOO_OLD) {
         this.reportError("error_runtimeVersionTooOld", report.runtimeVersion,
           report.minVersion);
       }
+      if (report.status == COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER) {
+        this.reportError("error_runtimeVersionTooOld67Debugger",
+          report.runtimeVersion);
+      }
     }
   },
 
   /** ******** TOOLBOX **********/
 
   /**
    * There are many ways to close a toolbox:
    *   * Close button inside the toolbox