Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1322343 - Enable no-unused-vars in the local scope in toolkit/.es…
Browse files Browse the repository at this point in the history
…lintrc.js. r=mossop

MozReview-Commit-ID: CiIsUjQzp4D
  • Loading branch information
Standard8 committed Nov 9, 2016
1 parent 216a921 commit cb71c64
Show file tree
Hide file tree
Showing 70 changed files with 62 additions and 192 deletions.
5 changes: 0 additions & 5 deletions browser/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ module.exports = {
],

"rules": {
"no-unused-vars": ["error", {
"vars": "local",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
"args": "none",
}],
"no-shadow": "error"
}
};
7 changes: 0 additions & 7 deletions browser/base/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
"use strict";

module.exports = {
"rules": {
"no-unused-vars": ["error", {
"vars": "local",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
"args": "none",
}]
}
};
2 changes: 1 addition & 1 deletion storage/test/unit/test_bug-429521.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function test_bug429521() {

// BUG: the print commands after the following statement
// are never executed. Script stops immediately.
var tzId = stmt.row.zone;
stmt.row.zone;

print("*** test_bug429521: step() Read wrapper.row.zone finished");
}
Expand Down
2 changes: 1 addition & 1 deletion storage/test/unit/test_statement_executeAsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ function test_not_right_owning_statement()
);

let array1 = stmt1.newBindingParamsArray();
let array2 = stmt2.newBindingParamsArray();
stmt2.newBindingParamsArray();
let bp = array1.newBindingParams();
bp.bindByName("int", INTEGER);
array1.addParams(bp);
Expand Down
2 changes: 1 addition & 1 deletion storage/test/unit/test_storage_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ add_task(function* test_createTable() {
});

