[Pkg-mozext-commits] [tabmixplus] 10/10: Update .eslintrc for Eslint 2, fix some errors that reveals by the new eslint
David Prévot
taffit at moszumanska.debian.org
Tue Dec 29 19:03:20 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 0.4.2.1pre.151226a1
in repository tabmixplus.
commit 483ae658e42e6652ce9784e56f74af6f62d7c700
Author: onemen <tabmix.onemen at gmail.com>
Date: Sun Dec 13 20:51:15 2015 +0200
Update .eslintrc for Eslint 2, fix some errors that reveals by the new eslint
---
.eslintrc | 9 ++--
chrome/content/changecode.js | 18 ++++----
chrome/content/click/click.js | 13 +++---
chrome/content/extensions/extensions.js | 4 +-
chrome/content/flst/lasttab.js | 12 +++---
chrome/content/links/setup.js | 4 +-
chrome/content/minit/minit.js | 20 ++++-----
chrome/content/minit/tabView.js | 4 +-
chrome/content/minit/tablib.js | 20 ++++-----
chrome/content/places/places.js | 10 ++---
chrome/content/preferences/appearance.js | 4 +-
.../preferences/overlay/preferencesOverlay.js | 4 +-
chrome/content/preferences/preferences.js | 13 +++---
chrome/content/session/promptservice.js | 9 ++--
chrome/content/session/session.js | 41 +++++++++---------
chrome/content/session/sessionStore.js | 8 ++--
chrome/content/tab/tab.js | 45 ++++++++++----------
chrome/content/tabmix.js | 48 +++++++++++-----------
chrome/content/utils.js | 4 +-
modules/AutoReload.jsm | 4 +-
modules/ContentClick.jsm | 10 ++---
modules/ContextMenu.jsm | 4 +-
modules/DynamicRules.jsm | 4 +-
modules/MergeWindows.jsm | 4 +-
modules/Shortcuts.jsm | 12 +++---
modules/SingleWindowModeUtils.jsm | 4 +-
modules/Utils.jsm | 1 +
modules/log.jsm | 6 +--
28 files changed, 172 insertions(+), 167 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index 7abdc6f..34b604b 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -9,10 +9,9 @@
"jasmine": false
},
- "ecmaFeatures": {
- "blockBindings": true,
- "forOf": true,
- "jsx": true
+ // for eslint 2.0.0
+ "parserOptions": {
+ "ecmaVersion": 6
},
"rules": {
@@ -47,6 +46,8 @@
"prefer-reflect": 0, // NOT YET
// disallow generator functions that do not have yield
"require-yield": 2,
+ // Enforce spacing around the * in yield* expressions
+ "yield-star-spacing": [2, "after"],
"no-alert": 2,
"no-array-constructor": 2,
diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index cce71b9..e67b9d9 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -21,11 +21,11 @@ Tabmix.changeCode = function(aParent, aName, aOptions) {
if (options && (options.setter || options.getter)) {
this.type = options.setter ? "__lookupSetter__" : "__lookupGetter__";
this.value = this.obj[this.type](this.fnName).toString();
- }
- else if (typeof this.obj[this.fnName] == "function")
+ } else if (typeof this.obj[this.fnName] == "function") {
this.value = this.obj[this.fnName].toString();
- else
+ } else {
this.errMsg = "\n" + this.fullName + " is undefined.";
+ }
this.notFound = [];
}
@@ -52,9 +52,9 @@ Tabmix.changeCode = function(aParent, aName, aOptions) {
if (exist) {
this.value = this.value.replace(substr, newString);
this.needUpdate = true;
- }
- else if (!silent)
+ } else if (!silent) {
this.notFound.push(substr);
+ }
return this;
},
@@ -136,9 +136,9 @@ Tabmix.changeCode = function(aParent, aName, aOptions) {
"\nReport about this to Tabmix developer at http://tmp.garyr.net/forum/");
if (debugMode)
console.clog(caller + "\nfunction " + aName + " = " + this.value);
- }
- else if (!this.needUpdate && debugMode)
+ } else if (!this.needUpdate && debugMode) {
console.clog(caller + " no update needed to " + aName);
+ }
return false;
}
};
@@ -159,9 +159,9 @@ Tabmix.setNewFunction = function(aObj, aName, aCode) {
if (!Object.getOwnPropertyDescriptor(aObj, aName)) {
Object.defineProperty(aObj, aName, {value: aCode,
writable: true, configurable: true});
- }
- else
+ } else {
aObj[aName] = aCode;
+ }
};
Tabmix.nonStrictMode = function(aObj, aFn, aArg) {
diff --git a/chrome/content/click/click.js b/chrome/content/click/click.js
index 8e7cc47..1ce811d 100644
--- a/chrome/content/click/click.js
+++ b/chrome/content/click/click.js
@@ -20,7 +20,7 @@ var TabmixTabClickOptions = {
if (this._tabFlipTimeOut)
this.clearTabFlipTimeOut();
if (this._blockDblClick) {
- setTimeout(() => this._blockDblClick = false, 0);
+ setTimeout(() => (this._blockDblClick = false), 0);
}
return; // double click (with left button)
}
@@ -374,9 +374,9 @@ var TabmixContext = {
if (show) {
this._originalTabbarContextMenu = tabBar.getAttribute("context");
tabBar.setAttribute("context", gBrowser.tabContextMenu.id);
- }
- else
+ } else {
Tabmix.setItem(tabBar, "context", this._originalTabbarContextMenu || null);
+ }
},
toggleEventListener: function(enable) {
@@ -584,9 +584,9 @@ var TabmixContext = {
mi.hidden = false;
lastVisible.hidden = true;
lastVisible = mi;
- }
- else
+ } else {
mi.hidden = true;
+ }
}
} else if (!mi.hidden && !mi.collapsed) {
hideNextSeparator = false;
@@ -875,8 +875,9 @@ var TabmixAllTabs = {
let item = popup.parentNode.parentNode;
if (item.parentNode.id == "btn_tabslist")
this.createTabsList(item, aType);
+ } else {
+ popup.hidePopup();
}
- else popup.hidePopup();
}
},
diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index 8d8b5cc..347754c 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -542,9 +542,9 @@ TMP_extensionsCompatibility.wizzrss = {
if (openNewTab) {
var theBGPref = !readPref("WizzRSSFocusTab", false, 2);
tabBrowser.loadOneTab(uri, {inBackground: theBGPref});
- }
- else
+ } else {
tabBrowser.loadURI(uri);
+ }
}
};
diff --git a/chrome/content/flst/lasttab.js b/chrome/content/flst/lasttab.js
index 1039a42..96edb69 100644
--- a/chrome/content/flst/lasttab.js
+++ b/chrome/content/flst/lasttab.js
@@ -216,18 +216,18 @@ var TMP_LastTab = {
if (!this.TabListLock)
this.DisplayTabList();
}, 200);
- }
- else
+ } else {
this.DisplayTabList();
+ }
}
} else {
let item = this.tabs[this.TabIndex].mCorrespondingMenuitem;
item.setAttribute("_moz-menuactive", "true");
TabmixAllTabs.updateMenuItemActive(null, item);
}
- }
- else
+ } else {
TabmixAllTabs._tabSelectedFromList(this.tabs[this.TabIndex]);
+ }
event.stopPropagation();
event.preventDefault();
} else if (this.TabListLock && this.CtrlKey &&
@@ -349,9 +349,9 @@ var TMP_LastTab = {
for (var i = 0; i < this.TabHistory.length; i++) {
ctrlTab._recentlyUsedTabs.unshift(this.TabHistory[i]);
}
- }
- else
+ } else {
ctrlTab.uninit();
+ }
}
}
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index f7ffc62..193119d 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -207,9 +207,9 @@ Tabmix.beforeBrowserInitOnLoad = function() {
insertionPoint = "PlacesToolbarHelper.init();";
if (!this.isVersion(270))
ssPromise = 'typeof ssPromise == "object" ? ssPromise : null';
- }
- else
+ } else {
insertionPoint = 'Services.obs.addObserver';
+ }
this.changeCode(gBrowserInit, fn)._replace(
'Services.obs.addObserver', loadOnStartup, {check: this.isVersion(190) && !!loadOnStartup}
diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index 0f216b0..fb35f3b 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -567,9 +567,9 @@ var TMP_tabDNDObserver = {
statusTextFld.label = "";
this.gBackupLabel = "";
this.statusFieldChanged = null;
- }
- else if (!statusTextFld)
+ } else if (!statusTextFld) {
document.getElementById("tabmix-tooltip").hidePopup();
+ }
},
// get _tPos from group index
@@ -608,11 +608,11 @@ var TMP_tabDNDObserver = {
if (mY >= tab.boxObject.screenY + tab.boxObject.height) {
while (i < numTabs - 1 && getTabRowNumber(tabs[i + 1], topY) == thisRow)
i++;
- }
- else if (Tabmix.compare(mX, Tabmix.itemEnd(tab, Tabmix.ltr), Tabmix.ltr))
+ } else if (Tabmix.compare(mX, Tabmix.itemEnd(tab, Tabmix.ltr), Tabmix.ltr)) {
return i;
- else if (i == numTabs - 1 || getTabRowNumber(tabs[i + 1], topY) != thisRow)
+ } else if (i == numTabs - 1 || getTabRowNumber(tabs[i + 1], topY) != thisRow) {
return i;
+ }
}
}
return numTabs;
@@ -741,9 +741,9 @@ var TMP_tabDNDObserver = {
this.removetDragmarkAttribute(gBrowser.tabs[index]);
if (index !== 0 && gBrowser.tabs[index - 1].hasAttribute("dragmark"))
this.removetDragmarkAttribute(gBrowser.tabs[index - 1]);
- }
- else
+ } else {
this.setFirefoxDropIndicator(false);
+ }
this.dragmarkindex = null;
},
@@ -1108,11 +1108,11 @@ Tabmix.navToolbox = {
'O.handleSearchQuery',
'window.Omnibar.handleSearchQuery', {silent: true}
).toCode();
- }
- else if ("urlDot" in window && "handleCommand2" in gURLBar)
+ } else if ("urlDot" in window && "handleCommand2" in gURLBar) {
fn = "handleCommand2";
- else
+ } else {
fn = "handleCommand";
+ }
// Fix incompatibility with https://addons.mozilla.org/en-US/firefox/addon/url-fixer/
if ("urlfixerOldHandler" in gURLBar.handleCommand) {
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index 3b713a2..4a053e4 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -347,9 +347,9 @@
if (parsedData.groupID != activeGroupId)
tabdata.hidden = true;
}
- }
- else if (tabdata.extData)
+ } else if (tabdata.extData) {
delete tabdata.extData["tabview-tab"];
+ }
};
TabmixSessionManager.isEmptyObject = function SM_isEmptyObject(obj) {
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 6d9882d..d72f883 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -60,9 +60,9 @@ var tablib = { // eslint-disable-line
charset: arguments[4] || null,
postdata: arguments[5] || null,
};
- }
- else
+ } else {
flags = params.flags;
+ }
var tab = gBrowser.getTabForBrowser(browser);
if (!tab) {
@@ -955,9 +955,9 @@ var tablib = { // eslint-disable-line
if (!aHref && !aTabData) {
newTab = TabmixSvc.ss.duplicateTab(window, aTab, 0);
- }
- else
+ } else {
newTab = this.SSS_duplicateTab(aTab, aHref, aTabData);
+ }
if (!newTab && aTabData)
throw new Error("Tabmix was unable to restore closed tab to new window");
@@ -1805,9 +1805,9 @@ var tablib = { // eslint-disable-line
aTab.removeAttribute("width");
if (width != aTab.boxObject.width)
TMP_Places.afterTabTitleChanged(false);
- }
- else if (aTab.hasAttribute("fadein"))
+ } else if (aTab.hasAttribute("fadein")) {
TMP_Places.afterTabTitleChanged(false);
+ }
// don't keep unnecessary reference to current tab
if (!TMP_Places.inUpdateBatch)
TMP_Places.currentTab = null;
@@ -1869,9 +1869,9 @@ var tablib = { // eslint-disable-line
returnVal.value = TabmixSessionManager.savedPrefs[aPrefName];
returnVal.newValue = Services.prefs[type == "int" ? "getIntPref" : "getBoolPref"](aPrefName);
delete TabmixSessionManager.savedPrefs[aPrefName];
- }
- else
+ } else {
returnVal.value = Services.prefs[type == "int" ? "getIntPref" : "getBoolPref"](aPrefName);
+ }
return returnVal;
}
@@ -1898,9 +1898,9 @@ var tablib = { // eslint-disable-line
let nonPrivateWindow = Tabmix.RecentWindow.getMostRecentBrowserWindow({private: false});
if (!nonPrivateWindow)
return false;
- }
- else if (TabmixSessionManager.globalPrivateBrowsing)
+ } else if (TabmixSessionManager.globalPrivateBrowsing) {
return false;
+ }
// last windows with tabs
var windowtype = aCountOnlyBrowserWindows ? "navigator:browser" : null;
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index ff54930..aea5234 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -49,7 +49,7 @@ var TMP_Places = {
return Tabmix.originalFunctions.placesBookmarkPage.apply(this, arguments);
} finally {
if (origTitle) {
- setTimeout(() => aBrowser._contentTitle = origTitle, 100);
+ setTimeout(() => (aBrowser._contentTitle = origTitle), 100);
}
}
};
@@ -252,9 +252,9 @@ var TMP_Places = {
aTab.removeAttribute("tabmix_selectedID");
} else
aTab.setAttribute("reloadcurrent", true);
- }
- else
+ } else {
aTab = gBrowser.addTab(url, {skipAnimation: multiple, dontMove: true});
+ }
this.setTabTitle(aTab, url, bmIds[i]);
} catch (er) { }
@@ -438,9 +438,9 @@ var TMP_Places = {
this._batchData.add.ids.push(aItemId);
this._batchData.add.urls.push(aUrl);
return;
- }
- else if (!Array.isArray(aItemId))
+ } else if (!Array.isArray(aItemId)) {
[aItemId, aUrl] = [[aItemId], [aUrl]];
+ }
let getIndex = url => aUrl.indexOf(url) + 1;
for (let tab of gBrowser.tabs) {
diff --git a/chrome/content/preferences/appearance.js b/chrome/content/preferences/appearance.js
index 84aceb6..3d9e2e5 100644
--- a/chrome/content/preferences/appearance.js
+++ b/chrome/content/preferences/appearance.js
@@ -80,9 +80,9 @@ var gAppearancePane = { // jshint ignore:line
tabCbUI.value = 1;
Tabmix.setItem("tabXwidthBox", "hidden", true);
}
- }
- else
+ } else {
$("alltabsItem").disabled = false;
+ }
},
tabsScrollChanged: function() {
diff --git a/chrome/content/preferences/overlay/preferencesOverlay.js b/chrome/content/preferences/overlay/preferencesOverlay.js
index 5711e14..5115e91 100644
--- a/chrome/content/preferences/overlay/preferencesOverlay.js
+++ b/chrome/content/preferences/overlay/preferencesOverlay.js
@@ -71,9 +71,9 @@ var gTabMix_preferencesOverlay = { // jshint ignore:line
let title = TabmixSvc.getString("tabmixoption.error.title");
let msg = TabmixSvc.getString("tabmixoption.error.msg");
Services.prompt.alert(window, title, msg);
- }
- else
+ } else {
browserWindow.Tabmix.openOptionsDialog(panel);
+ }
},
/* ........ paneMain .............. */
diff --git a/chrome/content/preferences/preferences.js b/chrome/content/preferences/preferences.js
index 35e5ed0..1864bf8 100644
--- a/chrome/content/preferences/preferences.js
+++ b/chrome/content/preferences/preferences.js
@@ -230,9 +230,9 @@ var gPrefWindow = { // jshint ignore:line
if (val !== null)
tabs.selectedIndex = val;
}
- }
- else if (preference.value != tabs.selectedIndex)
+ } else if (preference.value != tabs.selectedIndex) {
preference.valueFromPreferences = tabs.selectedIndex;
+ }
},
afterShortcutsChanged: function() {
@@ -290,9 +290,9 @@ function setPref(aPref) {
let str = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
str.data = aPref.value;
Services.prefs.setComplexValue(aPref.name, Ci.nsISupportsString, str);
- }
- else
+ } else {
Services.prefs["set" + fn](aPref.name, aPref.value);
+ }
}
function setPrefAfterImport(aPref) {
@@ -424,7 +424,7 @@ function exportData() {
return "\n" + pref + "=" + getPrefByType(pref);
});
patterns.unshift("tabmixplus");
- return OS.File.writeAtomic(file.path, patterns.join(""), {
+ OS.File.writeAtomic(file.path, patterns.join(""), {
encoding: "utf-8", tmpPath: file.path + ".tmp"
});
}
@@ -464,8 +464,7 @@ function showFilePicker(mode) {
fp.init(window, null, mode);
fp.appendFilters(nsIFilePicker.filterText);
return AsyncUtils.spawnFn(fp, fp.open).then(aResult => {
- if (aResult != nsIFilePicker.returnCancel)
- return fp.file;
+ return aResult != nsIFilePicker.returnCancel ? fp.file : null;
});
}
diff --git a/chrome/content/session/promptservice.js b/chrome/content/session/promptservice.js
index 99498ce..e47ed0c 100644
--- a/chrome/content/session/promptservice.js
+++ b/chrome/content/session/promptservice.js
@@ -80,8 +80,9 @@ function prompt_init() {
gSavedName = dialogParams.GetString(2).split("\n");
textBox.value = gSavedName.shift();
gOrigName = textBox.value.toLowerCase();
+ } else {
+ textBox.hidden = true;
}
- else textBox.hidden = true;
// display the checkbox
var checkBox = document.getElementById("tm_checkbox");
@@ -99,8 +100,9 @@ function prompt_init() {
aButtons = document.documentElement.getButton(buttons[i]);
if (i < btnLabels.length && btnLabels[i] !== "") {
setLabelForNode(aButtons, btnLabels[i]);
+ } else {
+ aButtons.hidden = true; // hide extra button
}
- else aButtons.hidden = true; // hide extra button
}
// Set and focus default button
@@ -132,8 +134,9 @@ function prompt_deinit(button) {
///XXX item.fileName - in the new Tabmix.Sessions
dialogParams.SetString(5, item.session || item.fileName);
dialogParams.SetInt(6, item.getAttribute("value"));
+ } else {
+ dialogParams.SetString(5, document.getElementById("tm_textbox").value);
}
- else dialogParams.SetString(5, document.getElementById("tm_textbox").value);
}
// if we are not a modal use a callback function
if (typeof window._callBackFunction == "function") {
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index ee08ebb..ee2d3fd 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -274,9 +274,9 @@ var TabmixSessionManager = { // jshint ignore:line
Tabmix.ssPromise.then(() => TMP_TabView.init())
.then(initializeSM)
.then(null, Tabmix.reportError);
- }
- else
+ } else {
initializeSM();
+ }
},
_init: function SM__init() {
@@ -583,9 +583,9 @@ var TabmixSessionManager = { // jshint ignore:line
// delete closed tab list for this session
if (aRemoveClosedTabs)
this.deleteAllClosedtabs(sessionContainer);
- }
- else // delete ALL closed window list.
+ } else { // delete ALL closed window list.
this.deleteSubtree(this.gSessionPath[0]);
+ }
}
// clean-up....
if (this.enableBackup)
@@ -802,9 +802,10 @@ var TabmixSessionManager = { // jshint ignore:line
} else if (gBrowser.mCurrentTab.loadOnStartup) {
for (var i = 0; i < gBrowser.tabs.length; i++)
delete gBrowser.tabs[i].loadOnStartup;
- }
- else if (window.toolbar.visible && gBrowser.isBlankNotBusyTab(gBrowser.mCurrentTab))
+ } else if (window.toolbar.visible &&
+ gBrowser.isBlankNotBusyTab(gBrowser.mCurrentTab)) {
focusAndSelectUrlBar();
+ }
},
// init common services
@@ -1260,9 +1261,9 @@ var TabmixSessionManager = { // jshint ignore:line
if (aIndex < 0) {
while (TabmixSvc.ss.getClosedWindowCount() > 0)
TabmixSvc.ss.forgetClosedWindow(0);
- }
- else
+ } else {
TabmixSvc.ss.forgetClosedWindow(aIndex);
+ }
this.notifyClosedWindowsChanged();
},
@@ -1894,11 +1895,11 @@ var TabmixSessionManager = { // jshint ignore:line
if (sessionmanagerMenu) {
parentID = "sessionmanagerMenu";
menuCommand = "loadSession";
- }
- else if (popup.parentNode.getAttribute("anonid") == "delete")
+ } else if (popup.parentNode.getAttribute("anonid") == "delete") {
parentID = "tm_prompt";
- else if (contents != Tabmix.SHOW_CLOSED_WINDOW_LIST)
+ } else if (contents != Tabmix.SHOW_CLOSED_WINDOW_LIST) {
parentID = popup.parentNode.id;
+ }
var onClosedWindowsList = parentId.startsWith("tm-sm-closedwindows") || parentId == "btn_closedwindows";
if (onClosedWindowsList)
menuCommand = "openclosedwindow";
@@ -2087,13 +2088,15 @@ var TabmixSessionManager = { // jshint ignore:line
this.deleteArrayNodes(sessionContainer, nodeToDelete, false);
let count = this.countWinsAndTabs(crashedContainer);
this.setLiteral(this.gSessionPath[3], "nameExt", this.getNameData(count.win, count.tab));
- } // if firefox was crashed in middle of crash Recovery try again to restore the same data
- else if (!this.containerEmpty(this.gSessionPath[0]))
+ } else if (!this.containerEmpty(this.gSessionPath[0])) {
+ // if firefox was crashed in middle of crash Recovery try again to
+ // restore the same data
this.deleteWithProp(sessionContainer);
- }
- else if (!this.containerEmpty(this.gSessionPath[0]))
+ }
+ } else if (!this.containerEmpty(this.gSessionPath[0])) {
// crash recovery is off, delete any remains from the crashed session
this.deleteWithProp(sessionContainer);
+ }
},
openAfterCrash: function SM_openAfterCrash(status) {
@@ -2642,9 +2645,9 @@ var TabmixSessionManager = { // jshint ignore:line
this.setLiteral(rdfNodeThisWindow, "status", "saved");
this.updateClosedWindowsMenu(false);
}
- }
- else
+ } else {
this.setLiteral(rdfNodeThisWindow, "status", "");
+ }
this.saveStateDelayed();
return savedTabs;
}, // end of "saveOneWindow : function ()"
@@ -3300,10 +3303,10 @@ var TabmixSessionManager = { // jshint ignore:line
newPos--;
// move selected tab to place
gBrowser.moveTabTo(cTab, newPos + lastSelectedIndex);
- }
- else
+ } else {
this.updateSelected(newPos + lastSelectedIndex, caller == "firstwindowopen" ||
caller == "windowopenedbytabmix");
+ }
}
newIndex = newPos;
}
diff --git a/chrome/content/session/sessionStore.js b/chrome/content/session/sessionStore.js
index f9343ba..1ee0995 100644
--- a/chrome/content/session/sessionStore.js
+++ b/chrome/content/session/sessionStore.js
@@ -231,9 +231,9 @@ var TMP_SessionStore = { // jshint ignore:line
Services.prefs.setBoolPref("browser.sessionstore.resume_session_once", true);
}
afterSessionRestore = true;
- }
- else if (this.afterSwitchThemes)
+ } else if (this.afterSwitchThemes) {
afterSessionRestore = true;
+ }
if (typeof afterSessionRestore == "boolean")
Tabmix.isWindowAfterSessionRestore = afterSessionRestore;
@@ -458,9 +458,9 @@ var TMP_ClosedTabs = { // jshint ignore:line
if (deleteItem && TMP_ClosedTabs.count > 0) {
aEvent.stopPropagation();
TMP_ClosedTabs.populateUndoSubmenu(aEvent.originalTarget.parentNode);
- }
- else
+ } else {
closeMenus(aEvent.target);
+ }
},
addBookmarks: function ct_addBookmarks(index) {
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index 7990338..0a45748 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -115,9 +115,9 @@ var TabmixTabbar = {
// if we set orient to vertical before sessionStore finish
// sessionStore don't select the selected tab from last session.
setTimeout(() => Tabmix.tabsUtils.setTabStripOrient(), 0);
- }
- else
+ } else {
Tabmix.tabsUtils.setTabStripOrient();
+ }
}
Tabmix.setItem(tabBar, "widthFitTitle", this.widthFitTitle || null);
@@ -187,9 +187,9 @@ var TabmixTabbar = {
tabBar.mTabstrip._enterVerticalMode();
this.setFirstTabInRow();
}
- }
- else
+ } else {
Tabmix.tabsUtils.adjustNewtabButtonvisibility();
+ }
},
// in Firefox 4.0+ rowheight can change when TabsInTitlebar or TabsOnTop
@@ -257,12 +257,12 @@ var TabmixTabbar = {
// We can get here if we switch to diffrent tabs position while in multibar
let rowHeight = height / Tabmix.tabsUtils.lastTabRowNumber;
newHeight = rowHeight * aRows;
- }
- else
+ } else {
newHeight = height;
- }
- else
+ }
+ } else {
newHeight = this.getRowHeight(tabsPosition) * aRows;
+ }
// don't proceed, probably the tabbar is not visible
if (newHeight === 0) {
@@ -489,9 +489,9 @@ var TabmixTabbar = {
return lastTab.boxObject.height;
else
newRowHeight = lastTab.baseY - next.baseY;
- }
- else
+ } else {
newRowHeight = lastTab.baseY - firstTab.baseY;
+ }
this._rowHeight[tabsPosition] = newRowHeight;
return newRowHeight;
@@ -812,9 +812,9 @@ Tabmix.tabsUtils = {
this.adjustNewtabButtonTimeout = null;
}.bind(this), timeout);
}
- }
- else
+ } else {
this.adjustNewtabButtonvisibility();
+ }
}
this._inUpdateVerticalTabStrip = false;
@@ -864,9 +864,9 @@ Tabmix.tabsUtils = {
let buttonEnd = Tabmix.tabsNewtabButton.boxObject.screenX +
Tabmix.tabsNewtabButton.boxObject.width;
this.disAllowNewtabbutton = buttonEnd > tabstripEnd;
- }
- else
+ } else {
this.disAllowNewtabbutton = true;
+ }
return;
} else {
// button is NOT visible
@@ -1289,9 +1289,9 @@ var gTMPprefObserver = {
if (updatePinned) {
tab.removeAttribute("_lockedAppTabs");
tab.setAttribute("_locked", tab.hasAttribute("locked"));
- }
- else
+ } else {
tab.removeAttribute("_locked");
+ }
tab.linkedBrowser.tabmix_allowLoad = !tab.hasAttribute("locked");
TabmixSvc.saveTabAttributes(tab, "_locked", false);
}
@@ -1412,10 +1412,9 @@ var gTMPprefObserver = {
value = Services.prefs.getIntPref(prefName);
if (value < 1 || value > 5) {
Services.prefs.setIntPref(prefName, 1);
- }
- else if (value == 5 && TabmixTabbar.widthFitTitle)
+ } else if (value == 5 && TabmixTabbar.widthFitTitle) {
Services.prefs.setIntPref(prefName, 1);
- else {
+ } else {
gBrowser.tabContainer.mCloseButtons = Services.prefs.getIntPref(prefName);
gBrowser.tabContainer.adjustTabstrip();
}
@@ -1459,9 +1458,9 @@ var gTMPprefObserver = {
case "extensions.tabmix.undoClose":
if (!Tabmix.prefs.getBoolPref("undoClose")) {
Services.prefs.setIntPref("browser.sessionstore.max_tabs_undo", 0);
- }
- else if (Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo") === 0)
+ } else if (Services.prefs.getIntPref("browser.sessionstore.max_tabs_undo") === 0) {
Services.prefs.clearUserPref("browser.sessionstore.max_tabs_undo");
+ }
break;
case "browser.sessionstore.max_tabs_undo": {
// Firefox's sessionStore mainain the right amount
@@ -2022,9 +2021,9 @@ var gTMPprefObserver = {
if (val) {
Tabmix.setItem("menu_newRemoteWindow", "hidden", true);
Tabmix.setItem("menu_newNonRemoteWindow", "hidden", true);
- }
- else
+ } else {
gRemoteTabsUI.init();
+ }
Tabmix.setItem("Tools:RemoteWindow", "disabled", val);
Tabmix.setItem("Tools:NonRemoteWindow", "disabled", val);
}
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 64de9aa..fba2c77 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -28,10 +28,10 @@ Tabmix.startup = function TMP_startup() {
let originalCode = command.getAttribute("oncommand");
Tabmix.setItem(command, "oncommand", "if (Tabmix._openNewTab(true)) {" + originalCode + "}");
Tabmix.setItem(cmdNewWindow, "oncommand", "if (Tabmix._openNewTab(false)) {" + originalNewNavigator + "}");
- }
- else
+ } else {
Tabmix.setItem(cmdNewWindow, "oncommand", "if (Tabmix.singleWindowMode) BrowserOpenTab(); " +
"else {" + originalNewNavigator + "}");
+ }
TabmixContext.toggleEventListener(true);
@@ -97,10 +97,10 @@ Tabmix.sessionInitialized = function() {
'ss = TabmixSessionManager;\
$&'
).toCode();
- }
- // from Firefox 27 SessionStore notify sessionstore-last-session-cleared
- else if (!this.isVersion(270))
+ } else if (!this.isVersion(270)) {
+ // from Firefox 27 SessionStore notify sessionstore-last-session-cleared
SessionStore.canRestoreLastSession = false;
+ }
}
var tab = gBrowser.tabContainer.firstChild;
@@ -130,9 +130,9 @@ Tabmix.getButtonsHeight = function() {
this._buttonsHeight = Tabmix.visibleTabs.first.getBoundingClientRect().height;
if (stripIsHidden)
tabBar.visible = false;
- }
- else
+ } else {
this._buttonsHeight = 24;
+ }
return this._buttonsHeight;
};
@@ -205,9 +205,9 @@ Tabmix.delayedStartup = function TMP_delayedStartup() {
if (this.prefs.getBoolPref("tabbar.click_dragwindow")) {
if (!Tabmix.prefs.getBoolPref("tabbar.dblclick_changesize"))
TabmixTabClickOptions.toggleEventListener(true);
- }
- else
+ } else {
document.getElementById("TabsToolbar")._dragBindingAlive = false;
+ }
TMP_extensionsCompatibility.onDelayedStartup();
@@ -337,9 +337,9 @@ var TMP_eventListener = {
if (aType != "load") {
Tabmix.initialization.run("onContentLoaded");
Tabmix.initialization.run("beforeBrowserInitOnLoad");
- }
- else
+ } else {
Tabmix.initialization.run("onWindowOpen");
+ }
else if (aType != "load")
window.removeEventListener("load", this, false);
},
@@ -556,9 +556,9 @@ var TMP_eventListener = {
Services.prefs.getBoolPref("browser.tabs.autoHide") && TabmixTabbar.hideMode === 0) {
TabmixTabbar.hideMode = 1;
Tabmix.prefs.setIntPref("hideTabbar", TabmixTabbar.hideMode);
- }
- else
+ } else {
gTMPprefObserver.setAutoHidePref();
+ }
if (TabmixTabbar.hideMode == 2)
gBrowser.tabContainer.visible = false;
@@ -655,17 +655,17 @@ var TMP_eventListener = {
'$&' + $LF +
'TMP_eventListener.toggleTabbarVisibility(false, aAnimate);'
).toCode();
+ } else {
+ Tabmix.changeCode(FullScreen, "FullScreen.sample")._replace(
+ 'gNavToolbox.style.marginTop = "";',
+ 'TMP_eventListener._updateMarginBottom("");\
+ $&'
+ )._replace(
+ 'gNavToolbox.style.marginTop = (gNavToolbox.boxObject.height * pos * -1) + "px";',
+ '$&\
+ TMP_eventListener._updateMarginBottom(gNavToolbox.style.marginTop);'
+ ).toCode();
}
- else
- Tabmix.changeCode(FullScreen, "FullScreen.sample")._replace(
- 'gNavToolbox.style.marginTop = "";',
- 'TMP_eventListener._updateMarginBottom("");\
- $&'
- )._replace(
- 'gNavToolbox.style.marginTop = (gNavToolbox.boxObject.height * pos * -1) + "px";',
- '$&\
- TMP_eventListener._updateMarginBottom(gNavToolbox.style.marginTop);'
- ).toCode();
}
if (!document.mozFullScreen) {
fullScrToggler.hidden = false;
@@ -1186,7 +1186,7 @@ Tabmix.initialization = {
let result, currentPhase = this[aPhase].id;
let getObj = function(list) {
let obj = window;
- list.split(".").forEach(prop => obj = obj[prop]);
+ list.split(".").forEach(prop => (obj = obj[prop]));
return obj;
};
for (let key of Object.keys(this)) {
diff --git a/chrome/content/utils.js b/chrome/content/utils.js
index 3a288df..c901d2b 100644
--- a/chrome/content/utils.js
+++ b/chrome/content/utils.js
@@ -125,9 +125,9 @@ var Tabmix = { // jshint ignore:line
" from:\n" + "file: " + "chrome:" + path + "\nline: " + line +
"\n\nPlease inform Tabmix Plus developer" +
(extensionName ? (" and " + extensionName + "developer.") : "."));
- }
- else
+ } else {
this.clog(err.message + "\n\n" + stack);
+ }
},
promptService: function(intParam, strParam, aWindow, aCallBack) {
diff --git a/modules/AutoReload.jsm b/modules/AutoReload.jsm
index 224e265..79e7f16 100644
--- a/modules/AutoReload.jsm
+++ b/modules/AutoReload.jsm
@@ -248,9 +248,9 @@ this.AutoReload = {
aTab.autoReloadEnabled = true;
aTab.autoReloadTimerID = win.setTimeout(_reloadTab, aTab.autoReloadTime * 1000, aTab);
- }
- else if (aTab.autoReloadEnabled)
+ } else if (aTab.autoReloadEnabled) {
aTab.autoReloadEnabled = false;
+ }
_setItem(aTab, "_reload", aTab.autoReloadEnabled || null);
},
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 83c9fa8..a6637f2 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -929,8 +929,6 @@ var ContentClickInternal = {
else
// when the links target is in the same page don't open new tab
return !isSame(href, '#');
-
- return null;
},
/**
@@ -1024,9 +1022,9 @@ var ContentClickInternal = {
// Focus the matching window & tab
window.focus();
window.gBrowser.selectedTab = tab;
- }
- else
+ } else {
this.next(tab.nextSibling);
+ }
},
next: function(tab) {
if (!tab && this.windows.length) {
@@ -1043,9 +1041,9 @@ var ContentClickInternal = {
this.frameData.href, this.frameData.name);
this.result(browser, {result: result});
}
- }
- else
+ } else {
this.stop();
+ }
}
},
diff --git a/modules/ContextMenu.jsm b/modules/ContextMenu.jsm
index 9633509..a8c75cf 100644
--- a/modules/ContextMenu.jsm
+++ b/modules/ContextMenu.jsm
@@ -59,9 +59,9 @@ this.ContextMenu = {
if (nextEpisode.nodeName == "li") {
let node = nextEpisode.firstChild;
url = node.nodeName == "p" ? node.firstChild.href : node.href;
- }
- else
+ } else {
url = nextEpisode.href;
+ }
if (securityCheck(url)) {
if (check)
return [true];
diff --git a/modules/DynamicRules.jsm b/modules/DynamicRules.jsm
index c823145..b919bd1 100644
--- a/modules/DynamicRules.jsm
+++ b/modules/DynamicRules.jsm
@@ -431,9 +431,9 @@ function getRGBcolor(aColorCode, aOpacity) {
return null;
newRGB.push(newNumber);
}
- }
- else
+ } else {
return null;
+ }
if (aOpacity !== null)
newRGB[3] = aOpacity;
diff --git a/modules/MergeWindows.jsm b/modules/MergeWindows.jsm
index edf1b79..fccadae 100644
--- a/modules/MergeWindows.jsm
+++ b/modules/MergeWindows.jsm
@@ -68,9 +68,9 @@ this.MergeWindows = {
tab.removeAttribute("mergeselected");
tab.label = tab.label.substr(4);
tabbrowser._tabAttrModified(tab);
- }
- else if (canClose)
+ } else if (canClose) {
tabbrowser.removeTab(tab);
+ }
}
canClose = false;
}
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index dbdf618..f12f909 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -74,10 +74,10 @@ this.Shortcuts = {
let tmp = {};
Cu.import("resource://gre/modules/PrivateBrowsingUtils.jsm", tmp);
this.permanentPrivateBrowsing = tmp.PrivateBrowsingUtils.permanentPrivateBrowsing;
- }
- else
+ } else {
this.permanentPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService).autoStarted;
+ }
// update keys initial value and label
// get our key labels from shortcutsLabels.xml
@@ -430,9 +430,9 @@ this.Shortcuts = {
id = "key_reload#".replace("#", index++);
} while (aWindow.document.getElementById(id));
this.keys.browserReload.id = key.id = id;
- }
- else
+ } else {
key.id = this.keys.browserReload.id;
+ }
return true;
}, this);
}
@@ -570,9 +570,9 @@ function getFormattedKey(key) {
if (key.key) {
if (key.key == " ") {
key.key = ""; key.keycode = "VK_SPACE";
- }
- else
+ } else {
val += key.key.toUpperCase();
+ }
}
if (key.keycode) {
try {
diff --git a/modules/SingleWindowModeUtils.jsm b/modules/SingleWindowModeUtils.jsm
index ed51582..3a126f6 100644
--- a/modules/SingleWindowModeUtils.jsm
+++ b/modules/SingleWindowModeUtils.jsm
@@ -140,9 +140,9 @@ this.SingleWindowModeUtils = {
params.postData = args[3] || null;
params.allowThirdPartyFixup = args[4] || false;
urls = [uriToLoad];
- }
- else
+ } else {
urls = uriToLoad ? uriToLoad.split("|") : ["about:blank"];
+ }
var firstTabAdded;
try {
diff --git a/modules/Utils.jsm b/modules/Utils.jsm
index c7cb20f..92ce1f4 100644
--- a/modules/Utils.jsm
+++ b/modules/Utils.jsm
@@ -97,6 +97,7 @@ this.TabmixUtils = {
return false;
}
}
+ return null;
},
makeInputStream: function(aString) {
diff --git a/modules/log.jsm b/modules/log.jsm
index 3c902b9..aa6997f 100644
--- a/modules/log.jsm
+++ b/modules/log.jsm
@@ -36,7 +36,7 @@ this.console = {
obj = aWindow;
if (rootID)
obj = obj.document.getElementById(rootID);
- methodsList.forEach(aFn => obj = obj[aFn]);
+ methodsList.forEach(aFn => (obj = obj[aFn]));
} catch (ex) { }
return obj || {toString: () => "undefined"};
},
@@ -78,9 +78,9 @@ this.console = {
}, aDelay, Ci.nsITimer.TYPE_ONE_SHOT);
this._timers[timerID] = timer;
- }
- else
+ } else {
logMethod();
+ }
} catch (ex) {
this.assert(ex, "Error we can't show " + aMethod + " in Tabmix.show");
--
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