Fix Bug 1496167 - Add installation source to addons installed from activitystream
This commit is contained in:
Родитель
77c6f0c058
Коммит
211d413f10
|
@ -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) {}
|
||||
|
|
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче