Bug 1443642: Remove obsolete Addon.hasBinaryComponents flag. r=aswan
authorKris Maglione <maglione.k@gmail.com>
Tue, 06 Mar 2018 13:59:42 -0800
changeset 462432 eaa25a9925006447cc24717554e567d77965ac21
parent 462431 e957efe5d14c0a7a79483b477e9a6c9a8e7ddb3f
child 462433 2c914b6e666887816da2ea14448aa055f24b19dd
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaswan
bugs1443642
milestone60.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 1443642: Remove obsolete Addon.hasBinaryComponents flag. r=aswan MozReview-Commit-ID: AlddwvjQmg1
toolkit/components/telemetry/TelemetryEnvironment.jsm
toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
toolkit/mozapps/extensions/internal/XPIInstall.jsm
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/internal/XPIProviderUtils.js
toolkit/mozapps/extensions/test/addons/test_install5/chrome.manifest
toolkit/mozapps/extensions/test/addons/test_install5/install.rdf
toolkit/mozapps/extensions/test/xpcshell/test_hasbinarycomponents.js
toolkit/mozapps/extensions/test/xpcshell/test_install.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -702,17 +702,17 @@ EnvironmentAddonBuilder.prototype = {
           let installDate = new Date(Math.max(0, addon.installDate));
           Object.assign(activeAddons[addon.id], {
             blocklisted: (addon.blocklistState !== Ci.nsIBlocklistService.STATE_NOT_BLOCKED),
             description: limitStringToLength(addon.description, MAX_ADDON_STRING_LENGTH),
             name: limitStringToLength(addon.name, MAX_ADDON_STRING_LENGTH),
             userDisabled: enforceBoolean(addon.userDisabled),
             appDisabled: addon.appDisabled,
             foreignInstall: enforceBoolean(addon.foreignInstall),
-            hasBinaryComponents: addon.hasBinaryComponents,
+            hasBinaryComponents: false,
             installDay: Utils.millisecondsToDays(installDate.getTime()),
             signedState: addon.signedState,
           });
         }
       } catch (ex) {
         this._environment._log.error("_getActiveAddons - An addon was discarded due to an error", ex);
         continue;
       }
