[Pkg-mozext-commits] [tabmixplus] 31/51: Linting null check, Use '===' to compare with 'null' and 'undefined'
David Prévot
taffit at moszumanska.debian.org
Mon Feb 2 18:36:51 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository tabmixplus.
commit c6df1077c6dce8373efde2ec832ed638aaec95c4
Author: onemen <tabmix.onemen at gmail.com>
Date: Tue Jan 6 22:52:31 2015 +0200
Linting null check, Use '===' to compare with 'null' and 'undefined'
---
chrome/content/changecode.js | 2 +-
chrome/content/session/session.js | 11 ++++++-----
chrome/content/utils.js | 2 +-
modules/AutoReload.jsm | 6 +++---
modules/ContentClick.jsm | 2 +-
modules/ContextMenu.jsm | 2 +-
modules/DynamicRules.jsm | 12 ++++++------
modules/Shortcuts.jsm | 2 +-
modules/log.jsm | 2 +-
9 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index 6960549..0313b59 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -121,7 +121,7 @@ Tabmix.changeCode = function(aParent, aName, aOptions) {
show: function(aObj, aName) {
if (aObj && aName in aObj)
console.show({obj: aObj, name: aName, fullName: this.fullName});
- else if (this.fullName != null) {
+ else if (typeof this.fullName == "string") {
let win = typeof window != "undefined" ? window : undefined;
console.show(this.fullName, 500, win);
}
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index 43c75aa..74e0626 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -474,7 +474,7 @@ var TabmixSessionManager = { // jshint ignore:line
return resultData;
// we set aPopUp only in canQuitApplication
- if (aPopUp == null)
+ if (aPopUp === undefined)
aPopUp = !window.toolbar.visible;
this.lastSaveTabsCount = this.saveOnWindowClose();
@@ -1755,7 +1755,8 @@ if (container == "error") { Tabmix.log("wrapContainer error path " + path + "\n"
// xxx need to check if we need all this functions
removeSession: function SM_removeSession(value, container) {
- if (value==null) return;
+ if (!value)
+ return;
var node = this.RDFService.GetResource(value);
var rdfNodeWindows = this.RDFService.GetResource(container);
var windowsContainer = this.initContainer(rdfNodeWindows);
@@ -2255,7 +2256,7 @@ if (container == "error") { Tabmix.log("wrapContainer error path " + path + "\n"
// get saved session list, we only need to get session path
var sessionList = this.getSessionList("onlyPath");
var askifempty = restoreFlag > 1 ? false : this.prefBranch.getBoolPref("onStart.askifempty");
- if (sessionList == null) {
+ if (sessionList === null) {
if (((askifempty && afterCrash) || restoreFlag == 1) && !this.corruptedFile) {
msg = TabmixSvc.getSMString("sm.start.msg0") + "\n" +
TabmixSvc.getSMString("sm.afterCrash.msg10");
@@ -2289,7 +2290,7 @@ if (container == "error") { Tabmix.log("wrapContainer error path " + path + "\n"
}
}
}
- if ((thisPath && this.containerEmpty(thisPath)) || sessionIndex == null) {
+ if ((thisPath && this.containerEmpty(thisPath)) || sessionIndex === null) {
// error in pref.js or in session.rdf ask the user what to do
loadSessionIsValid = false;
thisPath = this.gSessionPath[1]; // load last session
@@ -3082,7 +3083,7 @@ try{
case "firstwindowopen":
overwrite = false;
let hasFirstArgument = window.arguments && window.arguments[0];
- if (hasFirstArgument && this.overrideHomepage == null)
+ if (hasFirstArgument && this.overrideHomepage === null)
restoreSelect = false;
break;
case "windowopenedbytabmix":
diff --git a/chrome/content/utils.js b/chrome/content/utils.js
index f78d90d..0f1f145 100644
--- a/chrome/content/utils.js
+++ b/chrome/content/utils.js
@@ -31,7 +31,7 @@ var Tabmix = { // jshint ignore:line
setItem: function(aItemOrId, aAttr, aVal) {
var elem = typeof(aItemOrId) == "string" ? document.getElementById(aItemOrId) : aItemOrId;
if (elem) {
- if (aVal == null) {
+ if (aVal === null) {
elem.removeAttribute(aAttr);
return;
}
diff --git a/modules/AutoReload.jsm b/modules/AutoReload.jsm
index 7f9a0b5..342c7cc 100644
--- a/modules/AutoReload.jsm
+++ b/modules/AutoReload.jsm
@@ -50,7 +50,7 @@ let AutoReload = {
this.addClonePopup(aPopup, aTab);
aPopup._tab = aTab;
- if (aPopup._tab.autoReloadEnabled == null)
+ if (aPopup._tab.autoReloadEnabled === undefined)
this.initTab(aPopup._tab);
var enableItem = menuItems[2];
@@ -149,7 +149,7 @@ let AutoReload = {
var tabs = aTabBrowser.visibleTabs;
for(let i=0; i<tabs.length; i++) {
let tab = tabs[i];
- if (tab.autoReloadEnabled == null)
+ if (tab.autoReloadEnabled === undefined)
this.initTab(tab);
if (!tab.autoReloadEnabled || tab.autoReloadURI != tab.linkedBrowser.currentURI.spec)
@@ -250,7 +250,7 @@ let AutoReload = {
function _setItem () {}
function _reloadTab(aTab) {
- if (aTab == null || !aTab.parentNode)
+ if (!aTab || !aTab.parentNode)
return;
if (aTab.autoReloadEnabled === false ) {
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 05e7ce4..0ca480a 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -407,7 +407,7 @@ var ContentClickInternal = {
if (this.currentTabLocked || this.targetPref == 1) { // tab is locked
let openNewTab = this.openTabfromLink();
- if (openNewTab != null)
+ if (openNewTab !== null)
return [(openNewTab ? TMP_tabshifted(event) : "default") + "@16"];
}
return ["default at 17"];
diff --git a/modules/ContextMenu.jsm b/modules/ContextMenu.jsm
index a567e33..1ec8025 100644
--- a/modules/ContextMenu.jsm
+++ b/modules/ContextMenu.jsm
@@ -55,7 +55,7 @@ this.ContextMenu = {
Ci.nsIDOMNodeFilter.SHOW_ELEMENT, filter, true);
let nextEpisode = treeWalker.nextNode();
let urls = [];
- while (nextEpisode != null) {
+ while (nextEpisode !== null) {
let url;
if (nextEpisode.nodeName == "li") {
let node = nextEpisode.firstChild;
diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index 0c696c6..40f536b 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -285,7 +285,7 @@ this.DynamicRules = {
let prefString = Prefs.getCharPref(ruleName);
try {
currentPrefValues = TabmixSvc.JSON.parse(prefString);
- if (currentPrefValues == null)
+ if (currentPrefValues === null)
throw Error(ruleName + " value is invalid\n" + prefString);
}
catch (ex) {
@@ -313,13 +313,13 @@ this.DynamicRules = {
let opacityValue = opacity in currentPrefValues ? currentPrefValues[opacity] : null;
value = getRGBcolor(value, opacityValue);
}
- else if (value != null && typeof(value) != "boolean") {
+ else if (value !== undefined && typeof value != "boolean") {
if (/^true$|^false$/.test(value.replace(/[\s]/g,"")))
value = value == "true" ? true : false;
else
- value = null;
+ value = undefined;
}
- if (value == null)
+ if (value === undefined)
prefValues[item] = item == "bgTopColor" ? prefValues["bgColor"] :
defaultPrefValues[item];
else
@@ -363,9 +363,9 @@ function getRGBcolor(aColorCode, aOpacity) {
else
return null;
- if (aOpacity != null)
+ if (aOpacity !== null)
newRGB[3] = aOpacity;
- else if (newRGB[3] == null || newRGB[3] < 0 || newRGB[3] > 1)
+ else if (newRGB[3] === undefined || newRGB[3] < 0 || newRGB[3] > 1)
newRGB[3] = 1;
return "rgba(" + newRGB.join(",") + ")";
}
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index e38183f..0bcca48 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -295,7 +295,7 @@ this.Shortcuts = {
try {
shortcuts = JSON.parse(getPref("extensions.tabmix.shortcuts"));
} catch (ex) {}
- if (shortcuts == null) {
+ if (shortcuts === null) {
TabmixSvc.console.log("failed to read shortcuts preference.\nAll shortcuts was resets to default");
shortcuts = {};
updatePreference = true;
diff --git a/modules/log.jsm b/modules/log.jsm
index 533e8bb..17e6792 100644
--- a/modules/log.jsm
+++ b/modules/log.jsm
@@ -216,7 +216,7 @@ options = {
val = val.substr(0, val.indexOf("(")) + "() { " + code + " }";
}
objS += offset + prop + "[" + type + "]" + " = " + val + "\n";
- if (type == "object" && val != null && level && typeof level == "boolean")
+ if (type == "object" && val !== null && level && typeof level == "boolean")
objS += this.obj(val, "", true, "deep") + "\n";
} catch (ex) {
objS += offset + prop + " = " + "[!!error retrieving property]" + "\n";
--
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