Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Stop using Namespace as `addon` private is collected.

  • Loading branch information...
commit 76380937bb72eb08ba05bc4c12612f11eec51d10 1 parent 8c9f280
@ochameau ochameau authored
Showing with 7 additions and 11 deletions.
  1. +7 −11 lib/addon-install.js
View
18 lib/addon-install.js
@@ -6,13 +6,10 @@ const { Cc, Ci, Cu } = require('chrome');
const { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
const { Base } = require("api-utils/base");
-const { ns } = require("api-utils/namespace");
-
/**
* Class to manage an addon: install and uninstall it.
*/
-const AddonNS = ns({addon: null});
exports.AddonInstall = Base.extend({
/**
* Immediatly install an addon. Note that the given xpi file will be
@@ -29,7 +26,7 @@ exports.AddonInstall = Base.extend({
let self = this;
let installListener = {
onInstallEnded: function(aInstall, aAddon) {
- AddonNS(self).addon = aAddon;
+ self._addon = aAddon;
onInstalled(aInstall, true);
},
onInstallFailed: function (aInstall) {
@@ -54,23 +51,22 @@ exports.AddonInstall = Base.extend({
},
- get id() {
- let addon = AddonNS(this).addon;
- return addon ? addon.id : null;
- },
+ get id() this._addon ? this._addon.id : null,
- get isInstalled() !!AddonNS(this).addon,
+ get isInstalled() "_addon" in this,
unload: function (callback) {
// Order Addonmanager to uninstall our addon
- let addon = AddonNS(this).addon;
+ if (!"_addon" in this)
+ return callback();
+ let addon = this._addon;
let self = this;
let uninstallListener = {
onUninstalled: function onUninstalled(aAddon) {
if (aAddon.id != addon.id)
return;
AddonManager.removeAddonListener(uninstallListener);
- delete AddonNS(self).addon;
+ delete self._addon;
callback();
}
};
Please sign in to comment.
Something went wrong with that request. Please try again.