Bug 1433334 - Add installTelemetryInfo to addon installed from Firefox Sync. draft
authorLuca Greco <lgreco@mozilla.com>
Mon, 23 Jul 2018 20:16:07 +0200
changeset 830174 06c4bb685d700eab9315a4b4286471f8f6ba326d
parent 830173 1318908e9e306958f4dc0b254c880ba6f799043f
child 830175 99503d1721d8a3f5301442418bda6af997846ab0
push id118821
push userluca.greco@alcacoop.it
push dateMon, 20 Aug 2018 14:39:19 +0000
bugs1433334
milestone63.0a1
Bug 1433334 - Add installTelemetryInfo to addon installed from Firefox Sync. MozReview-Commit-ID: 9ScaJVAEk05
services/sync/modules/addonutils.js
services/sync/tests/unit/test_addon_utils.js
--- a/services/sync/modules/addonutils.js
+++ b/services/sync/modules/addonutils.js
@@ -33,17 +33,18 @@ AddonUtilsInternal.prototype = {
     this._log.debug("Obtaining install for " + addon.id);
 
     // We should theoretically be able to obtain (and use) addon.install if
     // it is available. However, the addon.sourceURI rewriting won't be
     // reflected in the AddonInstall, so we can't use it. If we ever get rid
     // of sourceURI rewriting, we can avoid having to reconstruct the
     // AddonInstall.
     return AddonManager.getInstallForURL(
-      addon.sourceURI.spec, "application/x-xpinstall", undefined, addon.name, addon.iconURL, addon.version
+      addon.sourceURI.spec, "application/x-xpinstall", undefined, addon.name, addon.iconURL, addon.version,
+      null, {source: "sync"}
     );
   },
 
   /**
    * Installs an add-on from an AddonSearchResult instance.
    *
    * The options argument defines extra options to control the install.
    * Recognized keys in this map are:
--- a/services/sync/tests/unit/test_addon_utils.js
+++ b/services/sync/tests/unit/test_addon_utils.js
@@ -107,17 +107,20 @@ add_task(async function test_source_uri_
 
     Assert.equal(SERVER_ADDRESS + "/require.xpi?src=sync",
                  addon.sourceURI.spec);
 
     installCalled = true;
 
     const install = await AddonUtils.getInstallFromSearchResult(addon);
     Assert.equal(SERVER_ADDRESS + "/require.xpi?src=sync",
-                install.sourceURI.spec);
+                 install.sourceURI.spec);
+    Assert.deepEqual(install.installTelemetryInfo, {source: "sync"},
+                     "Got the expected installTelemetryInfo");
+
     return {id: addon.id, addon, install};
   };
 
   let server = createAndStartHTTPServer();
 
   let installOptions = {
     id: "rewrite@tests.mozilla.org",
     requireSecureURI: false,