add_task(function* test_defaultSynchronousAtNormal() {
var msc = getOpenedDatabase();
getOpenedDatabase();
var stmt = createStatement("PRAGMA synchronous;");
try {
stmt.executeStep();
Expand Down
10 changes: 5 additions & 5 deletions toolkit/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ module.exports = {
"no-unreachable": "error",

// No declaring variables that are never used
// "no-unused-vars": ["error", {
// "vars": "local",
// "varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
// "args": "none",
// }],
"no-unused-vars": ["error", {
"vars": "local",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
"args": "none",
}],

// No using variables before defined
// "no-use-before-define": ["error", "nofunc"],
Expand Down
5 changes: 0 additions & 5 deletions toolkit/components/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,5 @@

module.exports = {
"rules": {
"no-unused-vars": ["error", {
"vars": "local",
"varsIgnorePattern": "^Cc|Ci|Cu|Cr|EXPORTED_SYMBOLS",
"args": "none",
}]
}
};
2 changes: 1 addition & 1 deletion toolkit/content/aboutSupport.js
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ var snapshotFormatters = {
showGpu("gpu-2", "2");

// Remove adapter keys.
for (let [prop, key] of adapterKeys) {
for (let [prop, /* key */] of adapterKeys) {
delete data[prop];
delete data[prop + "2"];
}
Expand Down
2 changes: 0 additions & 2 deletions toolkit/content/aboutTelemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,6 @@ var PingPicker = {
let weekSelector = document.getElementById("choose-ping-week");
removeAllChildNodes(weekSelector);

let index = 0;
for (let week of this._weeks) {
let text = shortDateString(week.startDate)
+ " - " + shortDateString(yesterday(week.endDate));
Expand Down Expand Up @@ -628,7 +627,6 @@ var EnvironmentData = {
},

renderActivePlugins: function(addonObj, addonSection, sectionTitle) {
let data = explodeObject(addonObj);
let table = document.createElement("table");
table.setAttribute("id", sectionTitle);
this.appendAddonSubsectionTitle(sectionTitle, table);
Expand Down
1 change: 0 additions & 1 deletion toolkit/content/aboutwebrtc/aboutWebrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ AecLogging.prototype.offState = function() {
AecLogging.prototype.onState = function() {
this._label = getString("aec_logging_on_state_label");
try {
let file = Services.prefs.getCharPref("media.webrtc.debug.aec_log_dir");
this._message = getString("aec_logging_on_state_msg");
} catch (e) {
this._message = null;
Expand Down
2 changes: 0 additions & 2 deletions toolkit/content/browser-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ var Printing = {
},

receiveMessage(message) {
let objects = message.objects;
let data = message.data;
switch (message.name) {
case "Printing:Preview:Enter": {
Expand Down Expand Up @@ -664,7 +663,6 @@ var Printing = {

print(contentWindow, simplifiedMode) {
let printSettings = this.getPrintSettings();
let rv = Cr.NS_OK;

// If we happen to be on simplified mode, we need to set docURL in order
// to generate header/footer content correctly, since simplified tab has
Expand Down
11 changes: 0 additions & 11 deletions toolkit/content/tests/browser/browser_bug1170531.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,8 @@

add_task(function* () {
// Get a bunch of DOM nodes
let winUtils = window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDOMWindowUtils);

let editMenu = document.getElementById("edit-menu");
let menubar = editMenu.parentNode;
let menuPopup = editMenu.menupopup;
let editMenuIndex = -1;
for (let i = 0; i < menubar.children.length; i++) {
if (menubar.children[i] === editMenu) {
editMenuIndex = i;
break;
}
}

let closeMenu = function(aCallback) {
if (OS.Constants.Sys.Name == "Darwin") {
Expand Down
1 change: 0 additions & 1 deletion toolkit/content/tests/browser/browser_contentTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ var url = "https://example.com/browser/toolkit/content/tests/browser/file_conten

add_task(function*() {
let tab = gBrowser.selectedTab = gBrowser.addTab(url);
let browser = tab.linkedBrowser;
yield new Promise((resolve) => {
addEventListener("TestLocationChange", function listener() {
removeEventListener("TestLocationChange", listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ add_task(function* test_crash_in_previous_frameloader() {

gBrowser.updateBrowserRemoteness(browser, false);
info("Waiting for content process to go away.");
let [subject, data] = yield contentProcessGone;
let [subject /* , data */] = yield contentProcessGone;

// If we don't clean up the minidump, the harness will
// complain.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ add_task(function * ()
var expectedKeyEvents;
var dispatchedKeyEvents;
var key;
var root;

/**
* Encapsulates EventUtils.sendChar().
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
synthesizeKey("VK_RETURN", {});
target.value = "";

var test1 = new nsDoTestsForAutoCompleteWithComposition(
new nsDoTestsForAutoCompleteWithComposition(
"Testing on HTML input (asynchronously search)",
window, target, formFillController.controller, is,
function() { return target.value; },
function() {
target.setAttribute("timeout", 0);
var test2 = new nsDoTestsForAutoCompleteWithComposition(
new nsDoTestsForAutoCompleteWithComposition(
"Testing on HTML input (synchronously search)",
window, target, formFillController.controller, is,
function() { return target.value; },
Expand Down
2 changes: 1 addition & 1 deletion toolkit/content/tests/chrome/xul_selectcontrol.js
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function test_nsIDOMXULSelectControlElement_UI(element, testprefix)
var thirditem = element.appendItem("Third Item", "third");
var fourthitem = element.appendItem("Fourth Item", "fourth");
if (behaviourContains(element.localName, "select-extended-keynav")) {
var fifthitem = element.appendItem("Fifth Item", "fifth");
element.appendItem("Fifth Item", "fifth");
var sixthitem = element.appendItem("Sixth Item", "sixth");

synthesizeKeyExpectEvent("VK_END", {}, element, "select", testid + "key end");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,11 @@ function() {
};
}

function clampViewportWH(width, height, visibleRect) {
let minW = visibleRect.width;
let minH = visibleRect.height;
return [Math.max(width, minW), Math.max(height, minH)];
}

function initContainer(container, visibleRect) {
container.style.width = visibleRect.width + 'px';
container.style.height = visibleRect.height + 'px';
container.style.overflow = '-moz-hidden-unscrollable';
}
// function clampViewportWH(width, height, visibleRect) {
// let minW = visibleRect.width;
// let minH = visibleRect.height;
// return [Math.max(width, minW), Math.max(height, minH)];
// }

function resizeContainerToViewport(container, viewportRect) {
container.style.width = viewportRect.width + 'px';
Expand Down Expand Up @@ -257,7 +251,6 @@ function() {

setViewportDimensions: function setViewportDimensions(width, height, causedByZoom) {
let bvs = this._browserViewportState;
let vis = this._visibleRect;

if (!bvs)
return;
Expand Down Expand Up @@ -330,9 +323,6 @@ function() {
},

moveVisibleBy: function moveVisibleBy(dx, dy) {
let vr = this._visibleRect;
let vs = this._browserViewportState;

this.onBeforeVisibleMove(dx, dy);
this.onAfterVisibleMove(dx, dy);
},
Expand Down Expand Up @@ -691,4 +681,3 @@ BrowserView.BrowserViewportState.prototype = {
}

};

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ BrowserView.prototype = {

scrollboxToViewportRect: function scrollboxToViewportRect(rect, clip) {
let leftbar = this._leftbar.getBoundingClientRect();
let rightbar = this._rightbar.getBoundingClientRect();
let topbar = this._topbar.getBoundingClientRect();

let xtrans = -leftbar.width;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ TileManager.prototype = {

// this._tileCache.forEachIntersectingRect(destCriticalRect, false, appendNonDirtyTile, this);
let visited = {};
let evictGuard = null;
if (create) {
evictGuard = function evictGuard(tile) {
return !visited[tile.toString()];
Expand Down Expand Up @@ -828,8 +827,6 @@ TileManager.Tile.prototype = {

ctx.translate(x, y);

let cw = browserView._contentWindow;
// let cw = browser.contentWindow;
ctx.asyncDrawXULElement(browserView._browser,
rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,8 +589,6 @@ WidgetStack.prototype = {
throw "Invalid number of arguments to setViewportBounds";
}

let vp = this._viewport;

let dleft = this._viewportBounds.left - oldBounds.left;
let dright = this._viewportBounds.right - oldBounds.right;
let dtop = this._viewportBounds.top - oldBounds.top;
Expand Down Expand Up @@ -627,15 +625,13 @@ WidgetStack.prototype = {

if (barrier.vpRelative) {
if (barrier.type == "vertical") {
let q = "v barrier moving from " + barrier.x + " to ";
if (barrier.vpOffsetXBefore) {
barrier.x += dleft;
} else {
barrier.x += dright;
}
// log2(q += barrier.x);
} else if (barrier.type == "horizontal") {
let q = "h barrier moving from " + barrier.y + " to ";
if (barrier.vpOffsetYBefore) {
barrier.y += dtop;
} else {
Expand Down Expand Up @@ -1240,8 +1236,6 @@ WidgetStack.prototype = {
_updateWidgets: function() {
let vp = this._viewport;

let ofRect = this._viewingRect.clone();

for (let wid in this._widgetState) {
let state = this._widgetState[wid];
if (vp && state.vpRelative) {
Expand Down Expand Up @@ -1376,8 +1370,6 @@ WidgetStack.prototype = {
throw "Invalid barrier type: " + t;
}

let x, y;

let barrier = {};
let vp = this._viewport;

Expand Down
8 changes: 2 additions & 6 deletions toolkit/content/tests/mochitest/test_mousecapture.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<title>Mouse Capture Tests</title>
<link rel="stylesheet" href="chrome://global/skin/" type="text/css"/>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body id="body" xmlns="http://www.w3.org/1999/xhtml">
<p id="display"/><div id="content" style="display: none"/><pre id="test"/>
Expand Down Expand Up @@ -172,9 +172,6 @@ function runTests()
var scrollX = parent ? parent.scrollX : 0;
var scrollY = parent ? parent.scrollY : 0;

var b = frames[0].document.getElementById("b");
// runCaptureTest(b, selectionCallback);

// restore scroll
if (parent) parent.scroll(scrollX, scrollY);

Expand Down Expand Up @@ -336,4 +333,3 @@ SimpleTest.waitForFocus(runTests);
</body>

</html>

2 changes: 0 additions & 2 deletions toolkit/content/tests/widgets/tree_shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,6 @@ function testtag_tree_UI_editing(tree, testid, rowInfo)
// check editing UI
var ecolumn = tree.columns[0];
var rowIndex = 2;
var inputField = tree.inputField;

// temporary make the tree editable to test mouse double click
var wasEditable = tree.editable;
Expand Down Expand Up @@ -923,7 +922,6 @@ function testtag_tree_TreeView_rows(tree, testid, rowInfo, startRow)

var failedMethods = { };
var checkMethod, actual, expected;
var containerInfo = null;
var toggleOpenStateOK = true;

for (r = startRow; r < length; r++) {
Expand Down
2 changes: 0 additions & 2 deletions toolkit/content/treeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ var gTreeUtils = {
if (aDataSet.length == 0)
return ascending;

var numericSort = !isNaN(aDataSet[0][aColumn]);
var sortFunction = null;
if (aComparator) {
sortFunction = function(a, b) { return aComparator(a[aColumn], b[aColumn]); };
Expand All @@ -75,4 +74,3 @@ var gTreeUtils = {
return ascending;
}
};

4 changes: 2 additions & 2 deletions toolkit/content/widgets/browser.xml
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,8 @@
Components.utils.reportError(e);
}
try {
var securityUI = this.securityUI;
// Ensures the securityUI is initialized.
var securityUI = this.securityUI; // eslint-disable-line no-unused-vars
}
catch (e) {
}
Expand Down Expand Up @@ -1569,7 +1570,6 @@
if (!this.droppedLinkHandler || event.defaultPrevented || this.isRemoteBrowser)
return;
let name = { };
let linkHandler = Components.classes["@mozilla.org/content/dropped-link-handler;1"].
getService(Components.interfaces.nsIDroppedLinkHandler);
try {
Expand Down
2 changes: 0 additions & 2 deletions toolkit/content/widgets/popup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -401,8 +401,6 @@
<method name="adjustArrowPosition">
<body>
<![CDATA[
var arrow = document.getAnonymousElementByAttribute(this, "anonid", "arrow");
var anchor = this.anchorNode;
if (!anchor) {
return;
Expand Down
Loading

0 comments on commit cb71c64

Please sign in to comment.