[Pkg-mozext-commits] [tabmixplus] 26/73: Enable Eslint 'no-implicit-coercion'
David Prévot
taffit at moszumanska.debian.org
Mon May 9 02:30:52 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit 92ea1e439782eaf918ba94d74b8099233c06d2ce
Author: onemen <tabmix.onemen at gmail.com>
Date: Sun Apr 3 16:45:24 2016 +0300
Enable Eslint 'no-implicit-coercion'
---
.eslintrc.js | 2 +-
chrome/content/content.js | 2 +-
chrome/content/flst/lasttab.js | 2 +-
chrome/content/minit/tablib.js | 4 ++--
chrome/content/preferences/session.js | 2 +-
chrome/content/session/session.js | 16 ++++++++--------
chrome/content/tab/tab.js | 7 +++----
chrome/content/tabmix.js | 2 +-
modules/ContentClick.jsm | 2 +-
modules/DynamicRules.jsm | 3 ++-
modules/LinkNodeUtils.jsm | 2 +-
modules/extensions/CompatibilityCheck.jsm | 2 +-
12 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/.eslintrc.js b/.eslintrc.js
index dbbca16..227165e 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -57,7 +57,7 @@ module.exports = {
"no-fallthrough": 2,
"no-floating-decimal": 0,
"no-func-assign": 2,
- "no-implicit-coercion": 0,
+ "no-implicit-coercion": 2,
"no-implicit-globals": 0,
"no-implied-eval": 2,
"no-inline-comments": 0,
diff --git a/chrome/content/content.js b/chrome/content/content.js
index 114d38a..6fade4a 100644
--- a/chrome/content/content.js
+++ b/chrome/content/content.js
@@ -120,7 +120,7 @@ var TabmixContentHandler = {
let referrer = entry.referrerURI;
json.referrer = referrer ? referrer.spec : null;
}
- json.isPostData = !!json.postData;
+ json.isPostData = Boolean(json.postData);
}
sendAsyncMessage("Tabmix:reloadTab", json);
break;
diff --git a/chrome/content/flst/lasttab.js b/chrome/content/flst/lasttab.js
index 8cd6e81..15ddc59 100644
--- a/chrome/content/flst/lasttab.js
+++ b/chrome/content/flst/lasttab.js
@@ -374,7 +374,7 @@ var TMP_LastTab = {
var mostRecentlyUsed = Services.prefs.getBoolPref("browser.ctrlTab.previews");
var tabPreviews = document.getElementById("ctrlTab-panel") && "ctrlTab" in window;
if (tabPreviews) {
- var tabPreviewsCurentStatus = !!ctrlTab._recentlyUsedTabs;
+ var tabPreviewsCurentStatus = Boolean(ctrlTab._recentlyUsedTabs);
tabPreviews = mostRecentlyUsed && Tabmix.prefs.getBoolPref("lasttab.tabPreviews");
if (tabPreviewsCurentStatus != tabPreviews) {
if (tabPreviews) {
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 24c0869..fb5d010 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -94,7 +94,7 @@ var tablib = { // eslint-disable-line
var isBlankTab = gBrowser.isBlankNotBusyTab(tab);
var isLockedTab = tab.hasAttribute("locked");
if (!allowLoad && !isBlankTab && isLockedTab) {
- let isFlaged = flag => !!(flags & Ci.nsIWebNavigation[flag]);
+ let isFlaged = flag => Boolean(flags & Ci.nsIWebNavigation[flag]);
params.inBackground = false;
params.allowThirdPartyFixup = isFlaged("LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP");
params.fromExternal = isFlaged("LOAD_FLAGS_FROM_EXTERNAL");
@@ -1892,7 +1892,7 @@ var tablib = { // eslint-disable-line
var startTime = new Date().valueOf();
var oldTime = Services.prefs.prefHasUserValue(pref) ? Services.prefs.getCharPref(pref) : 0;
canClose = gBrowser.warnAboutClosingTabs(gBrowser.closingTabsEnum.ALL_ONEXIT);
- Services.prefs.setCharPref(pref, oldTime * 1 + (new Date().valueOf() - startTime));
+ Services.prefs.setCharPref(pref, Number(oldTime) + (new Date().valueOf() - startTime));
}
TabmixSessionManager.windowIsClosing(canClose, isLastWindow, result.saveSession, result.removeClosedTabs);
diff --git a/chrome/content/preferences/session.js b/chrome/content/preferences/session.js
index d14ca62..a493ae3 100644
--- a/chrome/content/preferences/session.js
+++ b/chrome/content/preferences/session.js
@@ -7,7 +7,7 @@ var gSessionPane = {
if (TabmixSvc.isLinux)
$("sessionManager-panels").setAttribute("linux", "true");
- this.setVisiblecontent(!!this.sessionManagerAddon, true);
+ this.setVisiblecontent(Boolean(this.sessionManagerAddon), true);
gPrefWindow.setDisabled("obs_ss_postdata", $("pref_ss_postdata").value == 2);
this.isSessionStoreEnabled(true);
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index a3c23a9..cbf76fa 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -345,7 +345,7 @@ TabmixSessionManager = {
obs.addObserver(this, "browser:purge-session-history", true);
if (Tabmix.isVersion(270)) {
if (!isFirstWindow && this.enableBackup && this.canRestoreLastSession)
- window.__SS_lastSessionWindowID = "" + Date.now() + Math.random();
+ window.__SS_lastSessionWindowID = String(Date.now()) + Math.random();
obs.addObserver(this, "sessionstore-last-session-cleared", true);
}
@@ -2537,9 +2537,9 @@ TabmixSessionManager = {
if (aPopUp || this.isPrivateWindow)
curTime = this.getLiteralValue(thisSession, "timestamp", 0);
else {
- var pref = "warnAboutClosingTabs.timeout";
- var delay = Tabmix.prefs.prefHasUserValue(pref) ? Tabmix.prefs.getCharPref(pref) * 1 : 0;
- curTime = new Date().valueOf() - delay;
+ let pref = "warnAboutClosingTabs.timeout";
+ let delay = Tabmix.prefs.prefHasUserValue(pref) ? Tabmix.prefs.getCharPref(pref) : 0;
+ curTime = new Date().valueOf() - Number(delay);
}
var windowEnum = container.GetElements();
while (windowEnum.hasMoreElements()) {
@@ -2651,9 +2651,9 @@ TabmixSessionManager = {
}
this.setLiteral(rdfNodeThisWindow, "name", encodeURI(label));
this.setLiteral(rdfNodeThisWindow, "nameExt", this.getNameData(-1, savedTabs));
- var pref = "warnAboutClosingTabs.timeout";
- var delay = Tabmix.prefs.prefHasUserValue(pref) ? Tabmix.prefs.getCharPref(pref) * 1 : 0;
- var newTime = new Date().valueOf() - delay;
+ let pref = "warnAboutClosingTabs.timeout";
+ let delay = Tabmix.prefs.prefHasUserValue(pref) ? Tabmix.prefs.getCharPref(pref) : 0;
+ let newTime = new Date().valueOf() - Number(delay);
this.setLiteral(rdfNodeThisWindow, "timestamp", newTime);
// if we overwrite window we don't load it again on restart
if (this.overwriteWindow || overwriteWindow)
@@ -3002,7 +3002,7 @@ TabmixSessionManager = {
// add __SS_lastSessionWindowID to force SessionStore.restoreLastSession
// to open new window
if (restoring)
- window.__SS_lastSessionWindowID = "" + Date.now() + Math.random();
+ window.__SS_lastSessionWindowID = String(Date.now()) + Math.random();
if (Tabmix.isVersion(270)) {
TabmixSvc.SessionStoreGlobal.LastSession.setState(state);
} else {
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 54d9a25..40e9c85 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1837,7 +1837,7 @@ gTMPprefObserver = {
' height: #px;}'.replace("#", Tabmix._buttonsHeight);
this.insertRule(newRule, "scrollbutton-height");
- let _buttonsHeight = Tabmix._buttonsHeight - 1 * (Tabmix.isVersion(310) && !Tabmix.isVersion(420));
+ let _buttonsHeight = Tabmix._buttonsHeight - Number(Tabmix.isVersion(310) && !Tabmix.isVersion(420));
newRule = '#TabsToolbar[multibar] > .toolbarbutton-1 {' +
' height: #px;}'.replace("#", _buttonsHeight);
this.insertRule(newRule, "toolbarbutton-height");
@@ -2168,9 +2168,8 @@ gTMPprefObserver = {
setShowNewTabButtonAttr: function(aShow, aPosition) {
// check new tab button visibility when we are in multi-row and the
// preference is to show new-tab-button after last tab
- Tabmix.tabsUtils.checkNewtabButtonVisibility =
- TabmixTabbar.isMultiRow && ((aShow && aPosition == 2) ||
- !!TabmixTabbar.newPrivateTabButton());
+ Tabmix.tabsUtils.checkNewtabButtonVisibility = TabmixTabbar.isMultiRow &&
+ ((aShow && aPosition == 2) || Boolean(TabmixTabbar.newPrivateTabButton()));
/** values for tabmix-show-newtabbutton to show tabs-newtab-button are:
* aftertabs - show the button after tabs
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 927ba1b..03cbfb3 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -165,7 +165,7 @@ Tabmix.afterDelayedStartup = function() {
// when we open bookmark in new window
// get bookmark itemId and url - for use in getBookmarkTitle
if ("bookMarkIds" in window) {
- let items = (window.bookMarkIds + "").split("|");
+ let items = String(window.bookMarkIds).split("|");
for (let i = 0; i < items.length; i++) {
if (items[i] && items[i] > -1)
gBrowser.tabs[i].setAttribute("tabmix_bookmarkId", items[i]);
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index c0113b1..df2556b 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -978,7 +978,7 @@ ContentClickInternal = {
};
let windows = [];
- if (!!window.gBrowser && isValidWindow(window))
+ if (window.gBrowser && isValidWindow(window))
windows.push(window);
let winEnum = Services.wm.getEnumerator("navigator:browser");
diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index d5e966d..a8880db 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -416,7 +416,8 @@ function getRGBcolor(aColorCode, aOpacity) {
if (newRGB.length < 3)
return null;
for (let i = 0; i < newRGB.length; i++) {
- if (isNaN(newRGB[i].replace(/[\s]/g, "") * 1))
+ let val = Number(newRGB[i].replace(/[\s]/g, ""));
+ if (isNaN(val))
return null;
}
} else if (/^#/.test(aColorCode) && _length == 4 || _length == 7) {
diff --git a/modules/LinkNodeUtils.jsm b/modules/LinkNodeUtils.jsm
index fa6c453..81292c3 100644
--- a/modules/LinkNodeUtils.jsm
+++ b/modules/LinkNodeUtils.jsm
@@ -41,7 +41,7 @@ this.LinkNodeUtils = {
URL: doc.URL,
documentURI: doc.documentURI,
defaultView: {
- frameElement: !!doc.defaultView.frameElement
+ frameElement: Boolean(doc.defaultView.frameElement)
},
location: {
href: doc.location ? doc.location.href : ""
diff --git a/modules/extensions/CompatibilityCheck.jsm b/modules/extensions/CompatibilityCheck.jsm
index ab92a39..8a8e357 100644
--- a/modules/extensions/CompatibilityCheck.jsm
+++ b/modules/extensions/CompatibilityCheck.jsm
@@ -53,7 +53,7 @@ CompatibilityCheck.prototype = {
getIncompatibleList: function TMP_EX_getIncompatibleList() {
function isPending(aAddon, aAction) {
var action = AddonManager["PENDING_" + aAction.toUpperCase()];
- return !!(aAddon.pendingOperations & action);
+ return Boolean(aAddon.pendingOperations & action);
}
function AddOn(addon) {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list