--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -5622,17 +5622,17 @@
let scrollButtonWidth = this.mTabstrip._scrollButtonDown.getBoundingClientRect().width;
let paddingStart = this.mTabstrip.scrollboxPaddingStart;
let width = 0;
for (let i = numPinned - 1; i >= 0; i--) {
let tab = this.childNodes[i];
width += tab.getBoundingClientRect().width;
- tab.style.marginInlineStart = - (width + scrollButtonWidth + paddingStart) + "px";
+ tab.style.marginInlineStart = -(width + scrollButtonWidth + paddingStart) + "px";
}
this.style.paddingInlineStart = width + paddingStart + "px";
} else {
this.removeAttribute("positionpinnedtabs");
for (let i = 0; i < numPinned; i++) {
--- a/browser/base/content/test/general/browser_gestureSupport.js
+++ b/browser/base/content/test/general/browser_gestureSupport.js
@@ -307,18 +307,18 @@ function test_emitLatchedEvents(eventPre
let delta = Math.random() * (isIncreasing ? 100 : -100);
test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, delta, 0);
cumulativeDelta += delta;
checkBoth(2, "Increasing command was triggered", "Decreasing command was triggered");
}
// Now go back in the opposite direction.
test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0,
- - initialDelta, 0);
- cumulativeDelta += - initialDelta;
+ -initialDelta, 0);
+ cumulativeDelta += -initialDelta;
if (isIncreasing) {
expect.dec++;
checkBoth(3, "Increasing command was triggered", "Decreasing command was not triggered");
} else {
expect.inc++;
checkBoth(3, "Increasing command was not triggered", "Decreasing command was triggered");
}
--- a/browser/components/places/content/bookmarkProperties.js
+++ b/browser/components/places/content/bookmarkProperties.js
@@ -364,17 +364,17 @@ var BookmarkPropertiesPanel = {
// Check uri fields to enable accept button if input is valid
document.documentElement
.getButton("accept").disabled = !this._inputIsValid();
}
break;
case "resize":
for (let [id, oldHeight] of elementsHeight) {
let newHeight = document.getElementById(id).boxObject.height;
- this._height += - oldHeight + newHeight;
+ this._height += -oldHeight + newHeight;
elementsHeight.set(id, newHeight);
}
break;
}
},
// Hack for implementing batched-Undo around the editBookmarkOverlay
// instant-apply code. For all the details see the comment above beginBatch
--- a/browser/components/preferences/translation.js
+++ b/browser/components/preferences/translation.js
@@ -135,17 +135,17 @@ var gTranslationExceptions = {
},
observe: function(aSubject, aTopic, aData) {
if (aTopic == "perm-changed") {
if (aData == "cleared") {
if (!this._sites.length)
return;
let removed = this._sites.splice(0, this._sites.length);
- this._siteTree.boxObject.rowCountChanged(0, - removed.length);
+ this._siteTree.boxObject.rowCountChanged(0, -removed.length);
}
else {
let perm = aSubject.QueryInterface(Ci.nsIPermission);
if (perm.type != kPermissionType)
return;
if (aData == "added") {
if (perm.capability != Services.perms.DENY_ACTION)
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -176,17 +176,23 @@ module.exports = {
// No space padding in parentheses
// "space-in-parens": ["error", "never"],
// Require spaces around operators
"space-infix-ops": ["error", { "int32Hint": false }],
// ++ and -- should not need spacing
- // "space-unary-ops": ["error", { "words": true, "nonwords": false }],
+ "space-unary-ops": ["error", {
+ "words": true,
+ "nonwords": false,
+ "overrides": {
+ "typeof": false // We tend to use typeof as a function call
+ }
+ }],
// Requires or disallows a whitespace (space or tab) beginning a comment
"spaced-comment": "error",
// No comparisons to NaN
"use-isnan": "error",
// Only check typeof against valid results
--- a/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js
+++ b/toolkit/components/aboutcheckerboard/content/aboutCheckerboard.js
@@ -91,17 +91,17 @@ function loadData() {
var charPos = 0;
var lastLineLength = 0;
var lines = trace.value.split(/\r|\n/);
for (var i = 0; i < lines.length; i++) {
charPos += lastLineLength;
lastLineLength = lines[i].length + 1;
// skip lines without RENDERTRACE
- if (! /RENDERTRACE/.test(lines[i])) {
+ if (!/RENDERTRACE/.test(lines[i])) {
continue;
}
var tokens = lines[i].split(/\s+/);
var j = 0;
// skip tokens until RENDERTRACE
while (j < tokens.length && tokens[j++] != "RENDERTRACE"); // empty loop body
if (j >= tokens.length - 2) {
@@ -158,32 +158,32 @@ function loadData() {
break;
default:
log("Error parsing line " + lines[i]);
break;
}
}
- if (! renderFrame()) {
+ if (!renderFrame()) {
alert("No data found; nothing to render!");
}
}
// render the current frame (i.e. renderData[currentFrame])
// returns false if currentFrame is out of bounds, true otherwise
function renderFrame() {
var frame = currentFrame;
if (frame < 0 || frame >= renderData.length) {
log("Invalid frame index");
return false;
}
var canvas = document.getElementById('canvas');
- if (! canvas.getContext) {
+ if (!canvas.getContext) {
log("No canvas context");
}
var context = canvas.getContext('2d');
// midpoint of the bounding box
var midX = (minX + maxX) / 2.0;
var midY = (minY + maxY) / 2.0;
@@ -237,33 +237,33 @@ function reset(beginning) {
renderFrame();
}
function step(backwards) {
if (playing) {
togglePlay();
}
currentFrame += (backwards ? -1 : 1);
- if (! renderFrame()) {
+ if (!renderFrame()) {
currentFrame -= (backwards ? -1 : 1);
}
}
function pause() {
clearInterval(timerId);
playing = false;
}
function togglePlay() {
if (playing) {
pause();
} else {
timerId = setInterval(function() {
currentFrame++;
- if (! renderFrame()) {
+ if (!renderFrame()) {
currentFrame--;
togglePlay();
}
}, FRAME_INTERVAL_MS);
playing = true;
}
}
--- a/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
+++ b/toolkit/components/passwordmgr/test/chrome/test_privbrowsing_perwindowpb.html
@@ -41,17 +41,17 @@ var subtests = [
"subtst_privbrowsing_4.html", // 9
"subtst_privbrowsing_3.html" // 10
];
var observer;
var testNum = 0;
function loadNextTest() {
// run the initialization code for each test
- switch (++ testNum) {
+ switch (++testNum) {
case 1:
popupNotifications = normalWindowPopupNotifications;
iframe = normalWindowIframe;
break;
case 2:
popupNotifications = privateWindowPopupNotifications;
iframe = privateWindowIframe;
--- a/toolkit/components/places/tests/unit/test_454977.js
+++ b/toolkit/components/places/tests/unit/test_454977.js
@@ -32,17 +32,17 @@ function* task_add_visit(aURI, aVisitTyp
let visitId = yield deferUpdatePlaces;
// Increase visit_count if applicable
if (aVisitType != 0 &&
aVisitType != TRANSITION_EMBED &&
aVisitType != TRANSITION_FRAMED_LINK &&
aVisitType != TRANSITION_DOWNLOAD &&
aVisitType != TRANSITION_RELOAD) {
- visit_count ++;
+ visit_count++;
}
// Get the place id
if (visitId > 0) {
let sql = "SELECT place_id FROM moz_historyvisits WHERE id = ?1";
let stmt = DBConn().createStatement(sql);
stmt.bindByIndex(0, visitId);
do_check_true(stmt.executeStep());
--- a/toolkit/components/telemetry/TelemetryUtils.jsm
+++ b/toolkit/components/telemetry/TelemetryUtils.jsm
@@ -131,17 +131,17 @@ this.TelemetryUtils = {
while (number.length < places) {
number = "0" + number;
}
return number;
}
let sign = (n) => n >= 0 ? "+" : "-";
// getTimezoneOffset counter-intuitively returns -60 for UTC+1.
- let tzOffset = - date.getTimezoneOffset();
+ let tzOffset = -date.getTimezoneOffset();
// YYYY-MM-DDThh:mm:ss.sTZD (eg 1997-07-16T19:20:30.45+01:00)
return padNumber(date.getFullYear(), 4)
+ "-" + padNumber(date.getMonth() + 1, 2)
+ "-" + padNumber(date.getDate(), 2)
+ "T" + padNumber(date.getHours(), 2)
+ ":" + padNumber(date.getMinutes(), 2)
+ ":" + padNumber(date.getSeconds(), 2)
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ -41,17 +41,17 @@ function waitForTimer() {
}
// Allow easy faking of readable ping ids.
// This helps with debugging issues with e.g. ordering in the send logic.
function fakePingId(type, number) {
const HEAD = "93bd0011-2c8f-4e1c-bee0-";
const TAIL = "000000000000";
const N = String(number);
- const id = HEAD + type + TAIL.slice(type.length, - N.length) + N;
+ const id = HEAD + type + TAIL.slice(type.length, -N.length) + N;
fakeGeneratePingId(() => id);
return id;
}
var checkPingsSaved = Task.async(function* (pingIds) {
let allFound = true;
for (let id of pingIds) {
const path = OS.Path.join(TelemetryStorage.pingDirectoryPath, id);
--- a/toolkit/content/widgets/datetimepicker.xml
+++ b/toolkit/content/widgets/datetimepicker.xml
@@ -179,17 +179,17 @@
this._lastFocusedField = target;
]]>
</handler>
<handler event="keypress">
<![CDATA[
if (this._hasEntry && event.charCode &&
this._currentField != this._fieldAMPM &&
- ! (event.altKey || event.ctrlKey || event.metaKey) &&
+ !(event.altKey || event.ctrlKey || event.metaKey) &&
(event.charCode < 48 || event.charCode > 57))
event.preventDefault();
]]>
</handler>
<handler event="keypress" keycode="VK_UP">
if (this._hasEntry)
this._increaseOrDecrease(1);
--- a/toolkit/content/widgets/textbox.xml
+++ b/toolkit/content/widgets/textbox.xml
@@ -499,17 +499,17 @@
</body>
</method>
<method name="_setMenuItemVisibility">
<parameter name="anonid"/>
<parameter name="visible"/>
<body><![CDATA[
document.getAnonymousElementByAttribute(this, "anonid", anonid).
- hidden = ! visible;
+ hidden = !visible;
]]></body>
</method>
<method name="doCommand">
<parameter name="command"/>
<body>
<![CDATA[
var controller = document.commandDispatcher.getControllerForCommand(command);
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -1171,17 +1171,17 @@
if (parentSelectable)
view.selection.select(parentIndex);
}
}
this.parentNode.changeOpenState(cell.row);
return;
}
- if (! view.selection.single) {
+ if (!view.selection.single) {
var augment = this._isAccelPressed(event);
if (event.shiftKey) {
view.selection.rangedSelect(-1, cell.row, augment);
b.ensureRowIsVisible(cell.row);
return;
}
if (augment) {
view.selection.toggleSelect(cell.row);
--- a/toolkit/identity/Identity.jsm
+++ b/toolkit/identity/Identity.jsm
@@ -270,17 +270,17 @@ IDService.prototype = {
if (req.status < 200 || req.status >= 400) {
log("_fetchWellKnownFile", url, ": server returned status:", req.status);
return aCallback("Error");
}
try {
let idpParams = req.response;
// Verify that the IdP returned a valid configuration
- if (! (idpParams.provisioning &&
+ if (!(idpParams.provisioning &&
idpParams.authentication &&
idpParams['public-key'])) {
let errStr = "Invalid well-known file from: " + aDomain;
log("_fetchWellKnownFile:", errStr);
return aCallback(errStr);
}
let callbackObj = {
--- a/toolkit/identity/IdentityUtils.jsm
+++ b/toolkit/identity/IdentityUtils.jsm
@@ -48,17 +48,17 @@ this.checkRenamed = function checkRename
defined(aOptions[aNewName])) {
let err = "You cannot provide both " + aOldName + " and " + aNewName;
Logger.reportError(err);
throw new Error(err);
}
if (checkDeprecated(aOptions, aOldName)) {
aOptions[aNewName] = aOptions[aOldName];
- delete(aOptions[aOldName]);
+ delete aOptions[aOldName];
}
};
this.getRandomId = function getRandomId() {
return uuidgen.generateUUID().toString();
};
/*
--- a/toolkit/identity/RelyingParty.jsm
+++ b/toolkit/identity/RelyingParty.jsm
@@ -326,17 +326,17 @@ IdentityRelyingParty.prototype = {
* @param aCallback
* (function) callback to invoke on completion
* with first-positional parameter the error.
*/
_generateAssertion: function _generateAssertion(aAudience, aIdentity, aCallback) {
log("_generateAssertion: audience:", aAudience, "identity:", aIdentity);
let id = this._store.fetchIdentity(aIdentity);
- if (! (id && id.cert)) {
+ if (!(id && id.cert)) {
let errStr = "Cannot generate an assertion without a certificate";
log("ERROR: _generateAssertion:", errStr);
aCallback(errStr);
return;
}
let kp = id.keyPair;
--- a/toolkit/modules/InlineSpellChecker.jsm
+++ b/toolkit/modules/InlineSpellChecker.jsm
@@ -76,17 +76,17 @@ InlineSpellChecker.prototype = {
var selcon = this.mEditor.selectionController;
var spellsel = selcon.getSelection(selcon.SELECTION_SPELLCHECK);
if (spellsel.rangeCount == 0)
return; // easy case - no misspellings
var range = this.mInlineSpellChecker.getMisspelledWord(rangeParent,
rangeOffset);
- if (! range)
+ if (!range)
return; // not over a misspelled word
this.mMisspelling = range.toString();
this.mOverMisspelling = true;
this.mWordNode = rangeParent;
this.mWordOffset = rangeOffset;
},
@@ -145,19 +145,19 @@ InlineSpellChecker.prototype = {
return 0; // word seems not misspelled after all (?)
} catch (e) {
return 0;
}
this.mMenu = menu;
this.mSpellSuggestions = [];
this.mSuggestionItems = [];
- for (var i = 0; i < maxNumber; i ++) {
+ for (var i = 0; i < maxNumber; i++) {
var suggestion = spellchecker.GetSuggestedWord();
- if (! suggestion.length)
+ if (!suggestion.length)
break;
this.mSpellSuggestions.push(suggestion);
var item = menu.ownerDocument.createElement("menuitem");
this.mSuggestionItems.push(item);
item.setAttribute("label", suggestion);
item.setAttribute("value", suggestion);
// this function thing is necessary to generate a callback with the
@@ -169,25 +169,25 @@ InlineSpellChecker.prototype = {
}
return this.mSpellSuggestions.length;
},
// undoes the work of addSuggestionsToMenu for the same menu
// (call from popup hiding)
clearSuggestionsFromMenu: function()
{
- for (var i = 0; i < this.mSuggestionItems.length; i ++) {
+ for (var i = 0; i < this.mSuggestionItems.length; i++) {
this.mMenu.removeChild(this.mSuggestionItems[i]);
}
this.mSuggestionItems = [];
},
sortDictionaryList: function(list) {
var sortedList = [];
- for (var i = 0; i < list.length; i ++) {
+ for (var i = 0; i < list.length; i++) {
sortedList.push({"id": list[i],
"label": this.getDictionaryDisplayName(list[i])});
}
sortedList.sort(function(a, b) {
if (a.label < b.label)
return -1;
if (a.label > b.label)
return 1;
@@ -222,17 +222,17 @@ InlineSpellChecker.prototype = {
var listcount = o2.value;
try {
curlang = spellchecker.GetCurrentDictionary();
} catch (e) {}
}
var sortedList = this.sortDictionaryList(list);
- for (var i = 0; i < sortedList.length; i ++) {
+ for (var i = 0; i < sortedList.length; i++) {
this.mDictionaryNames.push(sortedList[i].id);
var item = menu.ownerDocument.createElement("menuitem");
item.setAttribute("id", "spell-check-dictionary-" + sortedList[i].id);
item.setAttribute("label", sortedList[i].label);
item.setAttribute("type", "radio");
this.mDictionaryItems.push(item);
if (curlang == sortedList[i].id) {
item.setAttribute("checked", "true");
@@ -316,44 +316,44 @@ InlineSpellChecker.prototype = {
return displayName;
},
// undoes the work of addDictionaryListToMenu for the menu
// (call on popup hiding)
clearDictionaryListFromMenu: function()
{
- for (var i = 0; i < this.mDictionaryItems.length; i ++) {
+ for (var i = 0; i < this.mDictionaryItems.length; i++) {
this.mDictionaryMenu.removeChild(this.mDictionaryItems[i]);
}
this.mDictionaryItems = [];
},
// callback for selecting a dictionary
selectDictionary: function(index)
{
if (this.mRemote) {
this.mRemote.selectDictionary(index);
return;
}
- if (! this.mInlineSpellChecker || index < 0 || index >= this.mDictionaryNames.length)
+ if (!this.mInlineSpellChecker || index < 0 || index >= this.mDictionaryNames.length)
return;
var spellchecker = this.mInlineSpellChecker.spellChecker;
spellchecker.SetCurrentDictionary(this.mDictionaryNames[index]);
this.mInlineSpellChecker.spellCheckRange(null); // causes recheck
},
// callback for selecting a suggested replacement
replaceMisspelling: function(index)
{
if (this.mRemote) {
this.mRemote.replaceMisspelling(index);
return;
}
- if (! this.mInlineSpellChecker || ! this.mOverMisspelling)
+ if (!this.mInlineSpellChecker || !this.mOverMisspelling)
return;
if (index < 0 || index >= this.mSpellSuggestions.length)
return;
this.mInlineSpellChecker.replaceWord(this.mWordNode, this.mWordOffset,
this.mSpellSuggestions[index]);
},
// callback for enabling or disabling spellchecking
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -1947,17 +1947,17 @@ function removeAsync(aFile) {
try {
info = yield OS.File.stat(aFile.path);
if (info.isDir)
yield OS.File.removeDir(aFile.path);
else
yield OS.File.remove(aFile.path);
}
catch (e) {
- if (!(e instanceof OS.File.Error) || ! e.becauseNoSuchFile)
+ if (!(e instanceof OS.File.Error) || !e.becauseNoSuchFile)
throw e;
// The file has already gone away
return;
}
});
}
/**