--- a/toolkit/mozapps/extensions/.eslintrc.js
+++ b/toolkit/mozapps/extensions/.eslintrc.js
@@ -1,8 +1,10 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"rules": {
// No using undeclared variables
"no-undef": "error",
+
+ "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
}
};
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -58,18 +58,16 @@ const KEY_APPDIR =
const FILE_BLOCKLIST = "blocklist.xml";
const BRANCH_REGEXP = /^([^\.]+\.[0-9]+[a-z]*).*/gi;
const PREF_EM_CHECK_COMPATIBILITY_BASE = "extensions.checkCompatibility";
var PREF_EM_CHECK_COMPATIBILITY = MOZ_COMPATIBILITY_NIGHTLY ?
PREF_EM_CHECK_COMPATIBILITY_BASE + ".nightly" :
undefined;
-const TOOLKIT_ID = "toolkit@mozilla.org";
-
const VALID_TYPES_REGEXP = /^[\w\-]+$/;
const WEBAPI_INSTALL_HOSTS = ["addons.mozilla.org", "testpilot.firefox.com"];
const WEBAPI_TEST_INSTALL_HOSTS = [
"addons.allizom.org", "addons-dev.allizom.org",
"testpilot.stage.mozaws.net", "testpilot.dev.mozaws.net",
"example.com",
];
@@ -1305,28 +1303,26 @@ var AddonManagerInternal = {
this.callManagerListeners("onCheckUpdateSecurityChanged");
if (gCheckUpdateSecurity != oldValue)
this.updateAddonAppDisabledStates();
break;
}
case PREF_EM_UPDATE_ENABLED: {
- let oldValue = gUpdateEnabled;
try {
gUpdateEnabled = Services.prefs.getBoolPref(PREF_EM_UPDATE_ENABLED);
} catch (e) {
gUpdateEnabled = true;
}
this.callManagerListeners("onUpdateModeChanged");
break;
}
case PREF_EM_AUTOUPDATE_DEFAULT: {
- let oldValue = gAutoUpdateDefault;
try {
gAutoUpdateDefault = Services.prefs.getBoolPref(PREF_EM_AUTOUPDATE_DEFAULT);
} catch (e) {
gAutoUpdateDefault = true;
}
this.callManagerListeners("onUpdateModeChanged");
break;
--- a/toolkit/mozapps/extensions/content/about.js
+++ b/toolkit/mozapps/extensions/content/about.js
@@ -3,16 +3,18 @@
/* 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";
/* import-globals-from ../../../content/contentAreaUtils.js */
+/* exported init, loadHomepage */
+
var Cu = Components.utils;
Cu.import("resource://gre/modules/AddonManager.jsm");
function init() {
var addon = window.arguments[0];
var extensionsStrings = document.getElementById("extensionsStrings");
document.documentElement.setAttribute("addontype", addon.type);
--- a/toolkit/mozapps/extensions/content/blocklist.js
+++ b/toolkit/mozapps/extensions/content/blocklist.js
@@ -1,16 +1,18 @@
// -*- 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";
+/* exported init, finish */
+
Components.utils.import("resource://gre/modules/Services.jsm");
var gArgs;
function init() {
var hasHardBlocks = false;
var hasSoftBlocks = false;
gArgs = window.arguments[0].wrappedJSObject;
--- a/toolkit/mozapps/extensions/content/eula.js
+++ b/toolkit/mozapps/extensions/content/eula.js
@@ -1,16 +1,18 @@
// -*- 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";
+/* exported Startup */
+
var Cu = Components.utils;
Cu.import("resource://gre/modules/AddonManager.jsm");
function Startup() {
var bundle = document.getElementById("extensionsStrings");
var addon = window.arguments[0].addon;
document.documentElement.setAttribute("addontype", addon.type);
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1,16 +1,17 @@
/* 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";
/* import-globals-from ../../../content/contentAreaUtils.js */
-/* globals XMLStylesheetProcessingInstruction*/
+/* globals XMLStylesheetProcessingInstruction */
+/* exported UPDATES_RELEASENOTES_TRANSFORMFILE, XMLURI_PARSE_ERROR, loadView */
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
var Cr = Components.results;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@@ -3164,18 +3165,16 @@ var gDetailView = {
aAddonId = aAddonId.substring(0, index);
scrollToPreferences = true;
}
this._loadingTimer = setTimeout(() => {
this.node.setAttribute("loading-extended", true);
}, LOADING_MSG_DELAY);
- var view = gViewController.currentViewId;
-
AddonManager.getAddonByID(aAddonId, (aAddon) => {
if (gViewController && aRequest != gViewController.currentViewRequest)
return;
if (aAddon) {
this._updateView(aAddon, false, scrollToPreferences);
return;
}
--- a/toolkit/mozapps/extensions/content/list.js
+++ b/toolkit/mozapps/extensions/content/list.js
@@ -1,13 +1,16 @@
// -*- 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";
+
+/* exported init, shutdown */
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.
@@ -37,18 +40,16 @@ const kDialog = "dialog";
* 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];
--- a/toolkit/mozapps/extensions/content/newaddon.js
+++ b/toolkit/mozapps/extensions/content/newaddon.js
@@ -1,12 +1,14 @@
/* 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/. */
+/* exported cancelClicked, continueClicked, initialize, restartClicked, unload */
+
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;
--- a/toolkit/mozapps/extensions/content/update.js
+++ b/toolkit/mozapps/extensions/content/update.js
@@ -3,16 +3,19 @@
/* 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/. */
// This UI is only opened from the Extension Manager when the app is upgraded.
"use strict";
+/* exported gAdminDisabledPage, gFinishedPage, gFoundPage, gInstallErrorsPage,
+ * gNoUpdatesPage, gOfflinePage, gUpdatePage */
+
const PREF_UPDATE_EXTENSIONS_ENABLED = "extensions.update.enabled";
const PREF_XPINSTALL_ENABLED = "xpinstall.enabled";
// timeout (in milliseconds) to wait for response to the metadata ping
const METADATA_TIMEOUT = 30000;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager", "resource://gre/modules/AddonManager.jsm");
@@ -406,17 +409,16 @@ var gUpdatePage = {
var gFoundPage = {
onPageShow: function()
{
gUpdateWizard.setButtonLabels(null, true,
"installButtonText", false,
null, false);
var foundUpdates = document.getElementById("found.updates");
- var itemCount = gUpdateWizard.addonsToUpdate.length;
for (let install of gUpdateWizard.addonsToUpdate) {
let listItem = foundUpdates.appendItem(install.name + " " + install.version);
listItem.setAttribute("type", "checkbox");
listItem.setAttribute("checked", "true");
listItem.install = install;
}
if (!gUpdateWizard.xpinstallEnabled) {
--- a/toolkit/mozapps/extensions/internal/APIExtensionBootstrap.js
+++ b/toolkit/mozapps/extensions/internal/APIExtensionBootstrap.js
@@ -1,14 +1,16 @@
/* 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";
+/* exported startup, shutdown, install, uninstall */
+
Components.utils.import("resource://gre/modules/ExtensionManagement.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
var namespace;
var resource;
var resProto;
function install(data, reason) {
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -46,17 +46,16 @@ const PREF_METADATA_LASTUPDATE
const PREF_METADATA_UPDATETHRESHOLD_SEC = "extensions.getAddons.cache.updateThreshold";
const DEFAULT_METADATA_UPDATETHRESHOLD_SEC = 172800; // two days
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
const API_VERSION = "1.5";
const DEFAULT_CACHE_TYPES = "extension,theme,locale,dictionary";
-const KEY_PROFILEDIR = "ProfD";
const FILE_DATABASE = "addons.json";
const DB_SCHEMA = 5;
const DB_MIN_JSON_SCHEMA = 5;
const DB_BATCH_TIMEOUT_MS = 50;
const BLANK_DB = function() {
return {
addons: new Map(),
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -406,17 +406,17 @@ GMPWrapper.prototype = {
this._log.trace("receiveMessage() data=" + data);
let parsedData;
try {
parsedData = JSON.parse(data);
} catch (ex) {
this._log.error("Malformed EME video message with data: " + data);
return;
}
- let {status: status, keySystem: keySystem} = parsedData;
+ let {status} = parsedData;
if (status == "cdm-not-installed") {
this.checkForUpdates(0);
}
},
onPrefEnabledChanged: function() {
if (!this._plugin.isEME || !this.appDisabled) {
this._handleEnabledChanged();
@@ -538,17 +538,17 @@ var GMPProvider = {
configureLogging();
this._log = Log.repository.getLoggerWithMessagePrefix("Toolkit.GMP",
"GMPProvider.");
this.buildPluginList();
this.ensureProperCDMInstallState();
Preferences.observe(GMPPrefs.KEY_LOG_BASE, configureLogging);
- for (let [id, plugin] of this._plugins) {
+ for (let plugin of this._plugins.values()) {
let wrapper = plugin.wrapper;
let gmpPath = wrapper.gmpPath;
let isEnabled = wrapper.isActive;
this._log.trace("startup - enabled=" + isEnabled + ", gmpPath=" +
gmpPath);
if (gmpPath && isEnabled) {
let validation = wrapper.validate();
@@ -676,17 +676,17 @@ var GMPProvider = {
plugin.fullDescription = this.generateFullDescription(aPlugin);
plugin.wrapper = new GMPWrapper(plugin);
this._plugins.set(plugin.id, plugin);
}
},
ensureProperCDMInstallState: function() {
if (!GMPPrefs.get(GMPPrefs.KEY_EME_ENABLED, true)) {
- for (let [id, plugin] of this._plugins) {
+ for (let plugin of this._plugins.values()) {
if (plugin.isEME && plugin.wrapper.isInstalled) {
gmpService.addPluginDirectory(plugin.wrapper.gmpPath);
plugin.wrapper.uninstallPlugin();
}
}
}
},
};
--- a/toolkit/mozapps/extensions/internal/PluginProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/PluginProvider.jsm
@@ -1,14 +1,16 @@
/* 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";
+/* exported logger */
+
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
this.EXPORTED_SYMBOLS = [];
Cu.import("resource://gre/modules/AddonManager.jsm");
/* globals AddonManagerPrivate*/
--- a/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/ProductAddonChecker.jsm
@@ -1,14 +1,16 @@
/* 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";
+/* exported ProductAddonChecker */
+
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
const LOCAL_EME_SOURCES = [{
"id": "gmp-eme-adobe",
"src": "chrome://global/content/gmp-sources/eme-adobe.json"
}, {
"id": "gmp-gmpopenh264",
"src": "chrome://global/content/gmp-sources/openh264.json"
@@ -53,20 +55,16 @@ var CreateXHR = function() {
* Number of milliseconds after which we need to cancel `downloadXML`.
*
* Bug 1087674 suggests that the XHR we use in `downloadXML` may
* never terminate in presence of network nuisances (e.g. strange
* antivirus behavior). This timeout is a defensive measure to ensure
* that we fail cleanly in such case.
*/
const TIMEOUT_DELAY_MS = 20000;
-// Chunk size for the incremental downloader
-const DOWNLOAD_CHUNK_BYTES_SIZE = 300000;
-// Incremental downloader interval
-const DOWNLOAD_INTERVAL = 0;
// How much of a file to read into memory at a time for hashing
const HASH_CHUNK_SIZE = 8192;
/**
* Gets the status of an XMLHttpRequest either directly or from its underlying
* channel.
*
* @param request
--- a/toolkit/mozapps/extensions/internal/SpellCheckDictionaryBootstrap.js
+++ b/toolkit/mozapps/extensions/internal/SpellCheckDictionaryBootstrap.js
@@ -1,12 +1,14 @@
/* 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/. */
+/* exported startup, shutdown */
+
var hunspell, dir;
function startup(data) {
hunspell = Components.classes["@mozilla.org/spellchecker/engine;1"]
.getService(Components.interfaces.mozISpellCheckingEngine);
dir = data.installPath.clone();
dir.append("dictionaries");
hunspell.addDirectory(dir);
--- a/toolkit/mozapps/extensions/internal/WebExtensionBootstrap.js
+++ b/toolkit/mozapps/extensions/internal/WebExtensionBootstrap.js
@@ -1,14 +1,16 @@
/* 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";
+/* exported startup, shutdown, install, uninstall */
+
Components.utils.import("resource://gre/modules/Extension.jsm");
var extension;
const BOOTSTRAP_REASON_TO_STRING_MAP = {
1: "APP_STARTUP",
2: "APP_SHUTDOWN",
3: "ADDON_ENABLE",
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -2326,31 +2326,29 @@ this.XPIStates = {
logger.debug("Existing add-on ${id} in ${location}", {id: id, location: location.name});
}
foundAddons.set(id, xpiState);
}
XPIProvider.setTelemetry(id, "location", location.name);
}
// Anything left behind in oldState was removed from the file system.
- for (let id in locState) {
+ if (Object.keys(locState).length) {
changed = true;
- break;
}
// If we found anything, add this location to our database.
if (foundAddons.size != 0) {
this.db.set(location.name, foundAddons);
}
}
// If there's anything left in oldState, an install location that held add-ons
// was removed from the browser configuration.
- for (let location in oldState) {
+ if (Object.keys(oldState).length) {
changed = true;
- break;
}
logger.debug("getInstallState changed: ${rv}, state: ${state}",
{rv: changed, state: this.db});
return changed;
},
/**
@@ -4784,19 +4782,16 @@ this.XPIProvider = {
uri = "resource://gre/modules/addons/APIExtensionBootstrap.js"
activeAddon.bootstrapScope =
new Cu.Sandbox(principal, { sandboxName: uri,
wantGlobalProperties: ["indexedDB"],
addonId: aId,
metadata: { addonID: aId, URI: uri } });
- let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- createInstance(Ci.mozIJSSubScriptLoader);
-
try {
// Copy the reason values from the global object into the bootstrap scope.
for (let name in BOOTSTRAP_REASONS)
activeAddon.bootstrapScope[name] = BOOTSTRAP_REASONS[name];
// Add other stuff that extensions want.
const features = [ "Worker", "ChromeWorker" ];
@@ -4808,17 +4803,17 @@ this.XPIProvider = {
{ consoleID: "addon/" + aId });
// As we don't want our caller to control the JS version used for the
// bootstrap file, we run loadSubScript within the context of the
// sandbox with the latest JS version set explicitly.
activeAddon.bootstrapScope.__SCRIPT_URI_SPEC__ = uri;
Components.utils.evalInSandbox(
"Components.classes['@mozilla.org/moz/jssubscript-loader;1'] \
- .createInstance(Components.interfaces.mozIJSSubScriptLoader) \
+ .getService(Components.interfaces.mozIJSSubScriptLoader) \
.loadSubScript(__SCRIPT_URI_SPEC__);",
activeAddon.bootstrapScope, "ECMAv5");
}
catch (e) {
logger.warn("Error loading bootstrap.js for " + aId, e);
}
// Only access BrowserToolboxProcess if ToolboxProcess.jsm has been
@@ -5608,18 +5603,16 @@ class AddonInstall {
aZipReader.close();
if (files.length == 0) {
return Promise.reject([AddonManager.ERROR_CORRUPT_FILE,
"Multi-package XPI does not contain any packages to install"]);
}
- let addon = null;
-
// Find the first file that is a valid install and use it for
// the add-on that this AddonInstall instance will install.
for (let { entryName, file } of files) {
this.removeTemporaryFile();
try {
yield this.loadManifest(file);
logger.debug("Base multi-package XPI install came from " + entryName);
this.file = file;
@@ -8012,19 +8005,18 @@ PROP_LOCALE_SINGLE.forEach(function(aPro
let value = Preferences.get(pref, null, Ci.nsIPrefLocalizedString);
if (value)
result = value;
}
catch (e) {
}
}
- let rest;
if (result == null)
- [result, ...rest] = chooseValue(addon, addon.selectedLocale, aProp);
+ [result] = chooseValue(addon, addon.selectedLocale, aProp);
if (aProp == "creator")
return result ? new AddonManagerPrivate.AddonAuthor(result) : null;
return result;
});
});
@@ -8991,19 +8983,16 @@ Object.assign(SystemAddonInstallLocation
*/
resumeAddonSet: Task.async(function*(installs) {
let resumeAddon = Task.async(function*(install) {
install.state = AddonManager.STATE_DOWNLOADED;
install.installLocation.releaseStagingDir();
install.install();
});
- let addonSet = this._loadAddonSet();
- let addonIDs = Object.keys(addonSet.addons);
-
let blockers = installs.filter(
install => AddonManagerPrivate.hasUpgradeListener(install.addon.id)
);
if (blockers.length > 1) {
logger.warn("Attempted to resume system add-on install but upgrade blockers are still present");
} else {
yield waitForAllPromises(installs.map(resumeAddon));
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -242,26 +242,16 @@ function* resultRows(aStatement) {
* @param aErrorString
* An error message
*/
function logSQLError(aError, aErrorString) {
logger.error("SQL error " + aError + ": " + aErrorString);
}
/**
- * A helper function to log any errors that occur during async statements.
- *
- * @param aError
- * A mozIStorageError to log
- */
-function asyncErrorLogger(aError) {
- logSQLError(aError.result, aError.message);
-}
-
-/**
* A helper function to step a statement synchronously and log any error that
* occurs.
*
* @param aStatement
* A mozIStorageStatement to execute
*/
function stepStatement(aStatement) {
try {
@@ -292,37 +282,16 @@ function copyProperties(aObject, aProper
aProperties.forEach(function(aProp) {
if (aProp in aObject)
aTarget[aProp] = aObject[aProp];
});
return aTarget;
}
/**
- * Copies properties from a mozIStorageRow to an object. If no target object is
- * passed a new object will be created and returned.
- *
- * @param aRow
- * A mozIStorageRow to copy from
- * @param aProperties
- * An array of properties to be copied
- * @param aTarget
- * An optional target object to copy the properties to
- * @return the object that the properties were copied onto
- */
-function copyRowProperties(aRow, aProperties, aTarget) {
- if (!aTarget)
- aTarget = {};
- aProperties.forEach(function(aProp) {
- aTarget[aProp] = aRow.getResultByName(aProp);
- });
- return aTarget;
-}
-
-/**
* The DBAddonInternal is a special AddonInternal that has been retrieved from
* the database. The constructor will initialize the DBAddonInternal with a set
* of fields, which could come from either the JSON store or as an
* XPIProvider.AddonInternal created from an addon's manifest
* @constructor
* @param aLoaded
* Addon data fields loaded from JSON or the addon manifest.
*/
@@ -1582,17 +1551,17 @@ this.XPIDatabaseReconcile = {
},
/**
* Finds the visible add-ons from the map.
*/
getVisibleAddons(addonMap) {
let map = new Map();
- for (let [location, addons] of addonMap) {
+ for (let addons of addonMap.values()) {
for (let [id, addon] of addons) {
if (!addon.visible)
continue;
if (map.has(id)) {
logger.warn("Previous database listed more than one visible add-on with id " + id);
continue;
}
@@ -2023,17 +1992,17 @@ this.XPIDatabaseReconcile = {
}
}
// previousAddons may contain locations where the database contains add-ons
// but the browser is no longer configured to use that location. The metadata
// for those add-ons must be removed from the database.
for (let [locationName, addons] of previousAddons) {
if (!currentAddons.has(locationName)) {
- for (let [id, oldAddon] of addons)
+ for (let oldAddon of addons.values())
this.removeMetadata(oldAddon);
}
}
// Validate the updated system add-ons
let systemAddonLocation = XPIProvider.installLocationsByName[KEY_APP_SYSTEM_ADDONS];
let addons = currentAddons.get(KEY_APP_SYSTEM_ADDONS) || new Map();
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -35,30 +35,28 @@ XPCOMUtils.defineLazyModuleGetter(this,
const TOOLKIT_ID = "toolkit@mozilla.org";
const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const FILE_BLOCKLIST = "blocklist.xml";
const PREF_BLOCKLIST_LASTUPDATETIME = "app.update.lastUpdateTime.blocklist-background-update-timer";
const PREF_BLOCKLIST_URL = "extensions.blocklist.url";
const PREF_BLOCKLIST_ITEM_URL = "extensions.blocklist.itemURL";
const PREF_BLOCKLIST_ENABLED = "extensions.blocklist.enabled";
-const PREF_BLOCKLIST_INTERVAL = "extensions.blocklist.interval";
const PREF_BLOCKLIST_LEVEL = "extensions.blocklist.level";
const PREF_BLOCKLIST_PINGCOUNTTOTAL = "extensions.blocklist.pingCountTotal";
const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion";
const PREF_BLOCKLIST_SUPPRESSUI = "extensions.blocklist.suppressUI";
const PREF_ONECRL_VIA_AMO = "security.onecrl.via.amo";
const PREF_BLOCKLIST_UPDATE_ENABLED = "services.blocklist.update_enabled";
const PREF_GENERAL_USERAGENT_LOCALE = "general.useragent.locale";
const PREF_APP_DISTRIBUTION = "distribution.id";
const PREF_APP_DISTRIBUTION_VERSION = "distribution.version";
const PREF_EM_LOGGING_ENABLED = "extensions.logging.enabled";
const XMLURI_BLOCKLIST = "http://www.mozilla.org/2006/addons-blocklist";
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"
-const UNKNOWN_XPCOM_ABI = "unknownABI";
const URI_BLOCKLIST_DIALOG = "chrome://mozapps/content/extensions/blocklist.xul"
const DEFAULT_SEVERITY = 3;
const DEFAULT_LEVEL = 2;
const MAX_BLOCK_LEVEL = 3;
const SEVERITY_OUTDATED = 0;
const VULNERABILITYSTATUS_NONE = 0;
const VULNERABILITYSTATUS_UPDATE_AVAILABLE = 1;
const VULNERABILITYSTATUS_NO_UPDATE = 2;
@@ -1246,17 +1244,17 @@ Blocklist.prototype = {
_getPluginBlocklistState: function(plugin, pluginEntries, appVersion, toolkitVersion) {
let r = this._getPluginBlocklistEntry(plugin, pluginEntries,
appVersion, toolkitVersion);
if (!r) {
return Ci.nsIBlocklistService.STATE_NOT_BLOCKED;
}
- let {entry: blockEntry, version: blockEntryVersion} = r;
+ let {version: blockEntryVersion} = r;
if (blockEntryVersion.severity >= gBlocklistLevel)
return Ci.nsIBlocklistService.STATE_BLOCKED;
if (blockEntryVersion.severity == SEVERITY_OUTDATED) {
let vulnerabilityStatus = blockEntryVersion.vulnerabilityStatus;
if (vulnerabilityStatus == VULNERABILITYSTATUS_UPDATE_AVAILABLE)
return Ci.nsIBlocklistService.STATE_VULNERABLE_UPDATE_AVAILABLE;
if (vulnerabilityStatus == VULNERABILITYSTATUS_NO_UPDATE)
@@ -1270,34 +1268,34 @@ Blocklist.prototype = {
getPluginBlocklistURL: function(plugin) {
if (!this._isBlocklistLoaded())
this._loadBlocklist();
let r = this._getPluginBlocklistEntry(plugin, this._pluginEntries);
if (!r) {
return null;
}
- let {entry: blockEntry, version: blockEntryVersion} = r;
+ let {entry: blockEntry} = r;
if (!blockEntry.blockID) {
return null;
}
return this._createBlocklistURL(blockEntry.blockID);
},
/* See nsIBlocklistService */
getPluginInfoURL: function(plugin) {
if (!this._isBlocklistLoaded())
this._loadBlocklist();
let r = this._getPluginBlocklistEntry(plugin, this._pluginEntries);
if (!r) {
return null;
}
- let {entry: blockEntry, version: blockEntryVersion} = r;
+ let {entry: blockEntry} = r;
if (!blockEntry.blockID) {
return null;
}
return blockEntry.infoURL;
},
_notifyObserversBlocklistGFX: function() {
--- a/toolkit/mozapps/extensions/test/addons/bootstrap_globals/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/bootstrap_globals/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
var seenGlobals = new Set();
var scope = this;
function checkGlobal(name, type) {
if (scope[name] && typeof(scope[name]) == type)
seenGlobals.add(name);
}
--- a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js
@@ -1,5 +1,6 @@
+/* exported install */
Components.utils.import("resource://gre/modules/Services.jsm");
const install = function() {
Services.obs.notifyObservers(null, "addon-install", "");
}
--- a/toolkit/mozapps/extensions/test/addons/test_bug567184/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_bug567184/bootstrap.js
@@ -1,7 +1,8 @@
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) { }
function startup(data, reason) { }
function shutdown(data, reason) { }
function uninstall(data, reason) {}
--- a/toolkit/mozapps/extensions/test/addons/test_bug655254_2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_bug655254_2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown */
Components.utils.import("resource://gre/modules/Services.jsm");
function startup(data, reason) {
Services.prefs.setIntPref("bootstraptest.active_version", 1);
}
function shutdown(data, reason) {
Services.prefs.setIntPref("bootstraptest.active_version", 0);
--- a/toolkit/mozapps/extensions/test/addons/test_bug675371/test.js
+++ b/toolkit/mozapps/extensions/test/addons/test_bug675371/test.js
@@ -1,1 +1,2 @@
+/* exported active */
var active = true;
--- a/toolkit/mozapps/extensions/test/addons/test_bug740612_1/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_bug740612_1/bootstrap.js
@@ -1,1 +1,2 @@
+/* exported APP_STARTUP */
const APP_STARTUP = 1;
--- a/toolkit/mozapps/extensions/test/addons/test_bug740612_2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_bug740612_2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
const VERSION = "1.0";
function install(data, reason) {
Services.prefs.setIntPref("bootstraptest.installed_version", VERSION);
Services.prefs.setIntPref("bootstraptest.install_reason", reason);
}
--- a/toolkit/mozapps/extensions/test/addons/test_delay_update_complete_v2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_delay_update_complete_v2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, ADDON_ID */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const ADDON_ID = "test_delay_update_complete@tests.mozilla.org";
function install(data, reason) {}
function startup(data, reason) {}
--- a/toolkit/mozapps/extensions/test/addons/test_delay_update_defer_v2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_delay_update_defer_v2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, ADDON_ID */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const ADDON_ID = "test_delay_update_defer@tests.mozilla.org";
function install(data, reason) {}
function startup(data, reason) {}
--- a/toolkit/mozapps/extensions/test/addons/test_delay_update_ignore_v2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_delay_update_ignore_v2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
function install(data, reason) {}
function startup(data, reason) {}
function shutdown(data, reason) {}
--- a/toolkit/mozapps/extensions/test/addons/test_jetpack/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_jetpack/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
function install(data, reason) {
Services.prefs.setIntPref("jetpacktest.installed_version", 1);
}
function startup(data, reason) {
Services.prefs.setIntPref("jetpacktest.active_version", 1);
--- a/toolkit/mozapps/extensions/test/addons/test_symbol/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_symbol/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall, ADDON_ID */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const PASS_PREF = "symboltest.instanceid.pass";
const FAIL_BOGUS_PREF = "symboltest.instanceid.fail_bogus";
const FAIL_ID_PREF = "symboltest.instanceid.fail_bogus";
const ADDON_ID = "test_symbol@tests.mozilla.org";
--- a/toolkit/mozapps/extensions/test/addons/test_update_multi1/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_update_multi1/bootstrap.js
@@ -1,5 +1,6 @@
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) {}
function startup(data, reason) {}
function shutdown(data, reason) {}
function uninstall(data, reason) {}
--- a/toolkit/mozapps/extensions/test/addons/test_updateid1/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_updateid1/bootstrap.js
@@ -1,5 +1,6 @@
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) {}
function startup(data, reason) {}
function shutdown(data, reason) {}
function uninstall(data, reason) {}
--- a/toolkit/mozapps/extensions/test/addons/test_updateid2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/addons/test_updateid2/bootstrap.js
@@ -1,5 +1,6 @@
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) {}
function startup(data, reason) {}
function shutdown(data, reason) {}
function uninstall(data, reason) {}
--- a/toolkit/mozapps/extensions/test/browser/.eslintrc.js
+++ b/toolkit/mozapps/extensions/test/browser/.eslintrc.js
@@ -1,7 +1,11 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"extends": [
"../../../../../testing/mochitest/browser.eslintrc.js"
- ]
+ ],
+
+ "rules": {
+ "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS|end_test)$"}],
+ }
};
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
function install(params, aReason) {
}
function uninstall(params, aReason) {
}
function startup(params, aReason) {
}
function shutdown(params, aReason) {
}
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_custom/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
function install(params, aReason) {
}
function uninstall(params, aReason) {
}
function startup(params, aReason) {
}
function shutdown(params, aReason) {
}
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_info/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_inlinesettings1_info/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
function install(params, aReason) {
}
function uninstall(params, aReason) {
}
function startup(params, aReason) {
}
function shutdown(params, aReason) {
}
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_searching/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_searching/bootstrap.js
@@ -1,9 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) {}
function startup(data, reason) {}
function shutdown(data, reason) {}
function uninstall(data, reason) {}
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_update1_1/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_update1_1/bootstrap.js
@@ -1,11 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) {}
function startup(data, reason) {
Components.utils.import("resource://gre/modules/Services.jsm");
Services.ppmm.loadProcessScript(
"resource://my-addon/frame-script.js", false);
}
function shutdown(data, reason) {}
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_update1_2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_update1_2/bootstrap.js
@@ -1,11 +1,12 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
+/* exported startup, shutdown, install, uninstall */
function install(data, reason) {}
function startup(data, reason) {
Components.utils.import("resource://gre/modules/Services.jsm");
Services.ppmm.loadProcessScript(
"resource://my-addon/frame-script.js", false);
}
function shutdown(data, reason) {}
--- a/toolkit/mozapps/extensions/test/browser/addons/browser_webapi_install/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/browser/addons/browser_webapi_install/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
function startup(data, reason) {
Services.prefs.setIntPref("webapitest.active_version", 1);
}
function shutdown(data, reason) {
Services.prefs.setIntPref("webapitest.active_version", 0);
--- a/toolkit/mozapps/extensions/test/browser/browser_CTP_plugins.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_CTP_plugins.js
@@ -49,16 +49,17 @@ add_task(function*() {
if (plugin.name == "Test Plug-in") {
testPluginId = plugin.id;
break;
}
}
ok(testPluginId, "part2: Test Plug-in should exist");
let testPlugin = yield new Promise(resolve => AddonManager.getAddonByID(testPluginId, resolve));
+ isnot(testPlugin, null, "part2.1: Test Plug-in should exist");
let pluginEl = get_addon_element(managerWindow, testPluginId);
pluginEl.parentNode.ensureElementIsVisible(pluginEl);
let enableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "enable-btn");
is_element_hidden(enableButton, "part3: enable button should not be visible");
let disableButton = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "enable-btn");
is_element_hidden(disableButton, "part3: disable button should not be visible");
let menu = managerWindow.document.getAnonymousElementByAttribute(pluginEl, "anonid", "state-menulist");
--- a/toolkit/mozapps/extensions/test/browser/browser_addonrepository_performance.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_addonrepository_performance.js
@@ -4,17 +4,16 @@
// Tests that the metadata request includes startup time measurements
var tmp = {};
Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm", tmp);
var AddonRepository = tmp.AddonRepository;
var gTelemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
-var gManagerWindow;
var gProvider;
function parseParams(aQuery) {
let params = {};
for (let param of aQuery.split("&")) {
let [key, value] = param.split("=");
params[key] = value;
--- a/toolkit/mozapps/extensions/test/browser/browser_bug562797.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug562797.js
@@ -234,22 +234,16 @@ add_test(function() {
// Tests that browsing to the add-ons manager from a website and going back works
// Only relevant for in-content UI
add_test(function() {
if (!gUseInContentUI) {
run_next_test();
return;
}
- function promiseViewLoad(manager) {
- return new Promise(resolve => {
- wait_for_view_load(manager, resolve);
- });
- }
-
function promiseManagerLoaded(manager) {
return new Promise(resolve => {
wait_for_manager_load(manager, resolve);
});
}
Task.spawn(function*() {
info("Part 1");
--- a/toolkit/mozapps/extensions/test/browser/browser_bug562899.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug562899.js
@@ -4,18 +4,16 @@
// Simulates quickly switching between different list views to verify that only
// the last selected is displayed
var tempScope = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", tempScope);
var LightweightThemeManager = tempScope.LightweightThemeManager;
-const xpi = "browser/toolkit/mozapps/extensions/test/browser/browser_installssl.xpi";
-
var gManagerWindow;
var gCategoryUtilities;
function test() {
waitForExplicitFinish();
// Add a lightweight theme so at least one theme exists
LightweightThemeManager.currentTheme = {
--- a/toolkit/mozapps/extensions/test/browser/browser_bug581076.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug581076.js
@@ -1,15 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 581076 - No "See all results" link present when searching for add-ons and not all are displayed (extensions.getAddons.maxResults)
-const PREF_GETADDONS_BROWSESEARCHRESULTS = "extensions.getAddons.search.browseURL";
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
const PREF_GETADDONS_MAXRESULTS = "extensions.getAddons.maxResults";
const SEARCH_URL = TESTROOT + "browser_searching.xml";
const SEARCH_EXPECTED_TOTAL = 100;
const SEARCH_QUERY = "search";
const SEARCHABLE_PAGE = "addons://list/extension";
--- a/toolkit/mozapps/extensions/test/browser/browser_bug586574.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug586574.js
@@ -11,17 +11,16 @@
const PREF_UPDATE_ENABLED = "extensions.update.enabled";
const PREF_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
var gManagerWindow;
var gProvider;
var gUtilsBtn;
var gUtilsMenu;
-var gDropdownMenu;
var gSetDefault;
var gResetToAutomatic;
var gResetToManual;
// Make sure we don't accidentally start a background update while the prefs
// are enabled.
disableBackgroundUpdateTimer();
registerCleanupFunction(() => {
--- a/toolkit/mozapps/extensions/test/browser/browser_bug591465.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug591465.js
@@ -5,17 +5,16 @@
// Bug 591465 - Context menu of add-ons miss context related state change entries
var tempScope = {};
Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", tempScope);
var LightweightThemeManager = tempScope.LightweightThemeManager;
-const PREF_GETADDONS_MAXRESULTS = "extensions.getAddons.maxResults";
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
const SEARCH_URL = TESTROOT + "browser_bug591465.xml";
const SEARCH_QUERY = "SEARCH";
var gManagerWindow;
var gProvider;
var gContextMenu;
var gLWTheme = {
--- a/toolkit/mozapps/extensions/test/browser/browser_bug593535.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug593535.js
@@ -4,17 +4,16 @@
// Bug 593535 - Failure to download extension causes about:addons to list the
// addon with no way to restart the download
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
const SEARCH_URL = TESTROOT + "browser_bug593535.xml";
const QUERY = "NOTFOUND";
-var gProvider;
var gManagerWindow;
function test() {
waitForExplicitFinish();
// Turn on searching for this test
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
--- a/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug596336.js
@@ -1,23 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that upgrading bootstrapped add-ons behaves correctly while the
// manager is open
var gManagerWindow;
-var gCategoryUtilities;
add_task(function* test() {
waitForExplicitFinish();
gManagerWindow = yield open_manager("addons://list/extension");
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
});
function get_list_item_count() {
return get_test_items_in_list(gManagerWindow).length;
}
function get_node(parent, anonid) {
return parent.ownerDocument.getAnonymousElementByAttribute(parent, "anonid", anonid);
--- a/toolkit/mozapps/extensions/test/browser/browser_bug679604.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_bug679604.js
@@ -1,17 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Bug 679604 - Test that a XUL persisted category from an older version of
// Firefox doesn't break the add-ons manager when that category doesn't exist
-var gManagerWindow;
-
function test() {
waitForExplicitFinish();
open_manager(null, function(aWindow) {
var categories = aWindow.document.getElementById("categories");
categories.setAttribute("last-selected", "foo");
aWindow.document.persist("categories", "last-selected");
--- a/toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_cancelCompatCheck.js
@@ -196,24 +196,16 @@ function promise_page(aWindow, aPageId)
executeSoon(function() {
deferred.resolve(aWindow);
});
}, false);
}
return deferred.promise;
}
-function get_list_names(aList) {
- var items = [];
- for (let listItem of aList.childNodes)
- items.push(listItem.label);
- items.sort();
- return items;
-}
-
// These add-ons became inactive during the upgrade
var inactiveAddonIds = [
ao5.id,
ao6.id,
ao7.id,
ao8.id,
ao9.id
];
--- a/toolkit/mozapps/extensions/test/browser/browser_eula.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_eula.js
@@ -1,31 +1,28 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that the eula is shown correctly for search results
var gManagerWindow;
-var gCategoryUtilities;
-var gApp = document.getElementById("bundle_brand").getString("brandShortName");
var gSearchCount = 0;
function test() {
requestLongerTimeout(2);
waitForExplicitFinish();
// Turn on searching for this test
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
Services.prefs.setCharPref("extensions.getAddons.search.url", TESTROOT + "browser_eula.xml");
open_manager(null, function(aWindow) {
gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
run_next_test();
});
}
function end_test() {
close_manager(gManagerWindow, finish);
}
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
@@ -21,32 +21,16 @@ const MS_IN_ONE_DAY = SEC_IN_ONE_DAY *
function getExperimentAddons() {
let deferred = Promise.defer();
AddonManager.getAddonsByTypes(["experiment"], (addons) => {
deferred.resolve(addons);
});
return deferred.promise;
}
-function getInstallItem() {
- let doc = gManagerWindow.document;
- let view = get_current_view(gManagerWindow);
- let list = doc.getElementById("addon-list");
-
- let node = list.firstChild;
- while (node) {
- if (node.getAttribute("status") == "installing") {
- return node;
- }
- node = node.nextSibling;
- }
-
- return null;
-}
-
function patchPolicy(policy, data) {
for (let key of Object.keys(data)) {
Object.defineProperty(policy, key, {
value: data[key],
writable: true,
});
}
}
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -1,24 +1,22 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
"use strict";
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
-var {AddonTestUtils} = Cu.import("resource://testing-common/AddonManagerTesting.jsm", {});
var GMPScope = Cu.import("resource://gre/modules/addons/GMPProvider.jsm");
const TEST_DATE = new Date(2013, 0, 1, 12);
var gManagerWindow;
var gCategoryUtilities;
-var gIsEnUsLocale;
var gMockAddons = [];
for (let plugin of GMPScope.GMP_PLUGINS) {
let mockAddon = Object.freeze({
id: plugin.id,
isValid: true,
isInstalled: false,
@@ -53,31 +51,16 @@ var gOptionsObserver = {
lastDisplayed: null,
observe: function(aSubject, aTopic, aData) {
if (aTopic == AddonManager.OPTIONS_NOTIFICATION_DISPLAYED) {
this.lastDisplayed = aData;
}
}
};
-function getInstallItem() {
- let doc = gManagerWindow.document;
- let list = doc.getElementById("addon-list");
-
- let node = list.firstChild;
- while (node) {
- if (node.getAttribute("status") == "installing") {
- return node;
- }
- node = node.nextSibling;
- }
-
- return null;
-}
-
function openDetailsView(aId) {
let view = get_current_view(gManagerWindow);
Assert.equal(view.id, "list-view", "Should be in the list view to use this function");
let item = get_addon_element(gManagerWindow, aId);
Assert.ok(item, "Should have got add-on element.");
is_element_visible(item, "Add-on element should be visible.");
@@ -111,19 +94,16 @@ add_task(function* initializeState() {
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_DUMP);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_LOGGING_LEVEL);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_UPDATE_LAST_CHECK);
gPrefs.clearUserPref(GMPScope.GMPPrefs.KEY_EME_ENABLED);
yield GMPScope.GMPProvider.shutdown();
GMPScope.GMPProvider.startup();
}));
- let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
- gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
-
Services.obs.addObserver(gOptionsObserver, AddonManager.OPTIONS_NOTIFICATION_DISPLAYED, false);
// Start out with plugins not being installed, disabled and automatic updates
// disabled.
gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);
for (let addon of gMockAddons) {
gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), false);
gPrefs.setIntPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id), 0);
@@ -376,17 +356,16 @@ add_task(function* testEmeSupport() {
for (let addon of gMockAddons) {
gPrefs.clearUserPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_FORCE_SUPPORTED, addon.id));
}
yield GMPScope.GMPProvider.shutdown();
GMPScope.GMPProvider.startup();
for (let addon of gMockAddons) {
yield gCategoryUtilities.openType("plugin");
- let doc = gManagerWindow.document;
let item = get_addon_element(gManagerWindow, addon.id);
if (addon.id == GMPScope.EME_ADOBE_ID) {
if (AppConstants.isPlatformAndVersionAtLeast("win", "6")) {
Assert.ok(item, "Adobe EME supported, found add-on element.");
} else {
Assert.ok(!item,
"Adobe EME not supported, couldn't find add-on element.");
}
--- a/toolkit/mozapps/extensions/test/browser/browser_inlinesettings_browser.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_inlinesettings_browser.js
@@ -6,18 +6,16 @@
var {Extension} = Components.utils.import("resource://gre/modules/Extension.jsm", {});
var gAddon;
var gOtherAddon;
var gManagerWindow;
var gCategoryUtilities;
-var installedAddons = [];
-
function installAddon(details) {
let id = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator)
.generateUUID().number;
if (!details.manifest) {
details.manifest = {};
}
details.manifest.applications = {gecko: {id}};
let xpi = Extension.generateXPI(details);
--- a/toolkit/mozapps/extensions/test/browser/browser_list.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_list.js
@@ -10,17 +10,16 @@ var LightweightThemeManager = tempScope.
const { REQUIRE_SIGNING } = Components.utils.import("resource://gre/modules/addons/AddonConstants.jsm", {});
var gProvider;
var gManagerWindow;
var gCategoryUtilities;
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
var gVersion = Services.appinfo.version;
-var gBlocklistURL = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
var gDate = new Date(2010, 7, 16);
var infoURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
const EXPECTED_ADDONS = 13;
var gLWTheme = {
id: "4",
version: "1",
@@ -467,20 +466,19 @@ add_task(function*() {
is_element_hidden(filterButton, "Button for showing disabled unsigned extensions should be hidden");
is_element_hidden(showAllButton, "Button for showing all extensions should be hidden");
is_element_hidden(signingInfoUI, "Signing info UI should be hidden");
}
});
// Check the add-ons are now in the right state
add_task(function*() {
- let [a1, a2, a4, a6] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
- "addon2@tests.mozilla.org",
- "addon4@tests.mozilla.org",
- "addon6@tests.mozilla.org"]);
+ let [a1, a2, a4] = yield promiseAddonsByIDs(["addon1@tests.mozilla.org",
+ "addon2@tests.mozilla.org",
+ "addon4@tests.mozilla.org"]);
is(a1.pendingOperations, AddonManager.PENDING_DISABLE, "Add-on 1 should be pending disable");
is(a2.pendingOperations, AddonManager.PENDING_ENABLE, "Add-on 2 should be pending enable");
is(a4.pendingOperations, AddonManager.PENDING_ENABLE, "Add-on 4 should be pending enable");
});
// Reload the list to make sure the changes are still pending and that undoing
// works
@@ -842,17 +840,17 @@ add_task(function*() {
yield gCategoryUtilities.openType("extension");
let items = get_test_items();
is(Object.keys(items).length, EXPECTED_ADDONS, "Should be the right number of add-ons installed");
info("Addon 10");
let addon = items["Test add-on 10"];
addon.parentNode.ensureElementIsVisible(addon);
- let { name, version } = yield get_tooltip_info(addon);
+ let { name } = yield get_tooltip_info(addon);
is(get_node(addon, "name").value, "Test add-on 10", "Name should be correct");
is(name, "Test add-on 10", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
@@ -862,17 +860,17 @@ add_task(function*() {
is(get_node(addon, "error").textContent, "Test add-on 10 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
is_element_visible(get_node(addon, "error-link"), "Error link should be visible");
is(get_node(addon, "error-link").value, "More Information", "Error link text should be correct");
is(get_node(addon, "error-link").href, infoURL, "Error link should be correct");
info("Addon 11");
addon = items["Test add-on 11"];
addon.parentNode.ensureElementIsVisible(addon);
- ({ name, version } = yield get_tooltip_info(addon));
+ ({ name } = yield get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 11", "Name should be correct");
is(name, "Test add-on 11", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_hidden(get_node(addon, "disable-btn"), "Disable button should be hidden");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
@@ -882,34 +880,34 @@ add_task(function*() {
is(get_node(addon, "error").textContent, "Test add-on 11 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
is_element_visible(get_node(addon, "error-link"), "Error link should be visible");
is(get_node(addon, "error-link").value, "More Information", "Error link text should be correct");
is(get_node(addon, "error-link").href, infoURL, "Error link should be correct");
info("Addon 12");
addon = items["Test add-on 12"];
addon.parentNode.ensureElementIsVisible(addon);
- ({ name, version } = yield get_tooltip_info(addon))
+ ({ name } = yield get_tooltip_info(addon))
is(get_node(addon, "name").value, "Test add-on 12", "Name should be correct");
is(name, "Test add-on 12", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
is_element_hidden(get_node(addon, "warning"), "Warning message should be hidden");
is_element_hidden(get_node(addon, "warning-link"), "Warning link should be hidden");
is_element_hidden(get_node(addon, "error"), "Error message should be hidden");
is_element_hidden(get_node(addon, "error-link"), "Error link should be hidden");
info("Addon 13");
addon = items["Test add-on 13"];
addon.parentNode.ensureElementIsVisible(addon);
- ({ name, version } = yield get_tooltip_info(addon));
+ ({ name } = yield get_tooltip_info(addon));
is(get_node(addon, "name").value, "Test add-on 13", "Name should be correct");
is(name, "Test add-on 13", "Tooltip name should be correct");
is_element_hidden(get_node(addon, "preferences-btn"), "Preferences button should be hidden");
is_element_hidden(get_node(addon, "enable-btn"), "Enable button should be hidden");
is_element_visible(get_node(addon, "disable-btn"), "Disable button should be visible");
is_element_visible(get_node(addon, "remove-btn"), "Remove button should be visible");
--- a/toolkit/mozapps/extensions/test/browser/browser_metadataTimeout.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_metadataTimeout.js
@@ -2,18 +2,16 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Test how update window behaves when metadata ping times out
// bug 965788
const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
-const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
-const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
const PREF_METADATA_LASTUPDATE = "extensions.getAddons.cache.lastUpdate";
Components.utils.import("resource://gre/modules/Promise.jsm");
var repo = {};
var ARContext = Components.utils.import("resource://gre/modules/addons/AddonRepository.jsm", repo);
// Mock out the XMLHttpRequest factory for AddonRepository so
--- a/toolkit/mozapps/extensions/test/browser/browser_plugin_enabled_state_locked.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_plugin_enabled_state_locked.js
@@ -1,17 +1,16 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that state menu is displayed correctly (enabled or disabled) in the add-on manager
// when the preference is unlocked / locked
var {classes: Cc, interfaces: Ci} = Components;
const gIsWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
-const gIsOSX = ("nsILocalFileMac" in Ci);
const gIsLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc) ||
("@mozilla.org/gio-service;1" in Cc);
var gManagerWindow;
var gCategoryUtilities;
var gPluginElement;
function getTestPluginPref() {
--- a/toolkit/mozapps/extensions/test/browser/browser_searching.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_searching.js
@@ -11,17 +11,16 @@ const NO_MATCH_URL = TESTROOT + "browser
const QUERY = "SEARCH";
const NO_MATCH_QUERY = "NOMATCHQUERY";
const REMOTE_TO_INSTALL = "remote1";
const REMOTE_INSTALL_URL = TESTROOT + "addons/browser_searching.xpi";
var gManagerWindow;
var gCategoryUtilities;
var gProvider;
-var gServer;
var gAddonInstalled = false;
function test() {
requestLongerTimeout(2);
// Turn on searching for this test
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
@@ -380,35 +379,16 @@ function get_addon_item(aName) {
if (row.mAddon && row.mAddon.id == id)
return row;
}
return null;
}
/*
- * Get item for a specific install by name
- *
- * @param aName
- * The name of the install to search for
- * @return Row of install if found, null otherwise
- */
-function get_install_item(aName) {
- var sourceURI = "http://example.com/" + aName + ".xpi";
- var list = gManagerWindow.document.getElementById("search-list");
- var rows = list.getElementsByTagName("richlistitem");
- for (var row of rows) {
- if (row.mInstall && row.mInstall.sourceURI.spec == sourceURI)
- return row;
- }
-
- return null;
-}
-
-/*
* Gets the install button for a specific item
*
* @param aItem
* The item to get the install button for
* @return The install button for aItem
*/
function get_install_button(aItem) {
isnot(aItem, null, "Item should not be null when checking state of install button");
--- a/toolkit/mozapps/extensions/test/browser/browser_tabsettings.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_tabsettings.js
@@ -1,16 +1,15 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests various aspects of the details view
var gManagerWindow;
-var gCategoryUtilities;
var gProvider;
function test() {
waitForExplicitFinish();
gProvider = new MockProvider();
gProvider.createAddons([{
@@ -18,17 +17,16 @@ function test() {
name: "Tab Settings",
version: "1",
optionsURL: CHROMEROOT + "addon_prefs.xul",
optionsType: AddonManager.OPTIONS_TYPE_TAB
}]);
open_manager("addons://list/extension", function(aWindow) {
gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
run_next_test();
});
}
function end_test() {
close_manager(gManagerWindow, function() {
finish();
--- a/toolkit/mozapps/extensions/test/browser/discovery_install.html
+++ b/toolkit/mozapps/extensions/test/browser/discovery_install.html
@@ -1,12 +1,13 @@
<html>
<head>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported install */
function install() {
InstallTrigger.install({
"Test Add-on": {
URL: "https://example.com/browser/toolkit/mozapps/extensions/test/xpinstall/amosigned.xpi"
}
});
}
</script>
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1,12 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
-/* globals end_test*/
+/* globals end_test */
+
+/* eslint no-unused-vars: ["error", {vars: "local", args: "none"}] */
Components.utils.import("resource://gre/modules/NetUtil.jsm");
var tmp = {};
Components.utils.import("resource://gre/modules/AddonManager.jsm", tmp);
Components.utils.import("resource://gre/modules/Log.jsm", tmp);
var AddonManager = tmp.AddonManager;
var AddonManagerPrivate = tmp.AddonManagerPrivate;
--- a/toolkit/mozapps/extensions/test/browser/webapi_checknavigatedwindow.html
+++ b/toolkit/mozapps/extensions/test/browser/webapi_checknavigatedwindow.html
@@ -1,13 +1,14 @@
<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">
+/* exported openWindow, navigate, check */
var nav, win;
function openWindow() {
return new Promise(resolve => {
win = window.open(window.location);
win.addEventListener("load", function listener() {
nav = win.navigator;
--- a/toolkit/mozapps/extensions/test/mochitest/test_bug887098.html
+++ b/toolkit/mozapps/extensions/test/mochitest/test_bug887098.html
@@ -4,16 +4,17 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=887098
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 887098</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
+ /* exported loaded */
/** Test for Bug 887098 **/
SimpleTest.waitForExplicitFinish();
/* globals $,evalRef */
function loaded() {
var iwin = $('ifr').contentWindow;
var href = SpecialPowers.wrap(iwin).location.href;
--- a/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/.eslintrc.js
@@ -1,7 +1,10 @@
"use strict";
module.exports = { // eslint-disable-line no-undef
"extends": [
"../../../../../testing/xpcshell/xpcshell.eslintrc.js"
- ]
+ ],
+ "rules": {
+ "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS|end_test)$"}],
+ }
};
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/bootstrap_1/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/bootstrap_1/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
const VERSION = 1;
// Test steps chain from pref observers on *_reason,
// so always set that last
function install(data, reason) {
Services.prefs.setIntPref("bootstraptest.installed_version", VERSION);
--- a/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/bootstrap_2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/signing_checks/bootstrap_2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
const VERSION = 2;
// Test steps chain from pref observers on *_reason,
// so always set that last
function install(data, reason) {
Services.prefs.setIntPref("bootstraptest.installed_version", VERSION);
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_update_complete/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_update_complete/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall, ADDON_ID, INSTALL_COMPLETE_PREF */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const ADDON_ID = "test_delay_update_complete@tests.mozilla.org";
const INSTALL_COMPLETE_PREF = "bootstraptest.install_complete_done";
function install(data, reason) {}
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_update_defer/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_update_defer/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall, ADDON_ID, INSTALL_COMPLETE_PREF */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const ADDON_ID = "test_delay_update_complete@tests.mozilla.org";
const INSTALL_COMPLETE_PREF = "bootstraptest.install_complete_done";
// global reference to hold upgrade object
let gUpgrade;
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_update_ignore/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_delay_update_ignore/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall, ADDON_ID */
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/AddonManager.jsm");
const ADDON_ID = "test_delay_update_ignore@tests.mozilla.org";
const TEST_IGNORE_PREF = "delaytest.ignore";
function install(data, reason) {}
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_distribution2_2/bootstrap.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_distribution2_2/bootstrap.js
@@ -1,8 +1,9 @@
+/* exported startup, shutdown, install, uninstall */
Components.utils.import("resource://gre/modules/Services.jsm");
function install(data, reason) {
Services.prefs.setIntPref("bootstraptest.installed_version", 2);
Services.prefs.setIntPref("bootstraptest.install_reason", reason);
}
function startup(data, reason) {
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -1,12 +1,14 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
+/* eslint no-unused-vars: ["error", {vars: "local", args: "none"}] */
+
var AM_Cc = Components.classes;
var AM_Ci = Components.interfaces;
var AM_Cu = Components.utils;
AM_Cu.importGlobalProperties(["TextEncoder"]);
const CERTDB_CONTRACTID = "@mozilla.org/security/x509certdb;1";
const CERTDB_CID = Components.ID("{fb0bbc5c-452e-4783-b32c-80124693d871}");
@@ -823,17 +825,17 @@ const AddonListener = {
if (expectedRestart)
do_check_true(hasFlag(aAddon.pendingOperations, AddonManager.PENDING_ENABLE));
do_check_false(hasFlag(aAddon.permissions, AddonManager.PERM_CAN_ENABLE));
return check_test_completed(arguments);
},
onEnabled: function(aAddon) {
do_print(`Got onEnabled event for ${aAddon.id}`);
- let [event, expectedRestart] = getExpectedEvent(aAddon.id);
+ let [event] = getExpectedEvent(aAddon.id);
do_check_eq("onEnabled", event);
do_check_false(hasFlag(aAddon.permissions, AddonManager.PERM_CAN_ENABLE));
return check_test_completed(arguments);
},
onDisabling: function(aAddon, aRequiresRestart) {
do_print(`Got onDisabling event for ${aAddon.id}`);
let [event, expectedRestart] = getExpectedEvent(aAddon.id);
@@ -842,17 +844,17 @@ const AddonListener = {
if (expectedRestart)
do_check_true(hasFlag(aAddon.pendingOperations, AddonManager.PENDING_DISABLE));
do_check_false(hasFlag(aAddon.permissions, AddonManager.PERM_CAN_DISABLE));
return check_test_completed(arguments);
},
onDisabled: function(aAddon) {
do_print(`Got onDisabled event for ${aAddon.id}`);
- let [event, expectedRestart] = getExpectedEvent(aAddon.id);
+ let [event] = getExpectedEvent(aAddon.id);
do_check_eq("onDisabled", event);
do_check_false(hasFlag(aAddon.permissions, AddonManager.PERM_CAN_DISABLE));
return check_test_completed(arguments);
},
onInstalling: function(aAddon, aRequiresRestart) {
do_print(`Got onInstalling event for ${aAddon.id}`);
let [event, expectedRestart] = getExpectedEvent(aAddon.id);
@@ -860,41 +862,41 @@ const AddonListener = {
do_check_eq(aRequiresRestart, expectedRestart);
if (expectedRestart)
do_check_true(hasFlag(aAddon.pendingOperations, AddonManager.PENDING_INSTALL));
return check_test_completed(arguments);
},
onInstalled: function(aAddon) {
do_print(`Got onInstalled event for ${aAddon.id}`);
- let [event, expectedRestart] = getExpectedEvent(aAddon.id);
+ let [event] = getExpectedEvent(aAddon.id);
do_check_eq("onInstalled", event);
return check_test_completed(arguments);
},
onUninstalling: function(aAddon, aRequiresRestart) {
do_print(`Got onUninstalling event for ${aAddon.id}`);
let [event, expectedRestart] = getExpectedEvent(aAddon.id);
do_check_eq("onUninstalling", event);
do_check_eq(aRequiresRestart, expectedRestart);
if (expectedRestart)
do_check_true(hasFlag(aAddon.pendingOperations, AddonManager.PENDING_UNINSTALL));
return check_test_completed(arguments);
},
onUninstalled: function(aAddon) {
do_print(`Got onUninstalled event for ${aAddon.id}`);
- let [event, expectedRestart] = getExpectedEvent(aAddon.id);
+ let [event] = getExpectedEvent(aAddon.id);
do_check_eq("onUninstalled", event);
return check_test_completed(arguments);
},
onOperationCancelled: function(aAddon) {
do_print(`Got onOperationCancelled event for ${aAddon.id}`);
- let [event, expectedRestart] = getExpectedEvent(aAddon.id);
+ let [event] = getExpectedEvent(aAddon.id);
do_check_eq("onOperationCancelled", event);
return check_test_completed(arguments);
}
};
const InstallListener = {
onNewInstall: function(install) {
if (install.state != AddonManager.STATE_DOWNLOADED &&
--- a/toolkit/mozapps/extensions/test/xpcshell/head_unpack.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_unpack.js
@@ -1,3 +1,4 @@
-/* globals Services, TEST_UNPACKED: true*/
+/* globals Services, TEST_UNPACKED: true */
+/* exported TEST_UNPACKED */
Services.prefs.setBoolPref("extensions.alwaysUnpack", true);
TEST_UNPACKED = true;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository.js
@@ -17,18 +17,16 @@ const PREF_GETADDONS_BROWSESEARCHRESULTS
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
const PORT = gServer.identity.primaryPort;
const BASE_URL = "http://localhost:" + PORT;
const DEFAULT_URL = "about:blank";
gPort = PORT;
-// Path to source URI of installed add-on
-const INSTALL_URL1 = "/addons/test_AddonRepository_1.xpi";
// Path to source URI of installing add-on
const INSTALL_URL2 = "/addons/test_AddonRepository_2.xpi";
// Path to source URI of non-active add-on (state = STATE_AVAILABLE)
const INSTALL_URL3 = "/addons/test_AddonRepository_3.xpi";
// Properties of an individual add-on that should be checked
// Note: name is checked separately
var ADDON_PROPERTIES = ["id", "type", "version", "creator", "developers",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_compatmode.js
@@ -6,17 +6,16 @@
// %COMPATIBILITY_MODE% token in the Search API URL.
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
Components.utils.import("resource://testing-common/httpd.js");
var gServer = new HttpServer();
gServer.start(-1);
gPort = gServer.identity.primaryPort;
-var COMPATIBILITY_PREF;
// register static files with server and interpolate port numbers in them
mapFile("/data/test_AddonRepository_compatmode_ignore.xml", gServer);
mapFile("/data/test_AddonRepository_compatmode_normal.xml", gServer);
mapFile("/data/test_AddonRepository_compatmode_strict.xml", gServer);
function run_test() {
do_test_pending();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_XPIStates.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_XPIStates.js
@@ -101,17 +101,17 @@ function checkChange(XS, aPath, aChange)
// Get a reference to the XPIState (loaded by startupManager) so we can unit test it.
function getXS() {
let XPI = Components.utils.import("resource://gre/modules/addons/XPIProvider.jsm");
return XPI.XPIStates;
}
add_task(function* detect_touches() {
startupManager();
- let [pe, pd, ue, ud] = yield promiseAddonsByIDs([
+ let [/* pe */, pd, /* ue */, ud] = yield promiseAddonsByIDs([
"packed-enabled@tests.mozilla.org",
"packed-disabled@tests.mozilla.org",
"unpacked-enabled@tests.mozilla.org",
"unpacked-disabled@tests.mozilla.org"
]);
do_print("Disable test add-ons");
pd.userDisabled = true;
@@ -176,17 +176,17 @@ add_task(function* detect_touches() {
do_check_eq(xState.scanTime, ud.updateDate.getTime());
});
/*
* Uninstalling bootstrap add-ons should immediately remove them from the
* extensions.xpiState preference.
*/
add_task(function* uninstall_bootstrap() {
- let [pe, pd, ue, ud] = yield promiseAddonsByIDs([
+ let [pe, /* pd, ue, ud */] = yield promiseAddonsByIDs([
"packed-enabled@tests.mozilla.org",
"packed-disabled@tests.mozilla.org",
"unpacked-enabled@tests.mozilla.org",
"unpacked-disabled@tests.mozilla.org"
]);
pe.uninstall();
let xpiState = Services.prefs.getCharPref("extensions.xpiState");
do_check_false(xpiState.includes("\"packed-enabled@tests.mozilla.org\""));
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_gfx.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_gfx.js
@@ -1,15 +1,13 @@
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-const TEST_APP_ID = "xpcshell@tests.mozilla.org";
-
const EVENT_NAME = "blocklist-data-gfxItems";
const SAMPLE_GFX_RECORD = {
"driverVersionComparator": "LESS_THAN_OR_EQUAL",
"driverVersion": "8.17.12.5896",
"vendor": "0x10de",
"blockID": "g36",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklistchange.js
@@ -549,17 +549,17 @@ add_task(function* init() {
writeInstallRDFForExtension(softblock2_1, profileDir);
writeInstallRDFForExtension(softblock3_1, profileDir);
writeInstallRDFForExtension(softblock4_1, profileDir);
writeInstallRDFForExtension(softblock5_1, profileDir);
writeInstallRDFForExtension(hardblock_1, profileDir);
writeInstallRDFForExtension(regexpblock_1, profileDir);
startupManager();
- let [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ let [/* s1 */, /* s2 */, /* s3 */, s4, s5, /* h, r */] = yield promiseAddonsByIDs(ADDON_IDS);
s4.userDisabled = true;
s5.userDisabled = false;
});
// Starts with add-ons unblocked and then switches application versions to
// change add-ons to blocked and back
add_task(function* run_app_update_test() {
do_print("Test: " + arguments.callee.name);
@@ -963,17 +963,17 @@ add_task(function* run_addon_change_2_te
writeInstallRDFForExtension(softblock3_2, profileDir);
writeInstallRDFForExtension(softblock4_2, profileDir);
writeInstallRDFForExtension(softblock5_2, profileDir);
writeInstallRDFForExtension(hardblock_2, profileDir);
writeInstallRDFForExtension(regexpblock_2, profileDir);
startupManager(false);
- let [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ let [s1, s2, s3, /* s4 */, /* s5 */, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "2.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s2, "2.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s3, "2.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(h, "2.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
check_addon(r, "2.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
s2.userDisabled = false;
@@ -1000,17 +1000,17 @@ add_task(function* addon_change_2_test_2
setExtensionModifiedTime(getFileForAddon(profileDir, softblock5_3.id), Date.now() + 10000);
writeInstallRDFForExtension(hardblock_3, profileDir);
setExtensionModifiedTime(getFileForAddon(profileDir, hardblock_3.id), Date.now() + 10000);
writeInstallRDFForExtension(regexpblock_3, profileDir);
setExtensionModifiedTime(getFileForAddon(profileDir, regexpblock_3.id), Date.now() + 10000);
startupManager(false);
- let [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ let [s1, s2, s3, /* s4 */, /* s5 */, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "3.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s2, "3.0", true, false, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s3, "3.0", false, false, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(h, "3.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
check_addon(r, "3.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
});
@@ -1214,17 +1214,17 @@ add_task(function* run_manual_update_2_t
writeInstallRDFForExtension(softblock3_1, profileDir);
writeInstallRDFForExtension(softblock4_1, profileDir);
writeInstallRDFForExtension(softblock5_1, profileDir);
writeInstallRDFForExtension(hardblock_1, profileDir);
writeInstallRDFForExtension(regexpblock_1, profileDir);
startupManager(false);
- let [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ let [s1, s2, s3, s4, /* s5 */, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s2, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s3, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(h, "1.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
check_addon(r, "1.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
s2.userDisabled = false;
@@ -1232,31 +1232,31 @@ add_task(function* run_manual_update_2_t
check_addon(s2, "1.0", true, false, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
s3.userDisabled = false;
check_addon(s3, "1.0", false, false, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
yield promiseRestartManager();
yield Pmanual_update("2");
yield promiseRestartManager();
- [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ [s1, s2, s3, s4, /* s5 */, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "2.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s2, "2.0", true, false, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s3, "2.0", false, false, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
// Can't manually update to a hardblocked add-on
check_addon(h, "1.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
check_addon(r, "1.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
yield promiseRestartManager();
yield Pmanual_update("3");
yield promiseRestartManager();
- [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ [s1, s2, s3, s4, /* s5 */, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s2, "3.0", true, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(s3, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(h, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
check_addon(r, "3.0", false, false, Ci.nsIBlocklistService.STATE_NOT_BLOCKED);
s1.userDisabled = false;
@@ -1290,16 +1290,16 @@ add_task(function* run_local_install_tes
]);
let aInstalls = yield new Promise((resolve, reject) => {
AddonManager.getAllInstalls(resolve)
});
// Should have finished all installs without needing to restart
do_check_eq(aInstalls.length, 0);
- let [s1, s2, s3, s4, s5, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
+ let [s1, s2, s3, /* s4 */, /* s5 */, h, r] = yield promiseAddonsByIDs(ADDON_IDS);
check_addon(s1, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s2, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(s3, "1.0", true, true, Ci.nsIBlocklistService.STATE_SOFTBLOCKED);
check_addon(h, "1.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
check_addon(r, "1.0", false, false, Ci.nsIBlocklistService.STATE_BLOCKED);
});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug324121.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug324121.js
@@ -5,17 +5,16 @@
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
-var next_test = null;
var gItemsNotChecked = [];
var ADDONS = [ {id: "bug324121_1@tests.mozilla.org",
addon: "test_bug324121_1",
shouldCheck: false },
{id: "bug324121_2@tests.mozilla.org",
addon: "test_bug324121_2",
shouldCheck: true },
@@ -139,18 +138,16 @@ function run_test() {
installAllFiles(ADDONS.map(a => do_get_addon(a.addon)), function() {
restartManager();
AddonManager.getAddonByID(ADDONS[0].id, callback_soon(function(firstAddon) {
do_check_true(firstAddon);
firstAddon.userDisabled = true;
restartManager();
AddonManager.getAddonsByTypes(["extension"], function(installedItems) {
- var items = [];
-
for (let addon of ADDONS) {
for (let installedItem of installedItems) {
if (addon.id != installedItem.id)
continue;
if (installedItem.userDisabled)
continue;
if (addon.shouldCheck == installedItem.isCompatibleWith("3", "3")) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug371495.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug371495.js
@@ -1,16 +1,13 @@
/* 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 PREF_MATCH_OS_LOCALE = "intl.locale.matchOS";
-const PREF_SELECTED_LOCALE = "general.useragent.locale";
-
const ADDON = "test_bug371495";
const ID = "bug371495@tests.mozilla.org";
function run_test()
{
// Setup for test
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_compatoverrides.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_compatoverrides.js
@@ -9,17 +9,16 @@ const PREF_GETADDONS_CACHE_ENABLED = "ex
Components.utils.import("resource://testing-common/httpd.js");
var gServer = new HttpServer();
gServer.start(-1);
gPort = gServer.identity.primaryPort;
const PORT = gPort;
const BASE_URL = "http://localhost:" + PORT;
-const DEFAULT_URL = "about:blank";
const REQ_URL = "/data.xml";
// register static file and mark it for interpolation
mapUrlToFile(REQ_URL, do_get_file("data/test_compatoverrides.xml"), gServer);
Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false);
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
Services.prefs.setCharPref(PREF_GETADDONS_BYIDS_PERFORMANCE,
--- a/toolkit/mozapps/extensions/test/xpcshell/test_delay_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_delay_update.js
@@ -5,17 +5,16 @@
// This verifies that delaying an update works
// The test extension uses an insecure update url.
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
Components.utils.import("resource://testing-common/httpd.js");
const profileDir = gProfD.clone();
profileDir.append("extensions");
-const tempdir = gTmpD.clone();
const IGNORE_ID = "test_delay_update_ignore@tests.mozilla.org";
const COMPLETE_ID = "test_delay_update_complete@tests.mozilla.org";
const DEFER_ID = "test_delay_update_defer@tests.mozilla.org";
const TEST_IGNORE_PREF = "delaytest.ignore";
// Note that we would normally use BootstrapMonitor but it currently requires
--- a/toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_delay_update_webextension.js
@@ -6,17 +6,16 @@
// The test extension uses an insecure update url.
Services.prefs.setBoolPref(PREF_EM_CHECK_UPDATE_SECURITY, false);
/* globals browser*/
const profileDir = gProfD.clone();
profileDir.append("extensions");
-const tempdir = gTmpD.clone();
const stageDir = profileDir.clone();
stageDir.append("staged");
const IGNORE_ID = "test_delay_update_ignore_webext@tests.mozilla.org";
const COMPLETE_ID = "test_delay_update_complete_webext@tests.mozilla.org";
const DEFER_ID = "test_delay_update_defer_webext@tests.mozilla.org";
const NOUPDATE_ID = "test_no_update_webext@tests.mozilla.org";
--- a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_dictionary.js
@@ -168,18 +168,16 @@ function check_test_1() {
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic"));
do_check_true(b1.hasResource("install.rdf"));
do_check_false(b1.hasResource("bootstrap.js"));
do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0");
- let dir = do_get_addon_root_uri(profileDir, "ab-CD@dictionaries.addons.mozilla.org");
-
let chromeReg = AM_Cc["@mozilla.org/chrome/chrome-registry;1"].
getService(AM_Ci.nsIChromeRegistry);
try {
chromeReg.convertChromeURL(NetUtil.newURI("chrome://dict/content/dict.xul"));
do_throw("Chrome manifest should not have been registered");
}
catch (e) {
// Expected the chrome url to not be registered
@@ -572,18 +570,16 @@ function check_test_23() {
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
do_check_true(HunspellEngine.isDictionaryEnabled("ab-CD.dic"));
do_check_true(b1.hasResource("install.rdf"));
do_check_false(b1.hasResource("bootstrap.js"));
do_check_in_crash_annotation("ab-CD@dictionaries.addons.mozilla.org", "1.0");
- let dir = do_get_addon_root_uri(profileDir, "ab-CD@dictionaries.addons.mozilla.org");
-
AddonManager.getAddonsWithOperationsByTypes(null, callback_soon(function(list) {
do_check_eq(list.length, 0);
restartManager();
AddonManager.getAddonByID("ab-CD@dictionaries.addons.mozilla.org", function(b1_2) {
b1_2.uninstall();
do_execute_soon(run_test_25);
});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_general.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_general.js
@@ -8,17 +8,16 @@
// We have to look up how many add-ons are present since there will be plugins
// etc. detected
var gCount;
function run_test() {
do_test_pending();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
- var count = 0;
startupManager();
AddonManager.getAddonsByTypes(null, function(list) {
gCount = list.length;
do_execute_soon(run_test_1);
});
}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_langpack.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_langpack.js
@@ -101,18 +101,16 @@ function check_test_1() {
do_check_false(b1.appDisabled);
do_check_false(b1.userDisabled);
do_check_true(b1.isActive);
// check chrome reg that language pack is registered
do_check_eq(chrome.getSelectedLocale("test-langpack"), "x-testing");
do_check_true(b1.hasResource("install.rdf"));
do_check_false(b1.hasResource("bootstrap.js"));
- let dir = do_get_addon_root_uri(profileDir, "langpack-x-testing@tests.mozilla.org");
-
AddonManager.getAddonsWithOperationsByTypes(null, function(list) {
do_check_eq(list.length, 0);
run_test_2();
});
});
});
}
--- a/toolkit/mozapps/extensions/test/xpcshell/test_locked_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_locked_strictcompat.js
@@ -148,19 +148,17 @@ add_task(function* init() {
writeInstallRDFForExtension(theme2, profileDir);
// Startup the profile and setup the initial state
startupManager();
// New profile so new add-ons are ignored
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
- let a1, a2, a3, a4, a5, a6, a7, t1, t2;
-
- [a2, a3, a4, a7, t2] =
+ let [a2, a3, a4, a7, t2] =
yield promiseAddonsByIDs(["addon2@tests.mozilla.org",
"addon3@tests.mozilla.org",
"addon4@tests.mozilla.org",
"addon7@tests.mozilla.org",
"theme2@tests.mozilla.org"]);
// Set up the initial state
let deferredUpdateFinished = Promise.defer();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
@@ -47,20 +47,16 @@ function check_mapping(uri, id) {
do_check_eq(AddonManager.mapURIToAddonID(uri), id);
let svc = Components.classes["@mozilla.org/addons/integration;1"].
getService(Components.interfaces.amIAddonManager);
let val = {};
do_check_true(svc.mapURIToAddonID(uri, val));
do_check_eq(val.value, id);
}
-function getActiveVersion() {
- return Services.prefs.getIntPref("bootstraptest.active_version");
-}
-
function run_test() {
do_test_pending();
run_test_early();
}
function run_test_early() {
startupManager();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_provider_markSafe.js
@@ -1,22 +1,19 @@
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
-var startupOrder = [];
-
function mockAddonProvider(name) {
let mockProvider = {
markSafe: false,
apiAccessed: false,
startup() {
if (this.markSafe)
AddonManagerPrivate.markProviderSafe(this);
- let uri = Services.io.newURI("beard://long", null, null);
AddonManager.isInstallEnabled("made-up-mimetype");
},
supportsMimetype(mimetype) {
this.apiAccessed = true;
return false;
},
get name() {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_provider_shutdown.js
@@ -51,17 +51,16 @@ function findInStatus(aStatus, aName) {
return null;
}
/*
* Make sure we report correctly when an add-on provider or AddonRepository block shutdown
*/
add_task(function* blockRepoShutdown() {
// Reach into the AddonManager scope and inject our mock AddonRepository
- let realAddonRepo = AMscope.AddonRepository;
// the mock provider behaves enough like AddonRepository for the purpose of this test
let mockRepo = mockAddonProvider("Mock repo");
AMscope.AddonRepository = mockRepo;
let mockProvider = mockAddonProvider("Mock provider");
startupManager();
AddonManagerPrivate.registerProvider(mockProvider);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_proxies.js
@@ -34,21 +34,16 @@ var METADATA = {
id: "xpcshell@tests.mozilla.org",
minVersion: "2",
maxVersion: "2"
}]
}
const ios = AM_Cc["@mozilla.org/network/io-service;1"].getService(AM_Ci.nsIIOService);
-const LocalFile = Components.Constructor("@mozilla.org/file/local;1",
- "nsILocalFile", "initWithPath");
-const Process = Components.Constructor("@mozilla.org/process/util;1",
- "nsIProcess", "init");
-
const gHaveSymlinks = AppConstants.platform != "win";
function createSymlink(aSource, aDest) {
if (aSource instanceof AM_Ci.nsIFile)
aSource = aSource.path;
if (aDest instanceof AM_Ci.nsIFile)
aDest = aDest.path;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_sourceURI.js
@@ -5,17 +5,16 @@
Components.utils.import("resource://testing-common/httpd.js");
var gServer = new HttpServer();
gServer.start(-1);
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
const PORT = gServer.identity.primaryPort;
const BASE_URL = "http://localhost:" + PORT;
-const DEFAULT_URL = "about:blank";
var addon = {
id: "addon@tests.mozilla.org",
version: "1.0",
name: "Test",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "1",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
@@ -34,17 +34,16 @@ add_test(function test_getter_and_setter
restartManager();
AddonManager.getAddonByID(addonId, function(addon) {
do_check_neq(addon, null);
do_check_neq(addon.syncGUID, null);
do_check_true(UUID_PATTERN.test(addon.syncGUID));
- let oldGUID = addon.SyncGUID;
let newGUID = "foo";
addon.syncGUID = newGUID;
do_check_eq(newGUID, addon.syncGUID);
// Verify change made it to DB.
AddonManager.getAddonByID(addonId, function(newAddon) {
do_check_neq(newAddon, null);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_delay_update.js
@@ -2,17 +2,16 @@
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// This verifies that delaying a system add-on update works.
Components.utils.import("resource://testing-common/httpd.js");
const profileDir = gProfD.clone();
profileDir.append("extensions");
-const tempdir = gTmpD.clone();
const PREF_SYSTEM_ADDON_SET = "extensions.systemAddonSet";
const PREF_SYSTEM_ADDON_UPDATE_URL = "extensions.systemAddon.update.url";
const IGNORE_ID = "system_delay_ignore@tests.mozilla.org";
const COMPLETE_ID = "system_delay_complete@tests.mozilla.org";
const DEFER_ID = "system_delay_defer@tests.mozilla.org";
const DEFER_ALSO_ID = "system_delay_defer_also@tests.mozilla.org";
--- a/toolkit/mozapps/extensions/test/xpcshell/test_system_update.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_system_update.js
@@ -1,17 +1,15 @@
// Tests that we reset to the default system add-ons correctly when switching
// application versions
const PREF_SYSTEM_ADDON_SET = "extensions.systemAddonSet";
const PREF_SYSTEM_ADDON_UPDATE_URL = "extensions.systemAddon.update.url";
-const PREF_XPI_STATE = "extensions.xpiState";
const PREF_APP_UPDATE_ENABLED = "app.update.enabled";
Components.utils.import("resource://testing-common/httpd.js");
-const { computeHash } = Components.utils.import("resource://gre/modules/addons/ProductAddonChecker.jsm");
BootstrapMonitor.init();
const updatesDir = FileUtils.getDir("ProfD", ["features"], false);
function getCurrentUpdatesDir() {
let dir = updatesDir.clone();
let set = JSON.parse(Services.prefs.getCharPref(PREF_SYSTEM_ADDON_SET));
@@ -70,22 +68,16 @@ createAppInfo("xpcshell@tests.mozilla.or
var testserver = new HttpServer();
testserver.registerDirectory("/data/", do_get_file("data/system_addons"));
testserver.start();
var root = testserver.identity.primaryScheme + "://" +
testserver.identity.primaryHost + ":" +
testserver.identity.primaryPort + "/data/"
Services.prefs.setCharPref(PREF_SYSTEM_ADDON_UPDATE_URL, root + "update.xml");
-function makeUUID() {
- let uuidGen = AM_Cc["@mozilla.org/uuid-generator;1"].
- getService(AM_Ci.nsIUUIDGenerator);
- return uuidGen.generateUUID().toString();
-}
-
function* check_installed(conditions) {
for (let i = 0; i < conditions.length; i++) {
let condition = conditions[i];
let id = "system" + (i + 1) + "@tests.mozilla.org";
let addon = yield promiseAddonByID(id);
if (!("isUpgrade" in condition) || !("version" in condition)) {
throw Error("condition must contain isUpgrade and version");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_undothemeuninstall.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_undothemeuninstall.js
@@ -29,27 +29,16 @@ var theme1 = {
minVersion: "1",
maxVersion: "1"
}]
};
const profileDir = gProfD.clone();
profileDir.append("extensions");
-function dummyLWTheme(id) {
- return {
- id: id || Math.random().toString(),
- name: Math.random().toString(),
- headerURL: "http://lwttest.invalid/a.png",
- footerURL: "http://lwttest.invalid/b.png",
- textcolor: Math.random().toString(),
- accentcolor: Math.random().toString()
- };
-}
-
// Sets up the profile by installing an add-on.
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
do_register_cleanup(promiseShutdownManager);
run_next_test();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_undouninstall.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_undouninstall.js
@@ -5,17 +5,16 @@
// This verifies that forcing undo for uninstall works
const APP_STARTUP = 1;
const APP_SHUTDOWN = 2;
const ADDON_ENABLE = 3;
const ADDON_DISABLE = 4;
const ADDON_INSTALL = 5;
const ADDON_UNINSTALL = 6;
-const ADDON_UPGRADE = 7;
const ADDON_DOWNGRADE = 8;
const ID = "undouninstall1@tests.mozilla.org";
const INCOMPAT_ID = "incompatible@tests.mozilla.org";
var addon1 = {
id: "addon1@tests.mozilla.org",
version: "1.0",
@@ -48,36 +47,21 @@ function getInstallReason(id) {
return info ? info.reason : undefined;
}
function getUninstallReason(id) {
let info = BootstrapMonitor.uninstalled.get(id);
return info ? info.reason : undefined;
}
-function getStartupOldVersion(id) {
- let info = BootstrapMonitor.started.get(id);
- return info ? info.data.oldVersion : undefined;
-}
-
function getShutdownNewVersion(id) {
let info = BootstrapMonitor.stopped.get(id);
return info ? info.data.newVersion : undefined;
}
-function getInstallOldVersion(id) {
- let info = BootstrapMonitor.installed.get(id);
- return info ? info.data.oldVersion : undefined;
-}
-
-function getUninstallNewVersion(id) {
- let info = BootstrapMonitor.uninstalled.get(id);
- return info ? info.data.newVersion : undefined;
-}
-
// Sets up the profile by installing an add-on.
function run_test() {
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
startupManager();
do_register_cleanup(promiseShutdownManager);
run_next_test();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateCancel.js
@@ -79,17 +79,17 @@ add_task(function* cancel_during_check()
let a1 = yield promiseAddonByID("addon1@tests.mozilla.org");
do_check_neq(a1, null);
let listener = makeCancelListener();
a1.findUpdates(listener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
// Wait for the http request to arrive
- let [request, response] = yield httpReceived.promise;
+ let [/* request */, response] = yield httpReceived.promise;
// cancelUpdate returns true if there is an update check in progress
do_check_true(a1.cancelUpdate());
let updateResult = yield listener.promise;
do_check_eq(AddonManager.UPDATE_STATUS_CANCELLED, updateResult);
// Now complete the HTTP request
@@ -114,17 +114,17 @@ add_task(function* shutdown_during_check
let a1 = yield promiseAddonByID("addon1@tests.mozilla.org");
do_check_neq(a1, null);
let listener = makeCancelListener();
a1.findUpdates(listener, AddonManager.UPDATE_WHEN_USER_REQUESTED);
// Wait for the http request to arrive
- let [request, response] = yield httpReceived.promise;
+ let [/* request */, response] = yield httpReceived.promise;
shutdownManager();
let updateResult = yield listener.promise;
do_check_eq(AddonManager.UPDATE_STATUS_CANCELLED, updateResult);
// Now complete the HTTP request
let file = do_get_cwd();
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updatecheck.js
@@ -90,18 +90,18 @@ add_task(function* () {
});
add_task(function* () {
// Make sure that the JSON manifest is rejected when an update key is
// required, but perform the remaining tests which aren't expected to fail
// because of the update key, without requiring one for the JSON variant.
try {
- let updates = yield checkUpdates("test_bug378216_8@tests.mozilla.org",
- updateKey, "test_updatecheck.json");
+ yield checkUpdates("test_bug378216_8@tests.mozilla.org",
+ updateKey, "test_updatecheck.json");
throw "Expected the update check to fail";
} catch (e) {}
for (let [file, key] of [["test_updatecheck.rdf", updateKey],
["test_updatecheck.json", null]]) {
let updates = yield checkUpdates("test_bug378216_8@tests.mozilla.org",
key, file);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_embedded.js
@@ -13,17 +13,16 @@ startupManager();
// NOTE: the following import needs to be called after the `createAppInfo`
// or it will fail Extension.jsm internally imports AddonManager.jsm and
// AddonManager will raise a ReferenceError exception because it tried to
// access an undefined `Services.appinfo` object.
const { Management } = Components.utils.import("resource://gre/modules/Extension.jsm", {});
const {
EmbeddedExtensionManager,
- LegacyExtensionsUtils,
} = Components.utils.import("resource://gre/modules/LegacyExtensionsUtils.jsm");
// Wait the startup of the embedded webextension.
function promiseWebExtensionStartup() {
return new Promise(resolve => {
let listener = (event, extension) => {
Management.off("startup", listener);
resolve(extension);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
@@ -148,18 +148,16 @@ add_task(function*() {
}, profileDir);
yield promiseRestartManager();
yield promiseAddonStartup();
let addon = yield promiseAddonByID(ID);
do_check_neq(addon, null);
- let uri = do_get_addon_root_uri(profileDir, ID);
-
deepEqual(addon.icons, {});
equal(addon.iconURL, null);
equal(addon.icon64URL, null);
equal(AddonManager.getPreferredIconURL(addon, 128), null);
addon.uninstall();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_concurrent_installs.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_concurrent_installs.js
@@ -44,20 +44,16 @@ var gAddonAndWindowListener = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediatorListener])
};
function installNext() {
let tab = gQueuedForInstall.shift();
tab.linkedBrowser.messageManager.sendAsyncMessage("Test:StartInstall");
}
-function winForTab(t) {
- return t.linkedBrowser.contentWindow;
-}
-
function createTab(url) {
let tab = gBrowser.addTab(url);
tab.linkedBrowser.messageManager.loadFrameScript("data:,(" + frame_script.toString() + ")();", true);
tab.linkedBrowser.messageManager.addMessageListener("Test:InstallComplete", ({data}) => {
gResults.push(data);
if (gResults.length == 2) {
executeSoon(endThisTest);
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_trigger_redirect.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_trigger_redirect.js
@@ -28,14 +28,13 @@ function install_ended(install, addon) {
install.cancel();
}
function finish_test(count) {
is(count, 1, "1 Add-on should have been successfully installed");
Services.perms.remove(makeURI("http://example.com"), "install");
- var doc = gBrowser.contentDocument;
is(gBrowser.currentURI.spec, TESTROOT + "triggerredirect.html#foo", "Should have redirected");
gBrowser.removeCurrentTab();
Harness.finish();
}
--- a/toolkit/mozapps/extensions/test/xpinstall/bug540558.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/bug540558.html
@@ -3,16 +3,17 @@
<html>
<!-- This page tests that window.InstallTrigger.install works -->
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
+/* exported startInstall */
function startInstall() {
window.InstallTrigger.install({
"Unsigned XPI": "amosigned.xpi"
});
}
</script>
</head>
<body onload="startInstall()">
--- a/toolkit/mozapps/extensions/test/xpinstall/bug645699.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/bug645699.html
@@ -2,16 +2,17 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported startInstall */
function startInstall() {
var whiteUrl = "https://example.org/";
try {
Object.defineProperty(window, "location", { value : { href : whiteUrl } });
throw new Error("Object.defineProperty(window, 'location', ...) should have thrown");
} catch (exc) {
if (!(exc instanceof TypeError))
--- a/toolkit/mozapps/extensions/test/xpinstall/concurrent_installs.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/concurrent_installs.html
@@ -3,16 +3,17 @@
<html>
<head>
<meta charset="utf-8">
<title>Concurrent InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported startInstall */
function installCallback(url, status) {
document.getElementById("status").textContent = status;
dump("Sending InstallComplete\n");
var event = new CustomEvent("InstallComplete", {detail: {loc: location.href, xpi: url}});
window.dispatchEvent(event);
}
--- a/toolkit/mozapps/extensions/test/xpinstall/enabled.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/enabled.html
@@ -4,16 +4,17 @@
<html>
<!-- This page will test if InstallTrigger seems to be enabled -->
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported init */
function init() {
document.getElementById("enabled").textContent = InstallTrigger.enabled() ? "true" : "false";
dump("Sending PageLoaded\n");
var event = new CustomEvent("PageLoaded");
window.dispatchEvent(event);
}
</script>
</head>
--- a/toolkit/mozapps/extensions/test/xpinstall/head.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/head.js
@@ -1,8 +1,10 @@
+/* eslint no-unused-vars: ["error", {vars: "local", args: "none"}] */
+
const RELATIVE_DIR = "toolkit/mozapps/extensions/test/xpinstall/";
const TESTROOT = "http://example.com/browser/" + RELATIVE_DIR;
const TESTROOT2 = "http://example.org/browser/" + RELATIVE_DIR;
const XPINSTALL_URL = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PROMPT_URL = "chrome://global/content/commonDialog.xul";
const ADDONS_URL = "chrome://mozapps/content/extensions/extensions.xul";
const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
@@ -304,17 +306,16 @@ var Harness = {
onNewInstall: function(install) {
this.runningInstalls.push(install);
if (this.finalContentEvent && !this.waitingForEvent) {
this.waitingForEvent = true;
info("Waiting for " + this.finalContentEvent);
let mm = gBrowser.selectedBrowser.messageManager;
mm.loadFrameScript(`data:,content.addEventListener("${this.finalContentEvent}", () => { sendAsyncMessage("Test:GotNewInstallEvent"); });`, false);
- let win = gBrowser.contentWindow;
let listener = () => {
info("Saw " + this.finalContentEvent);
mm.removeMessageListener("Test:GotNewInstallEvent", listener);
this.waitingForEvent = false;
if (this.pendingCount == 0)
this.endTest();
}
mm.addMessageListener("Test:GotNewInstallEvent", listener);
--- a/toolkit/mozapps/extensions/test/xpinstall/installchrome.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/installchrome.html
@@ -4,16 +4,17 @@
<html>
<!-- This page will accept a url as the uri query and pass it to InstallTrigger.installChrome -->
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported startInstall */
function startInstall() {
InstallTrigger.installChrome(InstallTrigger.SKIN,
decodeURIComponent(document.location.search.substring(1)),
"test");
}
</script>
</head>
<body onload="startInstall()">
--- a/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/installtrigger.html
@@ -4,16 +4,17 @@
<html>
<!-- This page will accept some json as the uri query and pass it to InstallTrigger.install -->
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported startInstall */
function installCallback(url, status) {
document.getElementById("status").textContent = status;
dump("Sending InstallComplete\n");
var event = new CustomEvent("InstallComplete");
var target = window.parent ? window.parent : window;
target.dispatchEvent(event);
}
--- a/toolkit/mozapps/extensions/test/xpinstall/installtrigger_frame.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/installtrigger_frame.html
@@ -4,16 +4,17 @@
<html>
<!-- This page will accept some url as the uri query and load it in
an inner iframe, which will run InstallTrigger.install -->
<head>
<title>InstallTrigger frame tests</title>
<script type="text/javascript">
+/* exported prepChild */
function prepChild() {
// Pass our parameters over to the child
var child = window.frames[0];
var url = decodeURIComponent(document.location.search.substr(1));
child.location = url;
}
</script>
</head>
--- a/toolkit/mozapps/extensions/test/xpinstall/navigate.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/navigate.html
@@ -4,19 +4,18 @@
<html>
<!-- This page will accept some url as the uri query and navigate to it by
clicking a link -->
<head>
<title>Navigation tests</title>
<script type="text/javascript">
+/* exported navigate */
function navigate() {
- // Pass our parameters over to the child
- var child = window.frames[0];
var url = decodeURIComponent(document.location.search.substr(1));
var link = document.getElementById("link");
link.href = url;
link.click();
}
</script>
</head>
<body onload="navigate()">
--- a/toolkit/mozapps/extensions/test/xpinstall/startsoftwareupdate.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/startsoftwareupdate.html
@@ -4,16 +4,17 @@
<html>
<!-- This page will accept a url as the uri query and pass it to InstallTrigger.startSoftwareUpdate -->
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported startInstall */
function startInstall() {
InstallTrigger.startSoftwareUpdate(decodeURIComponent(document.location.search.substring(1)));
}
</script>
</head>
<body onload="startInstall()">
<p>InstallTrigger tests</p>
</body>
--- a/toolkit/mozapps/extensions/test/xpinstall/triggerredirect.html
+++ b/toolkit/mozapps/extensions/test/xpinstall/triggerredirect.html
@@ -4,16 +4,17 @@
<html>
<!-- This page will attempt an install and then try to load a new page in the tab -->
<head>
<title>InstallTrigger tests</title>
<script type="text/javascript">
/* globals InstallTrigger */
+/* exported startInstall */
function installCallback(url, status) {
document.location = "#foo";
dump("Sending InstallComplete\n");
var event = new CustomEvent("InstallComplete");
window.dispatchEvent(event);
}