summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.js20
-rw-r--r--toolkit/mozapps/extensions/content/xpinstallConfirm.js14
-rw-r--r--toolkit/mozapps/webextensions/content/blocklist.js72
-rw-r--r--toolkit/mozapps/webextensions/content/list.js165
-rw-r--r--toolkit/mozapps/webextensions/content/newaddon.js137
-rw-r--r--toolkit/mozapps/webextensions/content/xpinstallConfirm.js196
-rw-r--r--toolkit/mozapps/webextensions/jar.mn8
9 files changed, 30 insertions, 592 deletions
diff --git a/toolkit/mozapps/extensions/content/blocklist.js b/toolkit/mozapps/extensions/content/blocklist.js
index 6b47fd6529..6d524e6eee 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 aac87911ed..a31922703e 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 e45b3c1ccd..b1ad5631b5 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,11 @@ 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
- if (!aAddon || !aAddon.userDisabled ||
+ 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 ||
!(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) {
window.close();
return;
@@ -79,6 +79,14 @@ 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);
diff --git a/toolkit/mozapps/extensions/content/xpinstallConfirm.js b/toolkit/mozapps/extensions/content/xpinstallConfirm.js
index 678e37001e..5660cdaaf7 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;
diff --git a/toolkit/mozapps/webextensions/content/blocklist.js b/toolkit/mozapps/webextensions/content/blocklist.js
deleted file mode 100644
index 6d524e6eee..0000000000
--- a/toolkit/mozapps/webextensions/content/blocklist.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-"use strict";
-
-Components.utils.import("resource://gre/modules/Services.jsm");
-
-var gArgs;
-
-function init() {
- var hasHardBlocks = false;
- var hasSoftBlocks = false;
- gArgs = window.arguments[0].wrappedJSObject;
-
- // NOTE: We use strings from the "updates.properties" bundleset to change the
- // text on the "Cancel" button to "Restart Later". (bug 523784)
- let bundle = Services.strings.
- createBundle("chrome://mozapps/locale/update/updates.properties");
- let cancelButton = document.documentElement.getButton("cancel");
- cancelButton.setAttribute("label", bundle.GetStringFromName("restartLaterButton"));
- cancelButton.setAttribute("accesskey",
- bundle.GetStringFromName("restartLaterButton.accesskey"));
-
- var richlist = document.getElementById("addonList");
- var list = gArgs.list;
- 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);
- item.setAttribute("version", listItem.version);
- item.setAttribute("icon", listItem.icon);
- if (listItem.blocked) {
- item.setAttribute("class", "hardBlockedAddon");
- hasHardBlocks = true;
- }
- else {
- item.setAttribute("class", "softBlockedAddon");
- hasSoftBlocks = true;
- }
- richlist.appendChild(item);
- }
-
- if (hasHardBlocks && hasSoftBlocks)
- document.getElementById("bothMessage").hidden = false;
- else if (hasHardBlocks)
- document.getElementById("hardBlockMessage").hidden = false;
- else
- document.getElementById("softBlockMessage").hidden = false;
-
- var link = document.getElementById("moreInfo");
- if (list.length == 1 && list[0].url) {
- link.setAttribute("href", list[0].url);
- }
- else {
- var url = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
- link.setAttribute("href", url);
- }
-}
-
-function finish(shouldRestartNow) {
- gArgs.restart = shouldRestartNow;
- var list = gArgs.list;
- var items = document.getElementById("addonList").childNodes;
- for (let i = 0; i < list.length; i++) {
- if (!list[i].blocked)
- list[i].disable = items[i].checked;
- }
- return true;
-}
diff --git a/toolkit/mozapps/webextensions/content/list.js b/toolkit/mozapps/webextensions/content/list.js
deleted file mode 100644
index a31922703e..0000000000
--- a/toolkit/mozapps/webextensions/content/list.js
+++ /dev/null
@@ -1,165 +0,0 @@
-// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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/. */
-
-const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
-const kDialog = "dialog";
-
-/**
- * This dialog can be initialized from parameters supplied via window.arguments
- * or it can be used to display blocklist notification and blocklist blocked
- * installs via nsIDialogParamBlock as is done by nsIExtensionManager.
- *
- * When using this dialog with window.arguments it must be opened modally, the
- * 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
- * message3: A bolded message string, displayed below the addon list
- * moreInfoURL: An url for displaying more information
- * iconClass : Can be one of the following values (default is alert-icon)
- * alert-icon, error-icon, or question-icon
- *
- * If no value is supplied for message1, message2, message3, or moreInfoURL,
- * the element is not displayed.
- *
- * buttons: {
- * accept: { label: "A Label for the Accept button",
- * focused: true },
- * cancel: { label: "A Label for the Cancel button" },
- * ...
- * },
- *
- * result: The dlgtype of button that was used to dismiss the dialog.
- */
-
-"use strict";
-
-var gButtons = { };
-
-function init() {
- var de = document.documentElement;
- var items = [];
- if (window.arguments[0] instanceof Components.interfaces.nsIDialogParamBlock) {
- // This is a warning about a blocklisted item the user is trying to install
- var args = window.arguments[0];
- var softblocked = args.GetInt(0) == 1 ? true : false;
-
- var extensionsBundle = document.getElementById("extensionsBundle");
- try {
- var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
- .getService(Components.interfaces.nsIURLFormatter);
- var url = formatter.formatURLPref("extensions.blocklist.detailsURL");
- }
- catch (e) { }
-
- var params = {
- moreInfoURL: url,
- };
-
- if (softblocked) {
- params.title = extensionsBundle.getString("softBlockedInstallTitle");
- params.message1 = extensionsBundle.getFormattedString("softBlockedInstallMsg",
- [args.GetString(0)]);
- var accept = de.getButton("accept");
- accept.label = extensionsBundle.getString("softBlockedInstallAcceptLabel");
- accept.accessKey = extensionsBundle.getString("softBlockedInstallAcceptKey");
- de.getButton("cancel").focus();
- document.addEventListener("dialogaccept", allowInstall, false);
- }
- else {
- params.title = extensionsBundle.getString("blocklistedInstallTitle2");
- params.message1 = extensionsBundle.getFormattedString("blocklistedInstallMsg2",
- [args.GetString(0)]);
- de.buttons = "accept";
- de.getButton("accept").focus();
- }
- }
- else {
- items = window.arguments[0];
- params = window.arguments[1];
- }
-
- var addons = document.getElementById("addonsChildren");
- if (items.length > 0)
- document.getElementById("addonsTree").hidden = false;
-
- // Fill the addons list
- for (var item of items) {
- var treeitem = document.createElementNS(kXULNS, "treeitem");
- var treerow = document.createElementNS(kXULNS, "treerow");
- var treecell = document.createElementNS(kXULNS, "treecell");
- treecell.setAttribute("label", item);
- treerow.appendChild(treecell);
- treeitem.appendChild(treerow);
- addons.appendChild(treeitem);
- }
-
- // Set the messages
- var messages = ["message1", "message2", "message3"];
- for (let messageEntry of messages) {
- if (messageEntry in params) {
- var message = document.getElementById(messageEntry);
- message.hidden = false;
- message.appendChild(document.createTextNode(params[messageEntry]));
- }
- }
-
- document.getElementById("infoIcon").className =
- params["iconClass"] ? "spaced " + params["iconClass"] : "spaced alert-icon";
-
- if ("moreInfoURL" in params && params["moreInfoURL"]) {
- message = document.getElementById("moreInfo");
- message.value = extensionsBundle.getString("moreInfoText");
- message.setAttribute("href", params["moreInfoURL"]);
- document.getElementById("moreInfoBox").hidden = false;
- }
-
- // Set the window title
- if ("title" in params)
- document.title = params.title;
-
- // Set up the buttons
- if ("buttons" in params) {
- gButtons = params.buttons;
- var buttonString = "";
- for (var buttonType in gButtons)
- buttonString += "," + buttonType;
- de.buttons = buttonString.substr(1);
- for (buttonType in gButtons) {
- var button = de.getButton(buttonType);
- button.label = gButtons[buttonType].label;
- if (gButtons[buttonType].focused)
- button.focus();
- document.addEventListener(kDialog + buttonType, handleButtonCommand, true);
- }
- }
-}
-
-function shutdown() {
- for (var buttonType in gButtons)
- document.removeEventListener(kDialog + buttonType, handleButtonCommand, true);
-}
-
-function allowInstall() {
- var args = window.arguments[0];
- args.SetInt(1, 1);
-}
-
-/**
- * Watch for the user hitting one of the buttons to dismiss the dialog
- * and report the result back to the caller through the |result| property on
- * the arguments object.
- */
-function handleButtonCommand(event) {
- window.arguments[1].result = event.type.substr(kDialog.length);
-}
diff --git a/toolkit/mozapps/webextensions/content/newaddon.js b/toolkit/mozapps/webextensions/content/newaddon.js
deleted file mode 100644
index b1ad5631b5..0000000000
--- a/toolkit/mozapps/webextensions/content/newaddon.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AddonManager.jsm");
-
-var gAddon = null;
-
-// If the user enables the add-on through some other UI close this window
-var EnableListener = {
- onEnabling: function(aAddon) {
- if (aAddon.id == gAddon.id)
- window.close();
- }
-}
-AddonManager.addAddonListener(EnableListener);
-
-function initialize() {
- // About URIs don't implement nsIURL so we have to find the query string
- // manually
- let spec = document.location.href;
- let pos = spec.indexOf("?");
- let query = "";
- if (pos >= 0)
- query = spec.substring(pos + 1);
-
- // Just assume the query is "id=<id>"
- let id = query.substring(3);
- if (!id) {
- window.location = "about:blank";
- return;
- }
-
- 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 ||
- !(aAddon.permissions & AddonManager.PERM_CAN_ENABLE)) {
- window.close();
- return;
- }
-
- gAddon = aAddon;
-
- document.getElementById("addon-info").setAttribute("type", aAddon.type);
-
- let icon = document.getElementById("icon");
- if (aAddon.icon64URL)
- icon.src = aAddon.icon64URL;
- else if (aAddon.iconURL)
- icon.src = aAddon.iconURL;
-
- let name = bundle.formatStringFromName("name", [aAddon.name, aAddon.version],
- 2);
- document.getElementById("name").value = name;
-
- if (aAddon.creator) {
- let creator = bundle.formatStringFromName("author", [aAddon.creator], 1);
- document.getElementById("author").value = creator;
- } else {
- document.getElementById("author").hidden = true;
- }
-
- let uri = "getResourceURI" in aAddon ? aAddon.getResourceURI() : null;
- let locationLabel = document.getElementById("location");
- if (uri instanceof Ci.nsIFileURL) {
- let location = bundle.formatStringFromName("location", [uri.file.path], 1);
- locationLabel.value = location;
- locationLabel.setAttribute("tooltiptext", location);
- } else {
- 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);
- });
-}
-
-function unload() {
- AddonManager.removeAddonListener(EnableListener);
-}
-
-function continueClicked() {
- AddonManager.removeAddonListener(EnableListener);
-
- if (document.getElementById("allow").checked) {
- gAddon.userDisabled = false;
-
- if (gAddon.pendingOperations & AddonManager.PENDING_ENABLE) {
- document.getElementById("allow").disabled = true;
- document.getElementById("buttonDeck").selectedPanel = document.getElementById("restartPanel");
- return;
- }
- }
-
- window.close();
-}
-
-function restartClicked() {
- let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].
- createInstance(Ci.nsISupportsPRBool);
- Services.obs.notifyObservers(cancelQuit, "quit-application-requested",
- "restart");
- if (cancelQuit.data)
- return; // somebody canceled our quit request
-
- window.close();
-
- let appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"].
- getService(Components.interfaces.nsIAppStartup);
- appStartup.quit(Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart);
-}
-
-function cancelClicked() {
- gAddon.userDisabled = true;
- AddonManager.addAddonListener(EnableListener);
-
- document.getElementById("allow").disabled = false;
- document.getElementById("buttonDeck").selectedPanel = document.getElementById("continuePanel");
-}
diff --git a/toolkit/mozapps/webextensions/content/xpinstallConfirm.js b/toolkit/mozapps/webextensions/content/xpinstallConfirm.js
deleted file mode 100644
index 5660cdaaf7..0000000000
--- a/toolkit/mozapps/webextensions/content/xpinstallConfirm.js
+++ /dev/null
@@ -1,196 +0,0 @@
-// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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 XPInstallConfirm = {};
-
-XPInstallConfirm.init = function()
-{
- Components.utils.import("resource://gre/modules/AddonManager.jsm");
-
- var _installCountdown;
- var _installCountdownInterval;
- var _focused;
- var _timeout;
-
- // Default to cancelling the install when the window unloads
- XPInstallConfirm._installOK = false;
-
- var bundle = document.getElementById("xpinstallConfirmStrings");
-
- let args = window.arguments[0].wrappedJSObject;
-
- // If all installs have already been cancelled in some way then just close
- // the window
- if (args.installs.every(i => i.state != AddonManager.STATE_DOWNLOADED)) {
- window.close();
- return;
- }
-
- var _installCountdownLength = 5;
- try {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- 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();
- let installListener = {
- onDownloadCancelled: function(install) {
- itemList.removeChild(installMap.get(install));
- if (--numItemsToInstall == 0)
- window.close();
- }
- };
-
- var numItemsToInstall = args.installs.length;
- for (let install of args.installs) {
- var installItem = document.createElement("installitem");
- itemList.appendChild(installItem);
-
- installItem.name = install.addon.name;
- installItem.url = install.sourceURI.spec;
- var icon = install.iconURL;
- if (icon)
- installItem.icon = icon;
- var type = install.type;
- if (type)
- installItem.type = type;
- if (install.certName) {
- installItem.cert = bundle.getFormattedString("signed", [install.certName]);
- }
- else {
- installItem.cert = bundle.getString("unverified");
- }
- installItem.signed = install.certName ? "true" : "false";
-
- installMap.set(install, installItem);
- install.addListener(installListener);
- }
-
- var introString = bundle.getString("itemWarnIntroSingle");
- if (numItemsToInstall > 4)
- introString = bundle.getFormattedString("itemWarnIntroMultiple", [numItemsToInstall]);
- var textNode = document.createTextNode(introString);
- var introNode = document.getElementById("itemWarningIntro");
- while (introNode.hasChildNodes())
- introNode.removeChild(introNode.firstChild);
- introNode.appendChild(textNode);
-
- var okButton = document.documentElement.getButton("accept");
- okButton.focus();
-
- function okButtonCountdown() {
- _installCountdown -= 1;
-
- if (_installCountdown < 1) {
- okButton.label = bundle.getString("installButtonLabel");
- okButton.disabled = false;
- clearInterval(_installCountdownInterval);
- }
- else
- okButton.label = bundle.getFormattedString("installButtonDisabledLabel", [_installCountdown]);
- }
-
- function myfocus() {
- // Clear the timeout if it exists so only the last one will be used.
- if (_timeout)
- clearTimeout(_timeout);
-
- // Use setTimeout since the last focus or blur event to fire is the one we
- // want
- _timeout = setTimeout(setWidgetsAfterFocus, 0);
- }
-
- function setWidgetsAfterFocus() {
- if (_focused)
- return;
-
- _installCountdown = _installCountdownLength;
- _installCountdownInterval = setInterval(okButtonCountdown, 500);
- okButton.label = bundle.getFormattedString("installButtonDisabledLabel", [_installCountdown]);
- _focused = true;
- }
-
- function myblur() {
- // Clear the timeout if it exists so only the last one will be used.
- if (_timeout)
- clearTimeout(_timeout);
-
- // Use setTimeout since the last focus or blur event to fire is the one we
- // want
- _timeout = setTimeout(setWidgetsAfterBlur, 0);
- }
-
- function setWidgetsAfterBlur() {
- if (!_focused)
- return;
-
- // Set _installCountdown to the inital value set in setWidgetsAfterFocus
- // plus 1 so when the window is focused there is immediate ui feedback.
- _installCountdown = _installCountdownLength + 1;
- okButton.label = bundle.getFormattedString("installButtonDisabledLabel", [_installCountdown]);
- okButton.disabled = true;
- clearInterval(_installCountdownInterval);
- _focused = false;
- }
-
- function myUnload() {
- if (_installCountdownLength > 0) {
- document.removeEventListener("focus", myfocus, true);
- document.removeEventListener("blur", myblur, true);
- }
- window.removeEventListener("unload", myUnload, false);
-
- for (let install of args.installs)
- install.removeListener(installListener);
-
- // Now perform the desired action - either install the
- // addons or cancel the installations
- if (XPInstallConfirm._installOK) {
- for (let install of args.installs)
- install.install();
- }
- else {
- for (let install of args.installs) {
- if (install.state != AddonManager.STATE_CANCELLED)
- install.cancel();
- }
- }
- }
-
- window.addEventListener("unload", myUnload, false);
-
- if (_installCountdownLength > 0) {
- document.addEventListener("focus", myfocus, true);
- document.addEventListener("blur", myblur, true);
-
- okButton.disabled = true;
- setWidgetsAfterFocus();
- }
- else
- okButton.label = bundle.getString("installButtonLabel");
-}
-
-XPInstallConfirm.onOK = function()
-{
- Components.classes["@mozilla.org/base/telemetry;1"].
- getService(Components.interfaces.nsITelemetry).
- getHistogramById("SECURITY_UI").
- add(Components.interfaces.nsISecurityUITelemetry.WARNING_CONFIRM_ADDON_INSTALL_CLICK_THROUGH);
- // Perform the install or cancel after the window has unloaded
- XPInstallConfirm._installOK = true;
- return true;
-}
-
-XPInstallConfirm.onCancel = function()
-{
- // Perform the install or cancel after the window has unloaded
- XPInstallConfirm._installOK = false;
- return true;
-}
diff --git a/toolkit/mozapps/webextensions/jar.mn b/toolkit/mozapps/webextensions/jar.mn
index 6da7dc8932..ad3c457103 100644
--- a/toolkit/mozapps/webextensions/jar.mn
+++ b/toolkit/mozapps/webextensions/jar.mn
@@ -13,9 +13,9 @@ toolkit.jar:
content/mozapps/extensions/about.xul (../extensions/content/about.xul)
content/mozapps/extensions/about.js (content/about.js)
content/mozapps/extensions/list.xul (../extensions/content/list.xul)
- content/mozapps/extensions/list.js (content/list.js)
+ content/mozapps/extensions/list.js (../extensions/content/list.js)
content/mozapps/extensions/blocklist.xul (../extensions/content/blocklist.xul)
- content/mozapps/extensions/blocklist.js (content/blocklist.js)
+ content/mozapps/extensions/blocklist.js (../extensions/content/blocklist.js)
content/mozapps/extensions/blocklist.css (../extensions/content/blocklist.css)
content/mozapps/extensions/blocklist.xml (../extensions/content/blocklist.xml)
* content/mozapps/extensions/update.xul (content/update.xul)
@@ -23,13 +23,13 @@ toolkit.jar:
content/mozapps/extensions/eula.xul (../extensions/content/eula.xul)
content/mozapps/extensions/eula.js (content/eula.js)
content/mozapps/extensions/newaddon.xul (content/newaddon.xul)
- content/mozapps/extensions/newaddon.js (content/newaddon.js)
+ content/mozapps/extensions/newaddon.js (../extensions/content/newaddon.js)
content/mozapps/extensions/pluginPrefs.xul (../extensions/content/pluginPrefs.xul)
content/mozapps/extensions/gmpPrefs.xul (../extensions/content/gmpPrefs.xul)
content/mozapps/extensions/OpenH264-license.txt (../extensions/content/OpenH264-license.txt)
#endif
content/mozapps/extensions/setting.xml (content/setting.xml)
content/mozapps/xpinstall/xpinstallConfirm.xul (../extensions/content/xpinstallConfirm.xul)
- content/mozapps/xpinstall/xpinstallConfirm.js (content/xpinstallConfirm.js)
+ content/mozapps/xpinstall/xpinstallConfirm.js (../extensions/content/xpinstallConfirm.js)
content/mozapps/xpinstall/xpinstallConfirm.css (../extensions/content/xpinstallConfirm.css)
content/mozapps/xpinstall/xpinstallItem.xml (../extensions/content/xpinstallItem.xml)