summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/content
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/content')
-rw-r--r--toolkit/mozapps/extensions/content/blocklist.js2
-rw-r--r--toolkit/mozapps/extensions/content/list.js8
-rw-r--r--toolkit/mozapps/extensions/content/newaddon.js23
-rw-r--r--toolkit/mozapps/extensions/content/xpinstallConfirm.js14
4 files changed, 30 insertions, 17 deletions
diff --git a/toolkit/mozapps/extensions/content/blocklist.js b/toolkit/mozapps/extensions/content/blocklist.js
index 6b47fd652..6d524e6ee 100644
--- a/toolkit/mozapps/extensions/content/blocklist.js
+++ b/toolkit/mozapps/extensions/content/blocklist.js
@@ -26,7 +26,7 @@ function init() {
var richlist = document.getElementById("addonList");
var list = gArgs.list;
- list.sort(function listSort(a, b) { return String.localeCompare(a.name, b.name); });
+ list.sort(function(a, b) { return String.localeCompare(a.name, b.name); });
for (let listItem of list) {
let item = document.createElement("richlistitem");
item.setAttribute("name", listItem.name);
diff --git a/toolkit/mozapps/extensions/content/list.js b/toolkit/mozapps/extensions/content/list.js
index aac87911e..a31922703 100644
--- a/toolkit/mozapps/extensions/content/list.js
+++ b/toolkit/mozapps/extensions/content/list.js
@@ -16,11 +16,11 @@ const kDialog = "dialog";
* caller can inspect the user action after the dialog closes by inspecting the
* value of the |result| parameter on this object which is set to the dlgtype
* of the button used to close the dialog.
- *
+ *
* window.arguments[0] is an array of strings to display in the tree. If the
* array is empty the tree will not be displayed.
* window.arguments[1] a JS Object with the following properties:
- *
+ *
* title: A title string, to be displayed in the title bar of the dialog.
* message1: A message string, displayed above the addon list
* message2: A message string, displayed below the addon list
@@ -39,7 +39,7 @@ const kDialog = "dialog";
* ...
* },
*
- * result: The dlgtype of button that was used to dismiss the dialog.
+ * result: The dlgtype of button that was used to dismiss the dialog.
*/
"use strict";
@@ -113,7 +113,7 @@ function init() {
message.appendChild(document.createTextNode(params[messageEntry]));
}
}
-
+
document.getElementById("infoIcon").className =
params["iconClass"] ? "spaced " + params["iconClass"] : "spaced alert-icon";
diff --git a/toolkit/mozapps/extensions/content/newaddon.js b/toolkit/mozapps/extensions/content/newaddon.js
index e45b3c1cc..79978a698 100644
--- a/toolkit/mozapps/extensions/content/newaddon.js
+++ b/toolkit/mozapps/extensions/content/newaddon.js
@@ -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 EnableListener_onEnabling(aAddon) {
+ onEnabling: function(aAddon) {
if (aAddon.id == gAddon.id)
window.close();
}
@@ -38,11 +38,14 @@ function initialize() {
let bundle = Services.strings.createBundle("chrome://mozapps/locale/extensions/newaddon.properties");
- 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
+ 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 ||
+#ifdef MOZ_WEBEXTENSIONS
+ aAddon.seen ||
+#endif
!(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) {
window.close();
return;
@@ -79,6 +82,16 @@ function initialize() {
document.getElementById("location").hidden = true;
}
+#ifdef MOZ_WEBEXTENSIONS
+ // 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);
+ }
+#endif
+
var event = document.createEvent("Events");
event.initEvent("AddonDisplayed", true, true);
document.dispatchEvent(event);
diff --git a/toolkit/mozapps/extensions/content/xpinstallConfirm.js b/toolkit/mozapps/extensions/content/xpinstallConfirm.js
index 678e37001..5660cdaaf 100644
--- a/toolkit/mozapps/extensions/content/xpinstallConfirm.js
+++ b/toolkit/mozapps/extensions/content/xpinstallConfirm.js
@@ -6,7 +6,7 @@
var XPInstallConfirm = {};
-XPInstallConfirm.init = function XPInstallConfirm_init()
+XPInstallConfirm.init = function()
{
Components.utils.import("resource://gre/modules/AddonManager.jsm");
@@ -36,7 +36,7 @@ XPInstallConfirm.init = function XPInstallConfirm_init()
var delay_in_milliseconds = prefs.getIntPref("security.dialog_enable_delay");
_installCountdownLength = Math.round(delay_in_milliseconds / 500);
} catch (ex) { }
-
+
var itemList = document.getElementById("itemList");
let installMap = new WeakMap();
@@ -47,7 +47,7 @@ XPInstallConfirm.init = function XPInstallConfirm_init()
window.close();
}
};
-
+
var numItemsToInstall = args.installs.length;
for (let install of args.installs) {
var installItem = document.createElement("installitem");
@@ -72,7 +72,7 @@ XPInstallConfirm.init = function XPInstallConfirm_init()
installMap.set(install, installItem);
install.addListener(installListener);
}
-
+
var introString = bundle.getString("itemWarnIntroSingle");
if (numItemsToInstall > 4)
introString = bundle.getFormattedString("itemWarnIntroMultiple", [numItemsToInstall]);
@@ -81,7 +81,7 @@ XPInstallConfirm.init = function XPInstallConfirm_init()
while (introNode.hasChildNodes())
introNode.removeChild(introNode.firstChild);
introNode.appendChild(textNode);
-
+
var okButton = document.documentElement.getButton("accept");
okButton.focus();
@@ -177,7 +177,7 @@ XPInstallConfirm.init = function XPInstallConfirm_init()
okButton.label = bundle.getString("installButtonLabel");
}
-XPInstallConfirm.onOK = function XPInstallConfirm_onOk()
+XPInstallConfirm.onOK = function()
{
Components.classes["@mozilla.org/base/telemetry;1"].
getService(Components.interfaces.nsITelemetry).
@@ -188,7 +188,7 @@ XPInstallConfirm.onOK = function XPInstallConfirm_onOk()
return true;
}
-XPInstallConfirm.onCancel = function XPInstallConfirm_onCancel()
+XPInstallConfirm.onCancel = function()
{
// Perform the install or cancel after the window has unloaded
XPInstallConfirm._installOK = false;