Backed out changeset 9c97b8ceefee (bug 1272446) for bustage
authorCarsten "Tomcat" Book <cbook@mozilla.com>
Tue, 29 Nov 2016 16:33:05 +0100
changeset 352723 c28cdfa4b5fd2ec43673051defcc365f48d6b12e
parent 352722 46ecaa81aa4cca2ea61cd1d60006b7d108e9e53f
child 352724 af6fea4fe3c79e74b04f669ac3973cd69dd534a3
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1272446
milestone52.0a2
backs out9c97b8ceefee56de47fddc97bb75fd95f1773168
Backed out changeset 9c97b8ceefee (bug 1272446) for bustage
toolkit/mozapps/extensions/internal/XPIProvider.jsm
toolkit/mozapps/extensions/internal/XPIProviderUtils.js
toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -3816,18 +3816,17 @@ this.XPIProvider = {
       // from the filesystem
       if (updateReasons.length > 0) {
         AddonManagerPrivate.recordSimpleMeasure("XPIDB_startup_load_reasons", updateReasons);
         XPIDatabase.syncLoadDB(false);
         try {
           extensionListChanged = XPIDatabaseReconcile.processFileChanges(manifests,
                                                                          aAppChanged,
                                                                          aOldAppVersion,
-                                                                         aOldPlatformVersion,
-                                                                         updateReasons.includes("schemaChanged"));
+                                                                         aOldPlatformVersion);
         }
         catch (e) {
           logger.error("Failed to process extension changes at startup", e);
         }
       }
 
       if (aAppChanged) {
         // When upgrading the app and using a custom skin make sure it is still
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -33,18 +33,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
                                   "resource://gre/modules/osfile.jsm");
 XPCOMUtils.defineLazyServiceGetter(this, "Blocklist",
                                    "@mozilla.org/extensions/blocklist;1",
                                    Ci.nsIBlocklistService);
 
 Cu.import("resource://gre/modules/Log.jsm");
 const LOGGER_ID = "addons.xpi-utils";
 
-const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile");
-
 // Create a new logger for use by the Addons XPI Provider Utils
 // (Requires AddonManager.jsm)
 var logger = Log.repository.getLogger(LOGGER_ID);
 
 const KEY_PROFILEDIR                  = "ProfD";
 const FILE_DATABASE                   = "extensions.sqlite";
 const FILE_JSON_DB                    = "extensions.json";
 const FILE_OLD_DATABASE               = "extensions.rdf";
