Bug 1486763 - Add installTelemetryInfo to addon installed from Firefox Sync. r=markh
authorLuca Greco <lgreco@mozilla.com>
Wed, 03 Oct 2018 06:58:23 +0000
changeset 487803 c6ff74a707a6a90e9e8874152c45c1ccb7765d62
parent 487802 4212ae711990ebf15e235abd11509649afd289ed
child 487804 bde685714bea04e95e8fc69e4da2cd51039d3bcd
push id246
push userfmarier@mozilla.com
push dateSat, 13 Oct 2018 00:15:40 +0000
reviewersmarkh
bugs1486763
milestone64.0a1
Bug 1486763 - Add installTelemetryInfo to addon installed from Firefox Sync. r=markh Differential Revision: https://phabricator.services.mozilla.com/D5552
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,