зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1403723 - Correct metadata when using management.get. r=mixedpuppy
This commit is contained in:
Родитель
dfe70a7a30
Коммит
2b68d66833
|
@ -166,7 +166,9 @@ this.management = class extends ExtensionAPI {
|
|||
async get(id) {
|
||||
let addon = await AddonManager.getAddonByID(id);
|
||||
if (!addon.isSystem) {
|
||||
return getExtensionInfoForAddon(extension, addon);
|
||||
// If the extension is enabled get it and use it for more data.
|
||||
let ext = addon.isWebExtension && GlobalManager.extensionMap.get(addon.id);
|
||||
return getExtensionInfoForAddon(ext, addon);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@ add_task(async function test_management_getAll() {
|
|||
},
|
||||
name: id,
|
||||
version: "1.0",
|
||||
short_name: id,
|
||||
permissions: ["management"],
|
||||
};
|
||||
}
|
||||
|
@ -55,11 +56,18 @@ add_task(async function test_management_getAll() {
|
|||
for (let id of [id1, id2]) {
|
||||
let addon = addons.find(a => { return a.id === id; });
|
||||
equal(addon.name, id, `The extension with id ${id} was returned by getAll.`);
|
||||
equal(addon.shortName, id, "Additional extension metadata was correct");
|
||||
}
|
||||
|
||||
extension2.sendMessage("getAddon", id1);
|
||||
let addon = await extension2.awaitMessage("addon");
|
||||
equal(addon.name, id1, `The extension with id ${id1} was returned by get.`);
|
||||
equal(addon.shortName, id1, "Additional extension metadata was correct");
|
||||
|
||||
extension2.sendMessage("getAddon", id2);
|
||||
addon = await extension2.awaitMessage("addon");
|
||||
equal(addon.name, id2, `The extension with id ${id2} was returned by get.`);
|
||||
equal(addon.shortName, id2, "Additional extension metadata was correct");
|
||||
|
||||
await extension2.unload();
|
||||
await extension1.unload();
|
||||
|
|
Загрузка…
Ссылка в новой задаче