@@ -742,17 +742,17 @@ EnvironmentAddonBuilder.prototype = {
         blocklisted: (theme.blocklistState !== Ci.nsIBlocklistService.STATE_NOT_BLOCKED),
         description: limitStringToLength(theme.description, MAX_ADDON_STRING_LENGTH),
         name: limitStringToLength(theme.name, MAX_ADDON_STRING_LENGTH),
         userDisabled: enforceBoolean(theme.userDisabled),
         appDisabled: theme.appDisabled,
         version: limitStringToLength(theme.version, MAX_ADDON_STRING_LENGTH),
         scope: theme.scope,
         foreignInstall: enforceBoolean(theme.foreignInstall),
-        hasBinaryComponents: theme.hasBinaryComponents,
+        hasBinaryComponents: false,
         installDay: Utils.millisecondsToDays(installDate.getTime()),
         updateDay: Utils.millisecondsToDays(updateDate.getTime()),
       };
     }
 
     return activeTheme;
   },
 
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryEnvironment.js
@@ -747,17 +747,16 @@ function checkPlugin(data) {
 
   Assert.ok(Array.isArray(data.mimeTypes));
   for (let type of data.mimeTypes) {
     Assert.ok(checkString(type));
   }
 }
 
 function checkTheme(data) {
-  // "hasBinaryComponents" is not available when testing.
   const EXPECTED_THEME_FIELDS_TYPES = {
     id: "string",
     blocklisted: "boolean",
     name: "string",
     userDisabled: "boolean",
     appDisabled: "boolean",
     version: "string",
     scope: "number",
--- a/toolkit/mozapps/extensions/internal/XPIInstall.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIInstall.jsm
@@ -22,18 +22,16 @@ ChromeUtils.import("resource://gre/modul
 ChromeUtils.defineModuleGetter(this, "AddonRepository",
                                "resource://gre/modules/addons/AddonRepository.jsm");
 ChromeUtils.defineModuleGetter(this, "AddonSettings",
                                "resource://gre/modules/addons/AddonSettings.jsm");
 ChromeUtils.defineModuleGetter(this, "AppConstants",
                                "resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyGetter(this, "CertUtils",
                             () => ChromeUtils.import("resource://gre/modules/CertUtils.jsm", {}));
-ChromeUtils.defineModuleGetter(this, "ChromeManifestParser",
-                               "resource://gre/modules/ChromeManifestParser.jsm");
 ChromeUtils.defineModuleGetter(this, "ExtensionData",
                                "resource://gre/modules/Extension.jsm");
 ChromeUtils.defineModuleGetter(this, "FileUtils",
                                "resource://gre/modules/FileUtils.jsm");
 XPCOMUtils.defineLazyGetter(this, "IconDetails", () => {
   return ChromeUtils.import("resource://gre/modules/ExtensionParent.jsm", {}).ExtensionParent.IconDetails;
 });
 ChromeUtils.defineModuleGetter(this, "LightweightThemeManager",
@@ -338,17 +336,16 @@ async function loadManifestFromWebManife
   let addon = new AddonInternal();
   addon.id = bss.id;
   addon.version = manifest.version;
   addon.type = extension.type === "extension" ?
                "webextension" : `webextension-${extension.type}`;
   addon.unpack = false;
   addon.strictCompatibility = true;
   addon.bootstrap = true;
-  addon.hasBinaryComponents = false;
   addon.multiprocessCompatible = true;
   addon.internalName = null;
   addon.updateURL = bss.update_url;
   addon.updateKey = null;
   addon.optionsBrowserStyle = true;
   addon.optionsURL = null;
   addon.optionsType = null;
   addon.aboutURL = null;
@@ -798,21 +795,16 @@ var loadManifestFromDir = async function
       addon.icons[48] = "icon.png";
     }
 
     let icon64File = getFile("icon64.png", aDir);
 
     if (icon64File.exists()) {
       addon.icons[64] = "icon64.png";
     }
-
-    let file = getFile("chrome.manifest", aDir);
-    let chromeManifest = ChromeManifestParser.parseSync(Services.io.newFileURI(file));
-    addon.hasBinaryComponents = ChromeManifestParser.hasType(chromeManifest,
-                                                             "binary-component");
     return addon;
   }
 
   let file = getManifestFileForDir(aDir);
   if (!file) {
     throw new Error("Directory " + aDir.path + " does not contain a valid " +
                     "install manifest");
   }
@@ -871,26 +863,16 @@ var loadManifestFromZipReader = async fu
       addon.icons[32] = "icon.png";
       addon.icons[48] = "icon.png";
     }
 
     if (aZipReader.hasEntry("icon64.png")) {
       addon.icons[64] = "icon64.png";
     }
 
-    // Binary components can only be loaded from unpacked addons.
-    if (addon.unpack) {
-      let uri = buildJarURI(aZipReader.file, "chrome.manifest");
-      let chromeManifest = ChromeManifestParser.parseSync(uri);
-      addon.hasBinaryComponents = ChromeManifestParser.hasType(chromeManifest,
-                                                               "binary-component");
-    } else {
-      addon.hasBinaryComponents = false;
-    }
-
     return addon;
   }
 
   let entry = getManifestEntryForZipReader(aZipReader);
   if (!entry) {
     throw new Error("File " + aZipReader.file.path + " does not contain a valid " +
                     "install manifest");
   }
