Skip to content
This repository has been archived by the owner on Feb 29, 2020. It is now read-only.

Commit

Permalink
Fix Bug 1496167 - Add installation source to addons installed from ac…
Browse files Browse the repository at this point in the history
…tivitystream
  • Loading branch information
rpl authored and k88hudson committed Oct 4, 2018
1 parent 77c6f0c commit 211d413
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/ASRouter.jsm
Expand Up @@ -215,7 +215,12 @@ const MessageLoaderUtils = {
try {
const aUri = Services.io.newURI(url);
const systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
const install = await AddonManager.getInstallForURL(aUri.spec, "application/x-xpinstall");

// AddonManager installation source associated to the addons installed from activitystream
// (See Bug 1496167 for a rationale).
const amTelemetryInfo = {source: "activitystream"};
const install = await AddonManager.getInstallForURL(aUri.spec, "application/x-xpinstall", null,
null, null, null, null, amTelemetryInfo);
await AddonManager.installAddonFromWebpage("application/x-xpinstall", browser,
systemPrincipal, install);
} catch (e) {}
Expand Down
5 changes: 5 additions & 0 deletions test/unit/asrouter/MessageLoaderUtils.test.js
Expand Up @@ -252,6 +252,11 @@ describe("MessageLoaderUtils", () => {

assert.calledOnce(getInstallStub);
assert.calledOnce(installAddonStub);

// Verify that the expected installation source has been passed to the getInstallForURL
// method (See Bug 1496167 for a rationale).
assert.calledWithExactly(getInstallStub, "foo.com", "application/x-xpinstall", null,
null, null, null, null, {source: "activitystream"});
});
it("should not call the Addons API on invalid URLs", async () => {
sandbox.stub(global.Services.scriptSecurityManager, "getSystemPrincipal").throws();
Expand Down

0 comments on commit 211d413

Please sign in to comment.