Bug 1433334 - Add installTelemetryInfo to addon installed from Firefox Sync.
MozReview-Commit-ID: 9ScaJVAEk05
--- 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,