@@ -1850,53 +1848,31 @@ this.XPIDatabaseReconcile = {
    * @param  aAddonState
    *         The new state of the add-on
    * @param  aOldAppVersion
    *         The version of the application last run with this profile or null
    *         if it is a new profile or the version is unknown
    * @param  aOldPlatformVersion
    *         The version of the platform last run with this profile or null
    *         if it is a new profile or the version is unknown
-   * @param  aReloadMetadata
-   *         A boolean which indicates whether metadata should be reloaded from
-   *         the addon manifests. Default to false.
-   * @return the new addon.
+   * @return a boolean indicating if flushing caches is required to complete
+   *         changing this add-on
    */
-  updateCompatibility(aInstallLocation, aOldAddon, aAddonState, aOldAppVersion,
-                      aOldPlatformVersion, aReloadMetadata) {
+  updateCompatibility(aInstallLocation, aOldAddon, aAddonState, aOldAppVersion, aOldPlatformVersion) {
     logger.debug("Updating compatibility for add-on " + aOldAddon.id + " in " + aInstallLocation.name);
 
     // If updating from a version of the app that didn't support signedState
     // then fetch that property now
     if (aOldAddon.signedState === undefined && ADDON_SIGNING &&
         SIGNED_TYPES.has(aOldAddon.type)) {
       let file = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
       file.persistentDescriptor = aAddonState.descriptor;
       let manifest = syncLoadManifestFromFile(file, aInstallLocation);
       aOldAddon.signedState = manifest.signedState;
     }
-
-    // May be updating from a version of the app that didn't support all the
-    // properties of the currently-installed add-ons.
-    if (aReloadMetadata) {
-      let file = new nsIFile()
-      file.persistentDescriptor = aAddonState.descriptor;
-      let manifest = syncLoadManifestFromFile(file, aInstallLocation);
-
-      // Avoid re-reading these properties from manifest,
-      // use existing addon instead.
-      // TODO - consider re-scanning for targetApplications.
-      let remove = ["syncGUID", "foreignInstall", "visible", "active",
-                    "userDisabled", "applyBackgroundUpdates", "sourceURI",
-                    "releaseNotesURI", "targetApplications"];
-
-      let props = PROP_JSON_FIELDS.filter(a => !remove.includes(a));
-      copyProperties(manifest, props, aOldAddon);
-    }
-
     // This updates the addon's JSON cached data in place
     applyBlocklistChanges(aOldAddon, aOldAddon, aOldAppVersion,
                           aOldPlatformVersion);
     aOldAddon.appDisabled = !isUsableAddon(aOldAddon);
 
     return aOldAddon;
   },
 
@@ -1914,23 +1890,20 @@ this.XPIDatabaseReconcile = {
    *         true to update add-ons appDisabled property when the application
    *         version has changed
    * @param  aOldAppVersion
    *         The version of the application last run with this profile or null
    *         if it is a new profile or the version is unknown
    * @param  aOldPlatformVersion
    *         The version of the platform last run with this profile or null
    *         if it is a new profile or the version is unknown
-   * @param  aSchemaChange
-   *         The schema has changed and all add-on manifests should be re-read.
    * @return a boolean indicating if a change requiring flushing the caches was
    *         detected
    */
-  processFileChanges(aManifests, aUpdateCompatibility, aOldAppVersion, aOldPlatformVersion,
-                     aSchemaChange) {
+  processFileChanges(aManifests, aUpdateCompatibility, aOldAppVersion, aOldPlatformVersion) {
     let loadedManifest = (aInstallLocation, aId) => {
       if (!(aInstallLocation.name in aManifests))
         return null;
       if (!(aId in aManifests[aInstallLocation.name]))
         return null;
       return aManifests[aInstallLocation.name][aId];
     };
 
@@ -1991,38 +1964,32 @@ this.XPIDatabaseReconcile = {
                   oldtime: oldAddon.updateDate
                 });
               } else {
                 XPIProvider.setTelemetry(oldAddon.id, "modifiedFile",
                                          XPIProvider._mostRecentlyModifiedFile[id]);
               }
             }
 
-            // The add-on has changed if the modification time has changed, if
-            // we have an updated manifest for it, or if the schema version has
-            // changed.
-            //
-            // Also reload the metadata for add-ons in the application directory
-            // when the application version has changed.
+            // The add-on has changed if the modification time has changed, or
+            // we have an updated manifest for it. Also reload the metadata for
+            // add-ons in the application directory when the application version
+            // has changed
             let newAddon = loadedManifest(installLocation, id);
             if (newAddon || oldAddon.updateDate != xpiState.mtime ||
                 (aUpdateCompatibility && (installLocation.name == KEY_APP_GLOBAL ||
                                           installLocation.name == KEY_APP_SYSTEM_DEFAULTS))) {
               newAddon = this.updateMetadata(installLocation, oldAddon, xpiState, newAddon);
             }
             else if (oldAddon.descriptor != xpiState.descriptor) {
               newAddon = this.updateDescriptor(installLocation, oldAddon, xpiState);
             }
-            // Check compatility when the application version and/or schema
-            // version has changed. A schema change also reloads metadata from
-            // the manifests.
-            else if (aUpdateCompatibility || aSchemaChange) {
+            else if (aUpdateCompatibility) {
               newAddon = this.updateCompatibility(installLocation, oldAddon, xpiState,
-                                                  aOldAppVersion, aOldPlatformVersion,
-                                                  aSchemaChange);
+                                                  aOldAppVersion, aOldPlatformVersion);
             }
             else {
               // No change
               newAddon = oldAddon;
             }
 
             if (newAddon)
               locationAddonMap.set(newAddon.id, newAddon);
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell.ini
@@ -39,12 +39,11 @@ tags = webextensions
 [test_proxy.js]
 [test_pass_symbol.js]
 [test_delay_update.js]
 [test_nodisable_hidden.js]
 [test_delay_update_webextension.js]
 skip-if = appname == "thunderbird"
 tags = webextensions
 [test_dependencies.js]
-[test_schema_change.js]
 [test_system_delay_update.js]
 
 [include:xpcshell-shared.ini]