зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1506546 - Refactor listAddons call sites. r=yulia
Adapt to the new returned value of listAddons and also always call it from RootFront instead of DebuggerClient. Fix the spec in order to expose reload on the front (it was a miss from a previous patch). MozReview-Commit-ID: AQ5EOQEqnxX Depends on D12575 Differential Revision: https://phabricator.services.mozilla.com/D12576 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a4a14bea9f
Коммит
1ecba9148a
|
@ -80,10 +80,7 @@ var onConnectionReady = async function([aType, aTraits]) {
|
|||
|
||||
let addons = [];
|
||||
try {
|
||||
const response = await gClient.listAddons();
|
||||
if (!response.error && response.addons.length > 0) {
|
||||
addons = response.addons;
|
||||
}
|
||||
addons = await gClient.mainRoot.listAddons();
|
||||
} catch (e) {
|
||||
// listAddons throws if the runtime doesn't support addons
|
||||
}
|
||||
|
@ -163,7 +160,7 @@ var onConnectionReady = async function([aType, aTraits]) {
|
|||
function buildAddonLink(addon, parent) {
|
||||
const a = document.createElement("a");
|
||||
a.onclick = async function() {
|
||||
openToolbox(addon, true, "webconsole");
|
||||
openToolbox(null, true, "webconsole", addon);
|
||||
};
|
||||
|
||||
a.textContent = addon.name;
|
||||
|
|
|
@ -18,7 +18,7 @@ add_task(async function testReloadExitedAddon() {
|
|||
// Retrieve the current list of addons to be notified of the next list update.
|
||||
// We will also call listAddons every time we receive the event "addonListChanged" for
|
||||
// the same reason.
|
||||
await client.listAddons();
|
||||
await client.mainRoot.listAddons();
|
||||
|
||||
info("Install the addon");
|
||||
const addonFile = do_get_file("addons/web-extension", false);
|
||||
|
@ -56,5 +56,5 @@ async function expectAddonListChanged(client, predicate) {
|
|||
const onAddonListChanged = client.mainRoot.once("addonListChanged");
|
||||
await predicate();
|
||||
await onAddonListChanged;
|
||||
await client.listAddons();
|
||||
await client.mainRoot.listAddons();
|
||||
}
|
||||
|
|
|
@ -29,10 +29,10 @@ add_task(async function testSuccessfulInstall() {
|
|||
// The returned object is currently not a proper actor.
|
||||
equal(installedAddon.actor, false);
|
||||
|
||||
const addonList = await client.listAddons();
|
||||
ok(addonList && addonList.addons && addonList.addons.map(a => a.name),
|
||||
const addonList = await client.mainRoot.listAddons();
|
||||
ok(addonList && addonList.map(a => a.name),
|
||||
"Received list of add-ons");
|
||||
const addon = addonList.addons.filter(a => a.id === installedAddon.id)[0];
|
||||
const addon = addonList.find(a => a.id === installedAddon.id);
|
||||
ok(addon, "Test add-on appeared in root install list");
|
||||
|
||||
await close(client);
|
||||
|
|
|
@ -344,14 +344,6 @@ DebuggerClient.prototype = {
|
|||
return this.mainRoot.listTabs(options);
|
||||
},
|
||||
|
||||
/*
|
||||
* This function exists only to preserve DebuggerClient's interface;
|
||||
* new code should say 'client.mainRoot.listAddons()'.
|
||||
*/
|
||||
listAddons: function() {
|
||||
return this.mainRoot.listAddons();
|
||||
},
|
||||
|
||||
getTab: function(filter) {
|
||||
return this.mainRoot.getTab(filter);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче