Bug 1677660 - Remove backwards-compat methods from Compatibility front. r=jdescottes,daisuke,devtools-backward-compat-reviewers
authorMicah Tigley <mtigley@mozilla.com>
Wed, 18 Nov 2020 16:29:31 +0000
changeset 557847 c1dcc7b18ee75051b36b285840d1675e7a9c6662
parent 557846 df4bbb92b9728e9c5a4f803f1c6a2b13a922328c
child 557848 66abf4f4ce8b5cfdb188575d7c1c3980cbc8f144
push id37962
push userapavel@mozilla.com
push dateWed, 18 Nov 2020 21:51:58 +0000
treeherdermozilla-central@9d797387f57c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdescottes, daisuke, devtools-backward-compat-reviewers
bugs1677660
milestone85.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 1677660 - Remove backwards-compat methods from Compatibility front. r=jdescottes,daisuke,devtools-backward-compat-reviewers Differential Revision: https://phabricator.services.mozilla.com/D97248
devtools/client/fronts/compatibility.js
devtools/server/actors/compatibility/compatibility.js
devtools/shared/specs/compatibility.js
--- a/devtools/client/fronts/compatibility.js
+++ b/devtools/client/fronts/compatibility.js
@@ -5,64 +5,12 @@
 "use strict";
 
 const {
   FrontClassWithSpec,
   registerFront,
 } = require("devtools/shared/protocol");
 const { compatibilitySpec } = require("devtools/shared/specs/compatibility");
 
-const PREF_TARGET_BROWSERS = "devtools.inspector.compatibility.target-browsers";
-
-class CompatibilityFront extends FrontClassWithSpec(compatibilitySpec) {
-  constructor(client, targetFront, parentFront) {
-    super(client, targetFront, parentFront);
-    this.client = client;
-  }
-
-  async initialize() {
-    // Backward-compatibility: can be removed when FF81 is on the release
-    // channel. See 1659866.
-    const preferenceFront = await this.client.mainRoot.getFront("preference");
-    try {
-      await preferenceFront.getCharPref(PREF_TARGET_BROWSERS);
-    } catch (e) {
-      // If `getCharPref` failed, the preference is not set on the server (most
-      // likely Fenix). Set a default value, otherwise compatibility actor
-      // methods might throw.
-      await preferenceFront.setCharPref(PREF_TARGET_BROWSERS, "");
-    }
-  }
-
-  /*
-   * Backwards compatibility wrapper for getCSSDeclarationBlockIssues.
-   * This can be removed once FF82 hits the release channel
-   */
-  async _getTraits() {
-    if (!this._traits) {
-      try {
-        // From FF82+, getTraits() is supported
-        const { traits } = await super.getTraits();
-        this._traits = traits;
-      } catch (e) {
-        this._traits = {};
-      }
-    }
-
-    return this._traits;
-  }
-
-  /*
-   * Backwards compatibility wrapper for getCSSDeclarationBlockIssues.
-   * This can be removed once FF82 hits the release channel
-   */
-  async getCSSDeclarationBlockIssues(declarationBlock, targetBrowsers) {
-    const traits = await this._getTraits();
-    if (!traits.declarationBlockIssueComputationEnabled) {
-      return [];
-    }
-
-    return super.getCSSDeclarationBlockIssues(declarationBlock, targetBrowsers);
-  }
-}
+class CompatibilityFront extends FrontClassWithSpec(compatibilitySpec) {}
 
 exports.CompatibilityFront = CompatibilityFront;
 registerFront(CompatibilityFront);
--- a/devtools/server/actors/compatibility/compatibility.js
+++ b/devtools/server/actors/compatibility/compatibility.js
@@ -43,22 +43,17 @@ const CompatibilityActor = protocol.Acto
   form() {
     return {
       actor: this.actorID,
     };
   },
 
   getTraits() {
     return {
-      traits: {
-        // Indicates the function for compatibility check exists
-        // This is to preserve backwards compatibility and can be
-        // removed once FF82 hits release channel
-        declarationBlockIssueComputationEnabled: true,
-      },
+      traits: {},
     };
   },
 
   /**
    * Responsible for computing the compatibility issues for a given CSS declaration block
    * @param Array
    *  Array of CSS declaration object of the form:
    *    {
--- a/devtools/shared/specs/compatibility.js
+++ b/devtools/shared/specs/compatibility.js
@@ -32,16 +32,19 @@ types.addDictType("declaration", {
   name: "string",
   value: "string",
 });
 
 const compatibilitySpec = generateActorSpec({
   typeName: "compatibility",
 
   methods: {
+    // While not being used on the client at the moment, keep this method in case
+    // we need traits again to support backwards compatibility for the Compatibility
+    // actor.
     getTraits: {
       request: {},
       response: { traits: RetVal("json") },
     },
     getCSSDeclarationBlockIssues: {
       request: {
         declarationBlock: Arg(0, "array:declaration"),
         targetBrowsers: Arg(1, "array:browsertype"),