@@ -2733,18 +2715,17 @@ UpdateChecker.prototype = {
 
     let ignoreMaxVersion = false;
     let ignoreStrictCompat = false;
     if (!AddonManager.checkCompatibility) {
       ignoreMaxVersion = true;
       ignoreStrictCompat = true;
     } else if (this.addon.type in COMPATIBLE_BY_DEFAULT_TYPES &&
                !AddonManager.strictCompatibility &&
-               !this.addon.strictCompatibility &&
-               !this.addon.hasBinaryComponents) {
+               !this.addon.strictCompatibility) {
       ignoreMaxVersion = true;
     }
 
     // Always apply any compatibility update for the current version
     let compatUpdate = AUC.getCompatibilityUpdate(aUpdates, this.addon.version,
                                                   this.syncCompatibility,
                                                   null, null,
                                                   ignoreMaxVersion,
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -4996,18 +4996,17 @@ AddonInternal.prototype = {
     if (app.id == Services.appinfo.ID)
       version = aAppVersion;
     else if (app.id == TOOLKIT_ID)
       version = aPlatformVersion;
 
     // Only extensions and dictionaries can be compatible by default; themes
     // and language packs always use strict compatibility checking.
     if (this.type in COMPATIBLE_BY_DEFAULT_TYPES &&
-        !AddonManager.strictCompatibility && !this.strictCompatibility &&
-        !this.hasBinaryComponents) {
+        !AddonManager.strictCompatibility && !this.strictCompatibility) {
 
       // The repository can specify compatibility overrides.
       // Note: For now, only blacklisting is supported by overrides.
       let overrides = AddonRepository.getCompatibilityOverridesSync(this.id);
       if (overrides) {
         let override = AddonRepository.findMatchingCompatOverride(this.version,
                                                                   overrides);
         if (override) {
@@ -5747,17 +5746,17 @@ function defineAddonWrapperProperty(name
   Object.defineProperty(AddonWrapper.prototype, name, {
     get: getter,
     enumerable: true,
   });
 }
 
 ["id", "syncGUID", "version", "isCompatible", "isPlatformCompatible",
  "providesUpdatesSecurely", "blocklistState", "blocklistURL", "appDisabled",
- "softDisabled", "skinnable", "size", "foreignInstall", "hasBinaryComponents",
+ "softDisabled", "skinnable", "size", "foreignInstall",
  "strictCompatibility", "updateURL", "dependencies",
  "getDataDirectory", "multiprocessCompatible", "signedState", "mpcOptedOut",
  "isCorrectlySigned"].forEach(function(aProp) {
    defineAddonWrapperProperty(aProp, function() {
      let addon = addonFor(this);
      return (aProp in addon) ? addon[aProp] : undefined;
    });
 });
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -53,17 +53,17 @@ const KEY_APP_TEMPORARY               = 
 // Properties to save in JSON file
 const PROP_JSON_FIELDS = ["id", "syncGUID", "location", "version", "type",
                           "internalName", "updateURL", "updateKey", "optionsURL",
                           "optionsType", "optionsBrowserStyle", "aboutURL",
                           "defaultLocale", "visible", "active", "userDisabled",
                           "appDisabled", "pendingUninstall", "installDate",
                           "updateDate", "applyBackgroundUpdates", "bootstrap", "path",
                           "skinnable", "size", "sourceURI", "releaseNotesURI",
-                          "softDisabled", "foreignInstall", "hasBinaryComponents",
+                          "softDisabled", "foreignInstall",
                           "strictCompatibility", "locales", "targetApplications",
                           "targetPlatforms", "multiprocessCompatible", "signedState",
                           "seen", "dependencies", "hasEmbeddedWebExtension", "mpcOptedOut",
                           "userPermissions", "icons", "iconURL", "icon64URL",
                           "blocklistState", "blocklistURL", "startupData"];
 
 // Time to wait before async save of XPI JSON database, in milliseconds
 const ASYNC_SAVE_DELAY_MS = 20;
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/addons/test_install5/chrome.manifest
+++ /dev/null
@@ -1,1 +0,0 @@
-binary-component components/mycomponent.so
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/addons/test_install5/install.rdf
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-
-<!-- An extension that is incompatible with the XPCShell test suite and
-     has binary components, so won't be compatible-by-default. -->
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-     xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
-  <Description about="urn:mozilla:install-manifest">
-    <em:id>addon5@tests.mozilla.org</em:id>
-    <em:version>1.0</em:version>
-
-    <!-- Front End MetaData -->
-    <em:name>Real Test 5</em:name>
-    <em:description>Test Description</em:description>
-    <em:unpack>true</em:unpack>
-
-    <em:targetApplication>
-      <Description>
-        <em:id>xpcshell@tests.mozilla.org</em:id>
-        <em:minVersion>0</em:minVersion>
-        <em:maxVersion>0</em:maxVersion>
-      </Description>
-    </em:targetApplication>
-
-  </Description>
-</RDF>
deleted file mode 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_hasbinarycomponents.js
+++ /dev/null
@@ -1,82 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-// Tests detection of binary components via parsing of chrome manifests.
-
-const profileDir = gProfD.clone();
-profileDir.append("extensions");
-
-function run_test() {
-  do_test_pending();
-  createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2", "2");
-
-  startupManager();
-
-  installAllFiles([do_get_addon("test_chromemanifest_1"),
-                   do_get_addon("test_chromemanifest_2"),
-                   do_get_addon("test_chromemanifest_3"),
-                   do_get_addon("test_chromemanifest_4"),
-                   do_get_addon("test_chromemanifest_5")],
-                  async function() {
-
-    await promiseRestartManager();
-
-    AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
-                                 "addon2@tests.mozilla.org",
-                                 "addon3@tests.mozilla.org",
-                                 "addon4@tests.mozilla.org",
-                                 "addon5@tests.mozilla.org"],
-                                async function([a1, a2, a3, a4, a5]) {
-      // addon1 has no binary components
-      Assert.notEqual(a1, null);
-      Assert.ok(!a1.userDisabled);
-      Assert.ok(!a1.hasBinaryComponents);
-      Assert.ok(a1.isCompatible);
-      Assert.ok(!a1.appDisabled);
-      Assert.ok(a1.isActive);
-      Assert.ok(isExtensionInAddonsList(profileDir, a1.id));
-
-      // addon2 has a binary component, is compatible
-      Assert.notEqual(a2, null);
-      Assert.ok(!a2.userDisabled);
-      Assert.ok(a2.hasBinaryComponents);
-      Assert.ok(a2.isCompatible);
-      Assert.ok(!a2.appDisabled);
-      Assert.ok(a2.isActive);
-      Assert.ok(isExtensionInAddonsList(profileDir, a2.id));
-
-      // addon3 has a binary component, is incompatible
-      Assert.notEqual(a3, null);
-      Assert.ok(!a3.userDisabled);
-      Assert.ok(a2.hasBinaryComponents);
-      Assert.ok(!a3.isCompatible);
-      Assert.ok(a3.appDisabled);
-      Assert.ok(!a3.isActive);
-      Assert.ok(!isExtensionInAddonsList(profileDir, a3.id));
-
-      // addon4 has a binary component listed in a sub-manifest, is incompatible
-      Assert.notEqual(a4, null);
-      Assert.ok(!a4.userDisabled);
-      Assert.ok(a2.hasBinaryComponents);
-      Assert.ok(!a4.isCompatible);
-      Assert.ok(a4.appDisabled);
-      Assert.ok(!a4.isActive);
-      Assert.ok(!isExtensionInAddonsList(profileDir, a4.id));
-
-      // addon5 has a binary component, but is set to not unpack
-      Assert.notEqual(a5, null);
-      Assert.ok(!a5.userDisabled);
-      if (TEST_UNPACKED)
-        Assert.ok(a5.hasBinaryComponents);
-      else
-        Assert.ok(!a5.hasBinaryComponents);
-      Assert.ok(a5.isCompatible);
-      Assert.ok(!a5.appDisabled);
-      Assert.ok(a5.isActive);
-      Assert.ok(isExtensionInAddonsList(profileDir, a5.id));
-
-      executeSoon(do_test_finished);
-    });
-  });
-}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install.js
@@ -1398,70 +1398,17 @@ function finish_test_27(aInstall) {
   }, [
     "onInstallCancelled"
   ]);
 
   aInstall.cancel();
 
   ensure_test_completed();
 
-  run_test_28();
-}
-
-// Tests that an install that isn't strictly compatible and has
-// binary components correctly has appDisabled set (see bug 702868).
-function run_test_28() {
-  prepare_test({ }, [
-    "onNewInstall"
-  ]);
-
-  let url = "http://localhost:" + gPort + "/addons/test_install5.xpi";
-  AddonManager.getInstallForURL(url, function(install) {
-    ensure_test_completed();
-
-    Assert.notEqual(install, null);
-    Assert.equal(install.version, "1.0");
-    Assert.equal(install.name, "Real Test 5");
-    Assert.equal(install.state, AddonManager.STATE_AVAILABLE);
-
-    AddonManager.getInstallsByTypes(null, function(activeInstalls) {
-      Assert.equal(activeInstalls.length, 1);
-      Assert.equal(activeInstalls[0], install);
-
-      prepare_test({}, [
-        "onDownloadStarted",
-        "onDownloadEnded",
-        "onInstallStarted"
-      ], check_test_28);
-      install.install();
-    });
-  }, "application/x-xpinstall", null, "Real Test 5", null, "1.0");
-}
-
-function check_test_28(install) {
-  ensure_test_completed();
-  Assert.equal(install.version, "1.0");
-  Assert.equal(install.name, "Real Test 5");
-  Assert.equal(install.state, AddonManager.STATE_INSTALLING);
-  Assert.equal(install.existingAddon, null);
-  Assert.ok(!install.addon.isCompatible);
-  Assert.ok(install.addon.appDisabled);
-
-  prepare_test({}, [
-    "onInstallCancelled"
-  ], finish_test_28);
-  return false;
-}
-
-function finish_test_28(install) {
-  prepare_test({}, [
-    "onDownloadCancelled"
-  ], run_test_29);
-
-  install.cancel();
+  run_test_29();
 }
 
 // Tests that an install with a matching compatibility override has appDisabled
 // set correctly.
 function run_test_29() {
   Services.prefs.setBoolPref("extensions.getAddons.cache.enabled", true);
 
   prepare_test({ }, [
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
@@ -209,17 +209,16 @@ tags = blocklist
 [test_gfxBlacklist_Vendor.js]
 tags = blocklist
 [test_gfxBlacklist_Version.js]
 tags = blocklist
 [test_gfxBlacklist_prefs.js]
 # Bug 1248787 - consistently fails
 skip-if = true
 tags = blocklist
-[test_hasbinarycomponents.js]
 [test_install.js]
 [test_install_icons.js]
 # Bug 676992: test consistently hangs on Android
 skip-if = os == "android"
 [test_install_strictcompat.js]
 # Bug 676992: test consistently hangs on Android
 skip-if = os == "android"
 run-sequentially = Uses hardcoded ports in xpi files.