From 6fef20e42676886d5e136150e83a8e10b9736140 Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Sat, 9 Mar 2019 00:59:03 +0000 Subject: [PATCH] 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 --HG-- extra : moz-landing-system : lando --- .../src/components/CompatibilityWarning.js | 23 +++++++---- ...debugging_runtime_compatibility_warning.js | 14 ++++++- .../tmp-locale/en-US/aboutdebugging.notftl | 8 ++++ .../accessibility/accessibility-startup.js | 1 - .../client/locales/en-US/webide.properties | 9 +++++ .../test/unit/test_version_checker.js | 40 +++++++++++++++++++ .../remote-debugging/version-checker.js | 3 ++ devtools/client/webide/content/webide.js | 4 ++ 8 files changed, 91 insertions(+), 11 deletions(-) diff --git a/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js b/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js index ce8911f80069..a53046d417a4 100644 --- a/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js +++ b/devtools/client/aboutdebugging-new/src/components/CompatibilityWarning.js @@ -34,14 +34,21 @@ class CompatibilityWarning extends PureComponent { 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( { diff --git 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 index 77669ea2ae8b..28240ea03d5c 100644 --- 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 @@ -7,19 +7,23 @@ 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(); @@ -28,6 +32,7 @@ add_task(async function() { 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); @@ -44,6 +49,11 @@ add_task(async function() { 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); }); diff --git a/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl b/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl index a0e5b2adcb4b..c187249dc7e0 100644 --- a/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl +++ b/devtools/client/aboutdebugging-new/tmp-locale/en-US/aboutdebugging.notftl @@ -141,6 +141,14 @@ about-debugging-runtime-service-workers-not-compatible = Your browser configurat # { $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. Troubleshooting +# 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) diff --git a/devtools/client/accessibility/accessibility-startup.js b/devtools/client/accessibility/accessibility-startup.js index 665130f85ace..7a86f168162d 100644 --- a/devtools/client/accessibility/accessibility-startup.js +++ b/devtools/client/accessibility/accessibility-startup.js @@ -46,7 +46,6 @@ class AccessibilityStartup { // See targe.js@getActorDescription for more information. try { this._walker = await this._accessibility.getWalker(); - this._supports = {}; // Only works with FF61+ targets this._supports.enableDisable = diff --git a/devtools/client/locales/en-US/webide.properties b/devtools/client/locales/en-US/webide.properties index 0a125a100255..2b8017691909 100644 --- a/devtools/client/locales/en-US/webide.properties +++ b/devtools/client/locales/en-US/webide.properties @@ -51,6 +51,15 @@ error_runtimeVersionTooRecent=The connected runtime has a more recent build date # 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 diff --git a/devtools/client/shared/remote-debugging/test/unit/test_version_checker.js b/devtools/client/shared/remote-debugging/test/unit/test_version_checker.js index ca99f1e70d0a..4879ba20ffd1 100644 --- a/devtools/client/shared/remote-debugging/test/unit/test_version_checker.js +++ b/devtools/client/shared/remote-debugging/test/unit/test_version_checker.js @@ -81,6 +81,46 @@ const TEST_DATA = [ 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() { diff --git a/devtools/client/shared/remote-debugging/version-checker.js b/devtools/client/shared/remote-debugging/version-checker.js index 44879a5ace3d..fb03558cf5ec 100644 --- a/devtools/client/shared/remote-debugging/version-checker.js +++ b/devtools/client/shared/remote-debugging/version-checker.js @@ -12,6 +12,7 @@ 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; @@ -131,6 +132,8 @@ function _compareVersionCompatibility(localDescription, deviceDescription) { // 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; } diff --git a/devtools/client/webide/content/webide.js b/devtools/client/webide/content/webide.js index 8e0b96d66970..d5903709d822 100644 --- a/devtools/client/webide/content/webide.js +++ b/devtools/client/webide/content/webide.js @@ -751,6 +751,10 @@ var UI = { this.reportError("error_runtimeVersionTooOld", report.runtimeVersion, report.minVersion); } + if (report.status == COMPATIBILITY_STATUS.TOO_OLD_67_DEBUGGER) { + this.reportError("error_runtimeVersionTooOld67Debugger", + report.runtimeVersion); + } } },