[Pkg-mozext-commits] [tabmixplus] 53/73: Fix Webstorm inspection errors - if statements which can be simplified to single assignment or return statements
David Prévot
taffit at moszumanska.debian.org
Mon May 9 02:30:55 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 68916d537930d43683621cae5b1b3bf6d7703802
Author: onemen <tabmix.onemen at gmail.com>
Date: Wed Apr 20 18:58:32 2016 +0300
Fix Webstorm inspection errors - if statements which can be simplified to single assignment or return statements
---
chrome/content/minit/tabView.js | 6 ++---
chrome/content/minit/tablib.js | 13 ++++-------
chrome/content/preferences/shortcuts.js | 4 +---
chrome/content/session/sessionStore.js | 4 +---
modules/ContentClick.jsm | 41 +++++++++------------------------
modules/Services.jsm | 5 +---
6 files changed, 20 insertions(+), 53 deletions(-)
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index afe7071..4475ffa 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -362,10 +362,8 @@
excludeTabs = [];
return !Array.prototype.some.call(gBrowser.tabs, function(tab) {
- if (!tab.pinned && !tab.hidden && !tab.closing && excludeTabs.indexOf(tab) == -1) {
- return true;
- }
- return false;
+ return !tab.pinned && !tab.hidden && !tab.closing &&
+ excludeTabs.indexOf(tab) == -1;
});
};
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 24a9e52..a5126f8 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -1102,10 +1102,8 @@ var tablib = { // eslint-disable-line
// valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
// Also disallow dropping javascript: or data: urls--bail out
let isValid = function(aUrl) {
- if (!aUrl || !aUrl.length || aUrl.indexOf(" ", 0) != -1 ||
- /^\s*(javascript|data):/.test(aUrl))
- return false;
- return true;
+ return aUrl && aUrl.length && aUrl.indexOf(" ") == -1 &&
+ !(/^\s*(javascript|data):/).test(aUrl);
};
let browser = gBrowser.selectedBrowser;
@@ -1956,9 +1954,6 @@ Tabmix.newTabUrls = [
];
Tabmix.getOpenTabNextPref = function TMP_getOpenTabNextPref(aRelatedToCurrent) {
- if (Tabmix.prefs.getBoolPref("openTabNext") &&
- (!Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent") || aRelatedToCurrent))
- return true;
-
- return false;
+ return Tabmix.prefs.getBoolPref("openTabNext") &&
+ (!Services.prefs.getBoolPref("browser.tabs.insertRelatedAfterCurrent") || aRelatedToCurrent);
};
diff --git a/chrome/content/preferences/shortcuts.js b/chrome/content/preferences/shortcuts.js
index 089d395..5c17181 100644
--- a/chrome/content/preferences/shortcuts.js
+++ b/chrome/content/preferences/shortcuts.js
@@ -31,9 +31,7 @@ function getKeysForShortcut(shortcut, id, win) {
key: key.getAttribute("key"),
keycode: key.getAttribute("keycode")
};
- if (getFormattedKey(_key) == shortcut)
- return true;
- return false;
+ return getFormattedKey(_key) == shortcut;
}).map(key => " " + _getKeyName(win, key).replace(dots, ""));
return usedKeys.join("\n");
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index f102ef0..0869bea 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -47,9 +47,7 @@ var TMP_SessionStore = {
let entries = tabData && tabData.entries;
if (entries && entries.length > 1)
return false;
- if (entries[0] && entries[0].url != "about:blank")
- return false;
- return true;
+ return !entries[0] || entries[0].url == "about:blank";
},
/**
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 40e6887..c4a09e8 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -640,11 +640,8 @@ ContentClickInternal = {
}
// don't interrupt with fastdial links
- if ("ownerDocument" in node &&
- this._window.Tabmix.isNewTabUrls(node.ownerDocument.documentURI))
- return true;
-
- return false;
+ return "ownerDocument" in node &&
+ this._window.Tabmix.isNewTabUrls(node.ownerDocument.documentURI);
},
/**
@@ -791,10 +788,7 @@ ContentClickInternal = {
return false;
let {event} = this._data;
- if (event.button == 1 || event.button === 0 && (event.ctrlKey || event.metaKey))
- return true;
-
- return false;
+ return event.button == 1 || event.button === 0 && (event.ctrlKey || event.metaKey);
},
/**
@@ -834,10 +828,7 @@ ContentClickInternal = {
this.targetPref == 2 && this._data.isLinkToExternalDomain)
return false;
- if (this.checkOnClick())
- return false;
-
- return true;
+ return !this.checkOnClick();
},
/**
@@ -868,12 +859,9 @@ ContentClickInternal = {
return false;
let {href, hrefFromOnClick, isLinkToExternalDomain, wrappedNode} = this._data;
- if (/^(http|about)/.test(hrefFromOnClick || href) &&
+ return /^(http|about)/.test(hrefFromOnClick || href) &&
(isLinkToExternalDomain || wrappedNode &&
- this.checkAttr(wrappedNode.getAttribute("onmousedown"), "return rwt")))
- return true;
-
- return false;
+ this.checkAttr(wrappedNode.getAttribute("onmousedown"), "return rwt"));
},
/**
@@ -953,11 +941,7 @@ ContentClickInternal = {
return true;
let _host = ["profiles.google.com", "accounts.google.com", "groups.google.com"];
- let testHost = _host.indexOf(node.host) > -1;
- if (testHost)
- return true;
-
- return false;
+ return _host.indexOf(node.host) > -1;
},
/**
@@ -973,13 +957,10 @@ ContentClickInternal = {
let isValidWindow = function(aWindow) {
// window is valid only if both source and destination are in the same
// privacy state and multiProcess state
- if (PrivateBrowsingUtils.isWindowPrivate(window) !=
- PrivateBrowsingUtils.isWindowPrivate(aWindow) ||
- TabmixSvc.version(320) &&
- window.gMultiProcessBrowser != aWindow.gMultiProcessBrowser) {
- return false;
- }
- return true;
+ return PrivateBrowsingUtils.isWindowPrivate(window) ==
+ PrivateBrowsingUtils.isWindowPrivate(aWindow) &&
+ (!TabmixSvc.version(320) ||
+ window.gMultiProcessBrowser == aWindow.gMultiProcessBrowser);
};
let windows = [];
diff --git a/modules/Services.jsm b/modules/Services.jsm
index 8997474..c6e07c6 100644
--- a/modules/Services.jsm
+++ b/modules/Services.jsm
@@ -264,10 +264,7 @@ XPCOMUtils.defineLazyGetter(TabmixSvc.JSON, "nsIJSON", function() {
// check if australis tab shape is implemented
XPCOMUtils.defineLazyGetter(TabmixSvc, "australis", function() {
- if (this.topWin().document.getElementById("tab-curve-clip-path-start")) {
- return true;
- }
- return false;
+ return Boolean(this.topWin().document.getElementById("tab-curve-clip-path-start"));
});
XPCOMUtils.defineLazyGetter(TabmixSvc, "prefs", function() {
--
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