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 439432 c6ff74a707a6a90e9e8874152c45c1ccb7765d62
parent 439431 4212ae711990ebf15e235abd11509649afd289ed
child 439433 bde685714bea04e95e8fc69e4da2cd51039d3bcd
push id34771
push usercsabou@mozilla.com
push dateWed, 03 Oct 2018 21:54:47 +0000
treeherdermozilla-central@cdea5981e6eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1486763
milestone64.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 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,