summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/content/newaddon.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/content/newaddon.js')
-rw-r--r--toolkit/mozapps/extensions/content/newaddon.js26
1 files changed, 9 insertions, 17 deletions
diff --git a/toolkit/mozapps/extensions/content/newaddon.js b/toolkit/mozapps/extensions/content/newaddon.js
index b1ad5631b..2b2a54af5 100644
--- a/toolkit/mozapps/extensions/content/newaddon.js
+++ b/toolkit/mozapps/extensions/content/newaddon.js
@@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-var Cc = Components.classes;
-var Ci = Components.interfaces;
-var Cu = Components.utils;
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
@@ -13,7 +13,7 @@ var gAddon = null;
// If the user enables the add-on through some other UI close this window
var EnableListener = {
- onEnabling: function(aAddon) {
+ onEnabling: function EnableListener_onEnabling(aAddon) {
if (aAddon.id == gAddon.id)
window.close();
}
@@ -38,11 +38,11 @@ function initialize() {
let bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/newaddon.properties");
- AddonManager.getAddonByID(id, function(aAddon) {
- // If the add-on doesn't exist or it is already enabled or it has already
- // been seen or it cannot be enabled then this UI is useless, just close it.
- // This shouldn't normally happen unless session restore restores the tab.
- if (!aAddon || !aAddon.userDisabled || aAddon.seen ||
+ AddonManager.getAddonByID(id, function initialize_getAddonByID(aAddon) {
+ // If the add-on doesn't exist or it is already enabled or it cannot be
+ // enabled then this UI is useless, just close it. This shouldn't normally
+ // happen unless session restore restores the tab
+ if (!aAddon || !aAddon.userDisabled ||
!(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) {
window.close();
return;
@@ -79,14 +79,6 @@ function initialize() {
document.getElementById("location").hidden = true;
}
- // Only mark the add-on as seen if the page actually gets focus
- if (document.hasFocus()) {
- aAddon.markAsSeen();
- }
- else {
- document.addEventListener("focus", () => aAddon.markAsSeen(), false);
- }
-
var event = document.createEvent("Events");
event.initEvent("AddonDisplayed", true, true);
document.dispatchEvent(event);