Bug 1439838 - Enable ESLint rule no-unused-vars for the same directories in mobile/android as no-undef. r?JanH
MozReview-Commit-ID: 1popN3tahBx
--- a/mobile/android/.eslintrc.js
+++ b/mobile/android/.eslintrc.js
@@ -12,28 +12,28 @@ module.exports = {
"no-empty": "off",
"no-native-reassign": "off",
"no-nested-ternary": "off",
"no-new-object": "off",
"no-octal": "off",
"no-redeclare": "off",
"no-useless-call": "off",
"no-useless-concat": "off",
- "no-unused-vars": "off",
"object-shorthand": "off",
},
"overrides": [{
files: [
// Bug 1425047.
"chrome/**",
// Bug 1425048.
"components/extensions/**",
// Bug 1425034.
"modules/WebsiteMetadata.jsm",
// Bug 1425051.
"tests/browser/robocop/**",
],
rules: {
+ "no-unused-vars": "off",
"no-undef": "off",
}
}],
};
--- a/mobile/android/components/ColorPicker.js
+++ b/mobile/android/components/ColorPicker.js
@@ -25,26 +25,26 @@ ColorPicker.prototype = {
init: function(aParent, aTitle, aInitial) {
this._domWin = aParent;
this._initial = aInitial;
this._title = aTitle;
},
open: function(aCallback) {
- let p = new Prompt({
- window: this._domWin,
- title: this._title,
- buttons: [
- this.strings.GetStringFromName("inputWidgetHelper.set"),
- this.strings.GetStringFromName("inputWidgetHelper.cancel"),
- ],
- })
- .addColorPicker({ value: this._initial })
- .show((data) => {
+ new Prompt({
+ window: this._domWin,
+ title: this._title,
+ buttons: [
+ this.strings.GetStringFromName("inputWidgetHelper.set"),
+ this.strings.GetStringFromName("inputWidgetHelper.cancel"),
+ ],
+ })
+ .addColorPicker({ value: this._initial })
+ .show((data) => {
if (data.button == 0)
aCallback.done(data.color0);
else
aCallback.done(this._initial);
});
},
classID: Components.ID("{430b987f-bb9f-46a3-99a5-241749220b29}"),
--- a/mobile/android/components/HelperAppDialog.js
+++ b/mobile/android/components/HelperAppDialog.js
@@ -146,17 +146,16 @@ HelperAppLauncherDialog.prototype = {
aLauncher.cancel(Cr.NS_BINDING_ABORTED);
}
}.bind(this)).catch(Cu.reportError);
return;
}
let bundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
- let defaultHandler = new Object();
let apps = HelperApps.getAppsForUri(aLauncher.source, {
mimeType: aLauncher.MIMEInfo.MIMEType,
});
if (this._shouldAddSaveToDiskIntent(aLauncher)) {
// Add a fake intent for save to disk at the top of the list.
apps.unshift({
name: bundle.GetStringFromName("helperapps.saveToDisk"),
--- a/mobile/android/components/LoginManagerPrompter.js
+++ b/mobile/android/components/LoginManagerPrompter.js
@@ -160,18 +160,16 @@ LoginManagerPrompter.prototype = {
* save the specified login. This allows the user to see the results of
* their login, and only save a login which they know worked.
*
*/
_showSaveLoginNotification: function(aLogin) {
let brandShortName = this._strBundle.brand.GetStringFromName("brandShortName");
let notificationText = this._getLocalizedString("saveLogin", [brandShortName]);
- let username = aLogin.username ? this._sanitizeUsername(aLogin.username) : "";
-
// The callbacks in |buttons| have a closure to access the variables
// in scope here; set one to |Services.logins| so we can get back to pwmgr
// without a getService() call.
var pwmgr = Services.logins;
let promptHistogram = Services.telemetry.getHistogramById("PWMGR_PROMPT_REMEMBER_ACTION");
var buttons = [
{
@@ -263,18 +261,16 @@ LoginManagerPrompter.prototype = {
*
* Note: The caller doesn't know the username for aNewLogin, so this
* function fills in .username and .usernameField with the values
* from the login selected by the user.
*
* Note; XPCOM stupidity: |count| is just |logins.length|.
*/
promptToChangePasswordWithUsernames: function(logins, count, aNewLogin) {
- const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
-
var usernames = logins.map(l => l.username);
var dialogText = this._getLocalizedString("userSelectText2");
var dialogTitle = this._getLocalizedString("passwordChangeTitle");
var selectedIndex = { value: null };
// If user selects ok, outparam.value is set to the index
// of the selected username.
var ok = Services.prompt.select(null,
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -177,17 +177,17 @@ SessionStore.prototype = {
if (this._sessionFile.exists()) { this._sessionFile.remove(false); }
if (this._sessionFileBackup.exists()) { this._sessionFileBackup.remove(false); }
if (this._sessionFilePrevious.exists()) { this._sessionFilePrevious.remove(false); }
if (this._sessionFileTemp.exists()) { this._sessionFileTemp.remove(false); }
}
},
_forgetClosedTabs: function ss_forgetClosedTabs() {
- for (let [ssid, win] of Object.entries(this._windows)) {
+ for (let win of Object.values(this._windows)) {
win.closedTabs = [];
}
this._lastClosedTabIndex = INVALID_TAB_INDEX;
},
onEvent: function ss_onEvent(event, data, callback) {
switch (event) {
@@ -1254,17 +1254,17 @@ SessionStore.prototype = {
let selected = (i == aData.urls.length - 1);
let params = {
selected,
delayLoad: !selected,
isPrivate: false,
desktopMode: false,
};
- let tab = window.BrowserApp.addTab(url, params);
+ window.BrowserApp.addTab(url, params);
}
},
// This function iterates through a list of tab data restoring session for each of them.
_restoreTabs: function ss_restoreTabs(aData) {
let window = Services.wm.getMostRecentWindow("navigator:browser");
for (let i = 0; i < aData.tabs.length; i++) {
let tabData = JSON.parse(aData.tabs[i]);
@@ -1389,17 +1389,16 @@ SessionStore.prototype = {
throw "Invalid session JSON: " + aData;
}
let window = Services.wm.getMostRecentWindow("navigator:browser");
let tabs = state.windows[0].tabs;
for (let i = 0; i < tabs.length; i++) {
let tabData = tabs[i];
- let entry = tabData.entries[tabData.index - 1];
// Get the stubbed tab
let tab = window.BrowserApp.getTabForId(tabData.tabId);
// Don't restore tab if user has already closed it
if (tab == null) {
delete tabData.tabId;
continue;
--- a/mobile/android/components/geckoview/GeckoViewPermission.js
+++ b/mobile/android/components/geckoview/GeckoViewPermission.js
@@ -177,17 +177,17 @@ GeckoViewPermission.prototype = {
if (types.length !== 1) {
aRequest.cancel();
return;
}
let perm = types.queryElementAt(0, Ci.nsIContentPermissionType);
let dispatcher = GeckoViewUtils.getDispatcherForWindow(
aRequest.window ? aRequest.window : aRequest.element.ownerGlobal);
- let promise = dispatcher.sendRequestForResult({
+ dispatcher.sendRequestForResult({
type: "GeckoView:ContentPermission",
uri: aRequest.principal.URI.displaySpec,
perm: perm.type,
access: perm.access !== "unused" ? perm.access : null,
}).then(granted => {
if (!granted) {
return false;
}
--- a/mobile/android/modules/DownloadNotifications.jsm
+++ b/mobile/android/modules/DownloadNotifications.jsm
@@ -14,18 +14,16 @@ ChromeUtils.defineModuleGetter(this, "No
ChromeUtils.defineModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
ChromeUtils.defineModuleGetter(this, "Services", "resource://gre/modules/Services.jsm");
ChromeUtils.defineModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
ChromeUtils.defineModuleGetter(this, "UITelemetry", "resource://gre/modules/UITelemetry.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "ParentalControls",
"@mozilla.org/parental-controls-service;1", "nsIParentalControlsService");
-var Log = ChromeUtils.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.i.bind(null, "DownloadNotifications");
-
XPCOMUtils.defineLazyGetter(this, "strings",
() => Services.strings.createBundle("chrome://browser/locale/browser.properties"));
Object.defineProperty(this, "window",
{ get: () => Services.wm.getMostRecentWindow("navigator:browser") });
const kButtons = {
PAUSE: new DownloadNotificationButton("pause",
--- a/mobile/android/modules/InputWidgetHelper.jsm
+++ b/mobile/android/modules/InputWidgetHelper.jsm
@@ -35,17 +35,17 @@ var InputWidgetHelper = {
this._uiBusy = true;
this.show(aTarget);
this._uiBusy = false;
},
show: function(aElement) {
let type = aElement.getAttribute("type");
- let p = new Prompt({
+ new Prompt({
window: aElement.ownerGlobal,
title: this.strings().GetStringFromName("inputWidgetHelper." + aElement.getAttribute("type")),
buttons: [
this.strings().GetStringFromName("inputWidgetHelper.set"),
this.strings().GetStringFromName("inputWidgetHelper.clear"),
this.strings().GetStringFromName("inputWidgetHelper.cancel")
],
}).addDatePicker({
--- a/mobile/android/modules/MediaPlayerApp.jsm
+++ b/mobile/android/modules/MediaPlayerApp.jsm
@@ -4,17 +4,16 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = ["MediaPlayerApp"];
ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
-var log = ChromeUtils.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.d.bind(null, "MediaPlayerApp");
// Helper function for sending commands to Java.
function send(type, data, callback) {
let msg = {
type: type
};
for (let i in data) {
--- a/mobile/android/modules/Prompt.jsm
+++ b/mobile/android/modules/Prompt.jsm
@@ -187,17 +187,16 @@ Prompt.prototype = {
dispatcher.sendRequestForResult(this.msg).then((data) => {
if (this.callback) {
this.callback(data);
}
});
},
_setListItems: function(aItems) {
- let hasSelected = false;
this.msg.listitems = [];
aItems.forEach(function(item) {
let obj = { id: item.id };
obj.label = item.label;
if (item.disabled)
--- a/mobile/android/modules/Sanitizer.jsm
+++ b/mobile/android/modules/Sanitizer.jsm
@@ -13,20 +13,16 @@ XPCOMUtils.defineLazyModuleGetters(this,
Downloads: "resource://gre/modules/Downloads.jsm",
EventDispatcher: "resource://gre/modules/Messaging.jsm",
FormHistory: "resource://gre/modules/FormHistory.jsm",
OS: "resource://gre/modules/osfile.jsm",
Task: "resource://gre/modules/Task.jsm",
TelemetryStopwatch: "resource://gre/modules/TelemetryStopwatch.jsm",
});
-function dump(a) {
- Services.console.logStringMessage(a);
-}
-
this.EXPORTED_SYMBOLS = ["Sanitizer"];
function Sanitizer() {}
Sanitizer.prototype = {
clearItem: function(aItemName, startTime) {
// Only a subset of items support deletion with startTime.
// Those who do not will be rejected with error message.
if (typeof startTime != "undefined") {
--- a/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
@@ -10,19 +10,19 @@ ChromeUtils.import("resource://gre/modul
ChromeUtils.defineModuleGetter(this, "EventDispatcher",
"resource://gre/modules/Messaging.jsm");
XPCOMUtils.defineLazyGetter(this, "dump", () =>
ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
{}).AndroidLog.d.bind(null, "ViewContentModule"));
-function debug(aMsg) {
- // dump(aMsg);
-}
+// function debug(aMsg) {
+// dump(aMsg);
+// }
class GeckoViewContentModule {
constructor(aModuleName, aMessageManager) {
this.moduleName = aModuleName;
this.messageManager = aMessageManager;
this.eventDispatcher = EventDispatcher.forMessageManager(aMessageManager);
this.messageManager.addMessageListener(
--- a/mobile/android/modules/geckoview/GeckoViewModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewModule.jsm
@@ -7,19 +7,19 @@
this.EXPORTED_SYMBOLS = ["GeckoViewModule"];
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "dump", () =>
ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
{}).AndroidLog.d.bind(null, "ViewModule"));
-function debug(aMsg) {
- // dump(aMsg);
-}
+// function debug(aMsg) {
+// dump(aMsg);
+// }
class GeckoViewModule {
constructor(aModuleName, aWindow, aBrowser, aEventDispatcher) {
this.isRegistered = false;
this.window = aWindow;
this.browser = aBrowser;
this.eventDispatcher = aEventDispatcher;
this.moduleName = aModuleName;
--- a/mobile/android/modules/geckoview/GeckoViewTab.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewTab.jsm
@@ -8,19 +8,19 @@ this.EXPORTED_SYMBOLS = ["GeckoViewTab"]
ChromeUtils.import("resource://gre/modules/GeckoViewModule.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyGetter(this, "dump", () =>
ChromeUtils.import("resource://gre/modules/AndroidLog.jsm",
{}).AndroidLog.d.bind(null, "ViewTab"));
-function debug(aMsg) {
- // dump(aMsg);
-}
+// function debug(aMsg) {
+// dump(aMsg);
+// }
// Stub BrowserApp implementation for WebExtensions support.
class GeckoViewTab extends GeckoViewModule {
init() {
this.browser.tab = { id: 0, browser: this.browser };
this.window.gBrowser = this.window.BrowserApp = {
selectedBrowser: this.browser,