Skip to content

Commit

Permalink
wrapped functions with sandboxmanager.wrapAsync
Browse files Browse the repository at this point in the history
dropped "return null"
  • Loading branch information
crankycoder committed Jun 13, 2017
1 parent f471d35 commit bc00ff8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions recipe-client-addon/lib/NormandyDriver.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ this.NormandyDriver = function(sandboxManager) {
/*
* Return a promise that resolves to an Addon ID if installation is successful.
*/
async installAddon(installUrl) {
installAddon: sandboxManager.wrapAsync(async function installAddon(installUrl) {
const installObj = await AddonManager.getInstallForURL(installUrl, null, "application/x-xpinstall");
const result = new Promise((resolve, reject) => installObj.addListener({
onInstallEnded(addonInstall, addon) {
Expand All @@ -173,21 +173,20 @@ this.NormandyDriver = function(sandboxManager) {
},
}));
installObj.install();
return result;
},
}),

/*
* Return a promise that resolves to a success messsage if
* addon uninstall is successful.
*/
async uninstallAddon(addonId) {
uninstallAddon: sandboxManager.wrapAsync(async function uninstallAddon(addonId) {
const addon = await AddonManager.getAddonByID(addonId);
if (addon === null) {
throw new Error(`No addon with ID [${addonId}] found.`);
}
addon.uninstall();
return null;
},
}),

// Sampling
ratioSample: sandboxManager.wrapAsync(Sampling.ratioSample),
Expand Down

0 comments on commit bc00ff8

Please sign in to comment.