function uninstallAddon(addon, cb) {
    let listener = {
      onUninstalling: function(uninstalling, needsRestart) {
        if (addon.id != uninstalling.id) {
          return;
        }

        // We assume restartless add-ons will send the onUninstalled event
        // soon.
        if (!needsRestart) {
          return;
        }

        // For non-restartless add-ons, we issue the callback on uninstalling
        // because we will likely never see the uninstalled event.
        AddonManager.removeAddonListener(listener);
        cb(null, addon);
      },
      onUninstalled: function(uninstalled) {
        if (addon.id != uninstalled.id) {
          return;
        }

        AddonManager.removeAddonListener(listener);
        cb(null, addon);
      }
    };
    AddonManager.addAddonListener(listener);
    addon.uninstall();
  }
/**
   * Uninstalls the Addon instance and invoke a callback when it is done.
   *
   * @param addon
   *        Addon instance to uninstall.
   * @param cb
   *        Function to be invoked when uninstall has finished. It receives a
   *        truthy value signifying error and the add-on which was uninstalled.
   */
Uninstalls the Addon instance and invoke a callback when it is done.
@param addon
Addon instance to uninstall.
@param cb
Function to be invoked when uninstall has finished. It receives a
truthy value signifying error and the add-on which was uninstalled.
Uninstalls the Addon instance and invoke a callback when it is done . @param addon Addon instance to uninstall . @param cb Function to be invoked when uninstall has finished . It receives a truthy value signifying error and the add - on which was uninstalled .
function uninstallAddon(addon, cb) {
    let listener = {
      onUninstalling: function(uninstalling, needsRestart) {
        if (addon.id != uninstalling.id) {
          return;
        }
        if (!needsRestart) {
          return;
        }
        AddonManager.removeAddonListener(listener);
        cb(null, addon);
      },
      onUninstalled: function(uninstalled) {
        if (addon.id != uninstalled.id) {
          return;
        }
        AddonManager.removeAddonListener(listener);
        cb(null, addon);
      }
    };
    AddonManager.addAddonListener(listener);
    addon.uninstall();
  }
function uninstallAddon ( addon , cb ) { let listener = { onUninstalling : function ( uninstalling , needsRestart ) { if ( addon . id != uninstalling . id ) { return ; } if ( ! needsRestart ) { return ; } AddonManager . removeAddonListener ( listener ) ; cb ( null , addon ) ; } , onUninstalled : function ( uninstalled ) { if ( addon . id != uninstalled . id ) { return ; } AddonManager . removeAddonListener ( listener ) ; cb ( null , addon ) ; } } ; AddonManager . addAddonListener ( listener ) ; addon . uninstall ( ) ; }
Uninstalls the Addon instance and invoke a callback when it is done.
Uninstalls the Addon instance and invoke a callback when it is done .
// We assume restartless add-ons will send the onUninstalled event // soon. // For non-restartless add-ons, we issue the callback on uninstalling // because we will likely never see the uninstalled event.