[Pkg-mozext-commits] [tabmixplus] 02/107: Replace one line functions without curly brackets with arrow function. this style brake jscs
David Prévot
taffit at moszumanska.debian.org
Tue Dec 29 19:02:43 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 b3c8d33959a31bcec627f9b8901ddf5b9e0376de
Author: onemen <tabmix.onemen at gmail.com>
Date: Sat Aug 1 15:49:17 2015 +0300
Replace one line functions without curly brackets with arrow function. this style brake jscs
---
chrome/content/changecode.js | 8 ++++++--
chrome/content/click/click.js | 2 +-
chrome/content/extensions/extensions.js | 2 +-
chrome/content/links/setup.js | 16 +++++++++++----
chrome/content/minit/minit.js | 14 ++++++-------
chrome/content/minit/tabView.js | 2 +-
chrome/content/minit/tablib.js | 4 ++--
chrome/content/places/places.js | 4 ++--
chrome/content/preferences/menu.js | 2 +-
chrome/content/preferences/shortcuts.js | 18 +++++++++-------
chrome/content/preferences/shortcuts.xml | 14 ++++++-------
.../preferences/subdialogs/pref-appearance.js | 2 +-
.../preferences/subdialogs/pref-appearance.xml | 4 ++--
chrome/content/session/session.js | 7 +++----
chrome/content/tab/tab.js | 12 +++++------
chrome/content/tabmix.js | 3 ++-
modules/AutoReload.jsm | 8 ++++----
modules/ContentClick.jsm | 24 ++++++++++++++--------
modules/DocShellCapabilities.jsm | 5 +++--
modules/MergeWindows.jsm | 6 +++---
modules/Shortcuts.jsm | 9 ++++----
modules/Utils.jsm | 4 ++--
modules/log.jsm | 8 +++-----
23 files changed, 101 insertions(+), 77 deletions(-)
diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index f792a63..e1f616a 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -172,6 +172,10 @@ Tabmix.nonStrictMode = function(aObj, aFn, aArg) {
/* jshint moz: true, esnext: false */
let global = Components.utils.getGlobalForObject(obj);
let fn = global["ev" + "al"];
- Tabmix._makeCode = function(name, code) name ?
- fn(name + " = " + code) : fn("(" + code + ")");
+ Tabmix._makeCode = function(name, code) {
+ if (name) {
+ return fn(name + " = " + code);
+ }
+ return fn("(" + code + ")");
+ };
})(this);
diff --git a/chrome/content/click/click.js b/chrome/content/click/click.js
index 617a2e1..fb4eb83 100644
--- a/chrome/content/click/click.js
+++ b/chrome/content/click/click.js
@@ -312,7 +312,7 @@ var TabmixContext = {
_closeRightTabs: "tm-closeRightTabs",
// Create new items in the tab bar context menu
buildTabContextMenu: function TMP_buildTabContextMenu() {
- var $id = function(id) document.getElementById(id);
+ var $id = id => document.getElementById(id);
var tabContextMenu = $id("tabContextMenu");
tabContextMenu.insertBefore($id("context_reloadTab"), $id("tm-autoreloadTab_menu"));
diff --git a/chrome/content/extensions/extensions.js b/chrome/content/extensions/extensions.js
index 52df9e3..84794b8 100644
--- a/chrome/content/extensions/extensions.js
+++ b/chrome/content/extensions/extensions.js
@@ -449,7 +449,7 @@ var TMP_extensionsCompatibility = {
if (window.rdrb && typeof rdrb.cleanLink == "function") {
Tabmix.changeCode(TabmixContext, "TabmixContext.openMultipleLinks")._replace(
'Tabmix.loadTabs(urls, false);',
- 'urls = urls.map(function(url) rdrb.cleanLink(url));\n' +
+ 'urls = urls.map(url => rdrb.cleanLink(url));\n' +
' $&'
).toCode();
}
diff --git a/chrome/content/links/setup.js b/chrome/content/links/setup.js
index 8815e26..98ed431 100644
--- a/chrome/content/links/setup.js
+++ b/chrome/content/links/setup.js
@@ -59,7 +59,9 @@ Tabmix.beforeBrowserInitOnLoad = function() {
var SM = TabmixSessionManager;
if (this.isVersion(200)) {
SM.globalPrivateBrowsing = PrivateBrowsingUtils.permanentPrivateBrowsing;
- SM.isWindowPrivate = function SM_isWindowPrivate(aWindow) PrivateBrowsingUtils.isWindowPrivate(aWindow);
+ SM.isWindowPrivate = function(aWindow) {
+ return PrivateBrowsingUtils.isWindowPrivate(aWindow);
+ };
// isPrivateWindow is boolean property of this window, user can't change private status of a window
SM.isPrivateWindow = SM.isWindowPrivate(window);
SM.__defineGetter__("isPrivateSession", function() {
@@ -74,9 +76,15 @@ Tabmix.beforeBrowserInitOnLoad = function() {
let pbs = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
SM.globalPrivateBrowsing = pbs.privateBrowsingEnabled;
- SM.isWindowPrivate = function SM_isWindowPrivate() SM.globalPrivateBrowsing;
- SM.__defineGetter__("isPrivateWindow", function() this.globalPrivateBrowsing);
- SM.__defineGetter__("isPrivateSession", function() this.globalPrivateBrowsing);
+ SM.isWindowPrivate = function() {
+ return SM.globalPrivateBrowsing;
+ };
+ SM.__defineGetter__("isPrivateWindow", function() {
+ return this.globalPrivateBrowsing;
+ });
+ SM.__defineGetter__("isPrivateSession", function() {
+ return this.globalPrivateBrowsing;
+ });
}
// make tabmix compatible with ezsidebar extension
diff --git a/chrome/content/minit/minit.js b/chrome/content/minit/minit.js
index a2f9139..d2baaa6 100644
--- a/chrome/content/minit/minit.js
+++ b/chrome/content/minit/minit.js
@@ -23,8 +23,8 @@ var TMP_tabDNDObserver = {
init: function TMP_tabDNDObserver_init() {
var tabBar = gBrowser.tabContainer;
if (Tabmix.extensions.verticalTabBar) {
- tabBar.useTabmixDragstart = function() false;
- tabBar.useTabmixDnD = function() false;
+ tabBar.useTabmixDragstart = () => false;
+ tabBar.useTabmixDnD = () => false;
return;
}
@@ -65,7 +65,7 @@ var TMP_tabDNDObserver = {
'\n\
this.removeAttribute("movingBackgroundTab");\n\
let tabs = this.getElementsByAttribute("dragged", "*");\n\
- Array.slice(tabs).forEach(function(tab) tab.removeAttribute("dragged"));\n\
+ Array.slice(tabs).forEach(tab => tab.removeAttribute("dragged"));\n\
$1$2'
).toCode();
@@ -163,7 +163,7 @@ var TMP_tabDNDObserver = {
// positioned relative to the corner of the new window created upon
// dragend such that the mouse appears to have the same position
// relative to the corner of the dragged tab.
- let clientX = function _clientX(ele) ele.getBoundingClientRect().left;
+ let clientX = ele => ele.getBoundingClientRect().left;
let tabOffsetX = clientX(tab) - clientX(gBrowser.tabContainer);
tab._dragData = {
offsetX: event.screenX - window.screenX - tabOffsetX,
@@ -586,7 +586,7 @@ var TMP_tabDNDObserver = {
},
getNewIndex: function (event) {
- function getTabRowNumber(tab, top) tab.pinned ? 1 : Tabmix.tabsUtils.getTabRowNumber(tab, top)
+ let getTabRowNumber = (tab, top) => tab.pinned ? 1 : Tabmix.tabsUtils.getTabRowNumber(tab, top);
// if mX is less then the first tab return 0
// check if mY is below the tab.... if yes go to next row
// in the row find the closest tab by mX,
@@ -954,13 +954,13 @@ var TMP_TabView = { /* jshint ignore: line */
// includung _removingTabs
currentGroup: function () {
- return Array.filter(gBrowser.tabs, function(tab) !tab.hidden);
+ return Array.filter(gBrowser.tabs, tab => !tab.hidden);
},
// visibleTabs don't include _removingTabs
getTabPosInCurrentGroup: function (aTab) {
if (aTab) {
- let tabs = Array.filter(gBrowser.tabs, function(tab) !tab.hidden);
+ let tabs = Array.filter(gBrowser.tabs, tab => !tab.hidden);
return tabs.indexOf(aTab);
}
return -1;
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index 8528660..0df0033 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -9,7 +9,7 @@
TabmixSessionManager.saveTabViewData(TabmixSessionManager.gThisWin, true);
TMP_LastTab.tabs = null;
if (TabmixTabbar.hideMode != 2)
- setTimeout(function () {gBrowser.tabContainer.adjustTabstrip()}, 0);
+ setTimeout(() => gBrowser.tabContainer.adjustTabstrip(), 0);
break;
case "TabShow":
if (!gBrowser.tabContainer._onDelayTabShow) {
diff --git a/chrome/content/minit/tablib.js b/chrome/content/minit/tablib.js
index 54d2737..ea42a56 100644
--- a/chrome/content/minit/tablib.js
+++ b/chrome/content/minit/tablib.js
@@ -80,7 +80,7 @@ var tablib = {
var isBlankTab = gBrowser.isBlankNotBusyTab(tab);
var isLockedTab = tab.hasAttribute("locked");
if (!allowLoad && !isBlankTab && isLockedTab) {
- let isFlaged = function(flag) !!(flags & Ci.nsIWebNavigation[flag]);
+ let isFlaged = flag => !!(flags & Ci.nsIWebNavigation[flag]);
params.inBackground = false;
params.allowThirdPartyFixup = isFlaged("LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP");
params.fromExternal = isFlaged("LOAD_FLAGS_FROM_EXTERNAL");
@@ -114,7 +114,7 @@ var tablib = {
return loadInCurrent;
let stack = Error().stack || Components.stack.caller.formattedStack || "";
- var re = keys.map(function(key) exceptionList[key]);
+ var re = keys.map(key => exceptionList[key]);
return new RegExp(re.join("|")).test(stack);
},
diff --git a/chrome/content/places/places.js b/chrome/content/places/places.js
index e3a16c8..f5d8a97 100644
--- a/chrome/content/places/places.js
+++ b/chrome/content/places/places.js
@@ -444,7 +444,7 @@ var TMP_Places = {
return aTitle;
var oID = {value: aTab ? aTab.getAttribute("tabmix_bookmarkId") : aItemId};
- var getTitle = function(url) this._getBookmarkTitle(url, oID);
+ var getTitle = url => this._getBookmarkTitle(url, oID);
var title = this.applyCallBackOnUrl(aUrl, getTitle);
// setItem check if aTab exist and remove the attribute if
// oID.value is null
@@ -555,7 +555,7 @@ var TMP_Places = {
else if (!Array.isArray(aItemId))
[aItemId, aUrl] = [[aItemId], [aUrl]];
- let getIndex = function(url) aUrl.indexOf(url) + 1;
+ let getIndex = url => aUrl.indexOf(url) + 1;
Array.forEach(gBrowser.tabs, function(tab) {
let url = tab.linkedBrowser.currentURI.spec;
if (this.isUserRenameTab(tab, url))
diff --git a/chrome/content/preferences/menu.js b/chrome/content/preferences/menu.js
index 3f2c8ce..4efa04e 100644
--- a/chrome/content/preferences/menu.js
+++ b/chrome/content/preferences/menu.js
@@ -59,7 +59,7 @@ var gMenuPane = { // jshint ignore:line
return;
shortcuts.value = newValue;
shortcuts.keys = TabmixSvc.JSON.parse(newValue);
- let callBack = function(shortcut) shortcut.id && shortcut.valueFromPreferences(Shortcuts.keys[shortcut.id]);
+ let callBack = shortcut => shortcut.id && shortcut.valueFromPreferences(Shortcuts.keys[shortcut.id]);
this.updateShortcuts(shortcuts, callBack);
},
diff --git a/chrome/content/preferences/shortcuts.js b/chrome/content/preferences/shortcuts.js
index 0b12dc1..1e8cc3d 100644
--- a/chrome/content/preferences/shortcuts.js
+++ b/chrome/content/preferences/shortcuts.js
@@ -4,13 +4,15 @@
"use strict";
+var getFormattedKey = key => Shortcuts.getFormattedKey(key);
+
///XXX TODO - add black list with shortcut (F1, Ctrl-Tab ....) that don't have DOM key element
function getKeysForShortcut(shortcut, id, win) {
if (!win)
win = Services.wm.getMostRecentWindow("navigator:browser");
- let $ = function(id) id && win.document.getElementById(id);
- let isDisabled = function(item) item && item.getAttribute("disabled");
+ let $ = id => id && win.document.getElementById(id);
+ let isDisabled = item => item && item.getAttribute("disabled");
let ourKey = $(id);
if (isDisabled(ourKey))
@@ -31,7 +33,7 @@ function getKeysForShortcut(shortcut, id, win) {
if (getFormattedKey(_key) == shortcut)
return true;
return false;
- }).map(function(key) " " + _getKeyName(win, key).replace(dots, ""));
+ }).map(key => " " + _getKeyName(win, key).replace(dots, ""));
return usedKeys.join("\n");
}
@@ -79,8 +81,12 @@ function _getKeyName(win, aKey) {
"BrowserReload();": "key_reload",
goBackKb2: "goBackKb",
goForwardKb2: "goForwardKb",
- get cmd_handleBackspace() this.action < 2 && ["goBackKb", "cmd_scrollPageUp"][this.action],
- get cmd_handleShiftBackspace() this.action < 2 && ["goForwardKb", "cmd_scrollPageDown"][this.action]
+ get cmd_handleBackspace() {
+ return this.action < 2 && ["goBackKb", "cmd_scrollPageUp"][this.action];
+ },
+ get cmd_handleShiftBackspace() {
+ return this.action < 2 && ["goForwardKb", "cmd_scrollPageDown"][this.action];
+ }
};
if (keyname[id]) {
let key = doc.getElementById(keyname[id]);
@@ -114,5 +120,3 @@ function _getPath(elm){
}
return names.join(" > ");
}
-
-function getFormattedKey(key) Shortcuts.getFormattedKey(key)
diff --git a/chrome/content/preferences/shortcuts.xml b/chrome/content/preferences/shortcuts.xml
index ecc7b35..1ce6c15 100644
--- a/chrome/content/preferences/shortcuts.xml
+++ b/chrome/content/preferences/shortcuts.xml
@@ -73,7 +73,7 @@
Shortcuts.prefsChangedByTabmix = true;
$("pref_shortcuts").value = this.parentNode.value;
Shortcuts.prefsChangedByTabmix = false;
- let callBack = function(shortcut) shortcut.id && shortcut.updateNotification();
+ let callBack = shortcut => shortcut.id && shortcut.updateNotification();
gMenuPane.updateShortcuts(this.parentNode, callBack);
}
this.editBox.select();
@@ -136,7 +136,7 @@
let key = {modifiers: "", key: "", keycode: ""};
key.modifiers =
- ["ctrl","meta","alt","shift"].filter(function(mod) event[mod+"Key"]).
+ ["ctrl","meta","alt","shift"].filter(mod => event[mod + "Key"]).
join(",").replace("ctrl", "control");
if (!key.modifiers) {
@@ -224,16 +224,16 @@
<property name="defaultPref" readonly="true">
<getter><![CDATA[
- let defaultPref = (Shortcuts.keys[this.id].default || "").replace(/^d&/, "");
- if (defaultPref) {
+ let defaultVal = (Shortcuts.keys[this.id].default || "").replace(/^d&/, "");
+ if (defaultVal) {
let resetButton = document.getAnonymousElementByAttribute(this, "anonid", "reset");
resetButton.hidden = false;
- let defaultKey = getFormattedKey(Shortcuts.keyParse(defaultPref));
+ let defaultKey = getFormattedKey(Shortcuts.keyParse(defaultVal));
resetButton.setAttribute("tooltiptext",
resetButton.getAttribute("tooltiptext") + "\nDefault is: " + defaultKey);
}
- this.__defineGetter__("defaultPref", function() defaultPref);
- return defaultPref;
+ this.__defineGetter__("defaultPref", () => defaultVal);
+ return defaultVal;
]]></getter>
</property>
diff --git a/chrome/content/preferences/subdialogs/pref-appearance.js b/chrome/content/preferences/subdialogs/pref-appearance.js
index c049485..5a7bacc 100644
--- a/chrome/content/preferences/subdialogs/pref-appearance.js
+++ b/chrome/content/preferences/subdialogs/pref-appearance.js
@@ -1,6 +1,6 @@
"use strict";
-function $(id) document.getElementById(id)
+let $ = id => document.getElementById(id);
let tabstyles = { // jshint ignore:line
pref: "appearance_tab",
diff --git a/chrome/content/preferences/subdialogs/pref-appearance.xml b/chrome/content/preferences/subdialogs/pref-appearance.xml
index 1893192..1a5154e 100644
--- a/chrome/content/preferences/subdialogs/pref-appearance.xml
+++ b/chrome/content/preferences/subdialogs/pref-appearance.xml
@@ -72,7 +72,7 @@
useThis.nextSibling.value = document.getElementById("_" + this.id).label;
// colorpicker need some time untile its ready
- window.setTimeout( function(self) {self._getPrefs(self._initPrefValues);}, 0, this)
+ window.setTimeout(() => {this._getPrefs(this._initPrefValues);}, 0);
]]>
</constructor>
@@ -259,7 +259,7 @@
<property name="rgba" readonly="true">
<getter><![CDATA[
- let rgba = this._RGB.map(function(c) parseInt(c.value));
+ let rgba = this._RGB.map(c => parseInt(c.value));
rgba[3] /= 100;
return rgba;
]]></getter>
diff --git a/chrome/content/session/session.js b/chrome/content/session/session.js
index af291a4..249d297 100644
--- a/chrome/content/session/session.js
+++ b/chrome/content/session/session.js
@@ -375,8 +375,7 @@ var TabmixSessionManager = { // jshint ignore:line
}
if (Tabmix.isWindowAfterSessionRestore) {
- let self = this;
- setTimeout(function(){self.onSessionRestored()}, 0);
+ setTimeout(() => this.onSessionRestored(), 0);
}
else {
if (TabmixSvc.sm.crashed && this.enableBackup)
@@ -1473,7 +1472,7 @@ if (container == "error") { Tabmix.log("wrapContainer error path " + path + "\n"
if (gBrowser.isBlankWindow())
return false;
return typeof privateTab != "object" ||
- Array.some(gBrowser.tabs, function(tab) !privateTab.isTabPrivate(tab));
+ Array.some(gBrowser.tabs, tab => !privateTab.isTabPrivate(tab));
},
saveOneOrAll: function(action, path, saveClosedTabs) {
@@ -2915,7 +2914,7 @@ try{
if (!state)
return null;
// Ensure sure that all entries have url
- var entries = state.entries.filter(function(e) e.url);
+ var entries = state.entries.filter(e => e.url);
if (!entries.length)
return null;
// Ensure the index is in bounds.
diff --git a/chrome/content/tab/tab.js b/chrome/content/tab/tab.js
index bd272f7..deace69 100644
--- a/chrome/content/tab/tab.js
+++ b/chrome/content/tab/tab.js
@@ -1838,7 +1838,7 @@ var gTMPprefObserver = {
* style for each tab
*/
if (styleName == "unloaded" || styleName == "unread")
- Array.forEach(gBrowser.tabs, function(tab) Tabmix.setTabStyle(tab));
+ Array.forEach(gBrowser.tabs, tab => Tabmix.setTabStyle(tab));
let isBold = function(attrib) {
attrib = attrib.split(" ");
@@ -1966,7 +1966,7 @@ var gTMPprefObserver = {
},
changeNewTabButtonSide: function(aPosition) {
- function $(id) document.getElementById(id)
+ let $ = id => document.getElementById(id);
let newTabButton = $("new-tab-button");
if (TabmixTabbar.isButtonOnTabsToolBar(newTabButton)) {
// update our attribute
@@ -1992,7 +1992,7 @@ var gTMPprefObserver = {
Tabmix.setItem(tabsToolbar, "tabbaronbottom", TabmixTabbar.position == 1 || null);
};
if (TabmixTabbar.position == 1)
- setTimeout(function() doChange(), 15);
+ setTimeout(() => doChange(), 15);
else
doChange();
}
@@ -2013,7 +2013,7 @@ var gTMPprefObserver = {
tabsToolbar.insertBefore(newTabButton, tabsToolbar.childNodes.item(newPosition));
// update currentset
let cSet = tabsToolbar.getAttribute("currentset") || tabsToolbar.getAttribute("defaultset");
- cSet = cSet.split(",").filter(function(id) id != "new-tab-button");
+ cSet = cSet.split(",").filter(id => id != "new-tab-button");
let tabsIndex = cSet.indexOf("tabbrowser-tabs");
if (tabsIndex < 0)
return;
@@ -2430,7 +2430,7 @@ try {
let getVersion = function _getVersion(currentVersion, shouldAutoUpdate) {
let oldVersion = Tabmix.prefs.prefHasUserValue("version") ? Tabmix.prefs.getCharPref("version") : "";
- let vCompare = function(a, b) Services.vc.compare(a, b) <= 0;
+ let vCompare = (a, b) => Services.vc.compare(a, b) <= 0;
if (oldVersion) {
// 2013-08-18
if (vCompare(oldVersion, "0.4.1.1pre.130817a") &&
@@ -2458,7 +2458,7 @@ try {
showNewVersionTab = true;
else if (shouldAutoUpdate || oldVersion === "") {
let re = /([A-Za-z]*)\d*$/;
- let subs = function(obj) obj[1] ? obj.input.substring(0, obj.index) : obj.input;
+ let subs = obj => obj[1] ? obj.input.substring(0, obj.index) : obj.input;
showNewVersionTab = subs(re.exec(currentVersion)) != subs(re.exec(oldVersion));
}
}
diff --git a/chrome/content/tabmix.js b/chrome/content/tabmix.js
index 41d0d7a..4809669 100644
--- a/chrome/content/tabmix.js
+++ b/chrome/content/tabmix.js
@@ -1043,8 +1043,9 @@ var TMP_eventListener = {
}
else {
let isVertical = aEvent.axis == aEvent.VERTICAL_AXIS;
- if (tabsSrip._prevMouseScrolls.every(function(prev) {return prev == isVertical}))
+ if (tabsSrip._prevMouseScrolls.every(prev => prev == isVertical)) {
tabsSrip.scrollByIndex(isVertical && tabsSrip._isRTLScrollbox ? -direction : direction);
+ }
if (tabsSrip._prevMouseScrolls.length > 1)
tabsSrip._prevMouseScrolls.shift();
diff --git a/modules/AutoReload.jsm b/modules/AutoReload.jsm
index 4176f6c..62bddb7 100644
--- a/modules/AutoReload.jsm
+++ b/modules/AutoReload.jsm
@@ -84,12 +84,12 @@ this.AutoReload = {
if (!prefs.prefHasUserValue(pref))
return [];
let list = prefs.getCharPref(pref).split(",");
- if (!list.every(function(val) val==parseInt(val))) {
+ if (!list.every(val => val == parseInt(val))) {
prefs.clearUserPref(pref);
return [];
}
let defaultList = ["30","60","120","300","900","1800"];
- list = list.filter(function(val) defaultList.indexOf(val) == -1);
+ list = list.filter(val => defaultList.indexOf(val) == -1);
let newList = [];
list.forEach(function(val){
if (parseInt(val) && newList.indexOf(val) == -1)
@@ -102,13 +102,13 @@ this.AutoReload = {
}
let doc = aPopup.ownerDocument.defaultView.document;
- getList().sort(function(a,b) parseInt(a)>parseInt(b)).forEach(function(val) {
+ getList().sort((a,b) => parseInt(a) > parseInt(b)).forEach(val => {
let mi = doc.createElement("menuitem");
this.setLabel(mi, val);
mi.setAttribute("type", "radio");
mi.setAttribute("value", val);
aPopup.insertBefore(mi, end);
- }, this);
+ });
},
setLabel: function(aItem, aSeconds) {
diff --git a/modules/ContentClick.jsm b/modules/ContentClick.jsm
index 327e1be..a8eddeb 100644
--- a/modules/ContentClick.jsm
+++ b/modules/ContentClick.jsm
@@ -246,12 +246,20 @@ var ContentClickInternal = {
* @return wrapped node including attribute functions
*/
getWrappedNode: function(node, focusedWindow, getTargetIsFrame) {
- function wrapNode(aNode, aGetTargetIsFrame) {
+ let wrapNode = function wrapNode(aNode, aGetTargetIsFrame) {
let nObj = LinkNodeUtils.wrap(aNode, focusedWindow, aGetTargetIsFrame);
- nObj.hasAttribute = function(att) att in this._attributes;
- nObj.getAttribute = function(att) this._attributes[att] || null;
- nObj.parentNode.hasAttribute = function(att) att in this._attributes;
- nObj.parentNode.getAttribute = function(att) this._attributes[att] || null;
+ nObj.hasAttribute = function(att) {
+ return att in this._attributes;
+ };
+ nObj.getAttribute = function(att) {
+ return this._attributes[att] || null;
+ };
+ nObj.parentNode.hasAttribute = function(att) {
+ return att in this._attributes;
+ };
+ nObj.parentNode.getAttribute = function(att) {
+ return this._attributes[att] || null;
+ };
return nObj;
}
@@ -876,9 +884,9 @@ var ContentClickInternal = {
let current = this._data.currentURL.toLowerCase();
let youtube = /www\.youtube\.com\/watch\?v\=/;
- let isYoutube = function(href) youtube.test(current) && youtube.test(href);
- let isSamePath = function(href, att) makeURI(current).path.split(att)[0] == makeURI(href).path.split(att)[0];
- let isSame = function(href, att) current.split(att)[0] == href.split(att)[0];
+ let isYoutube = href => youtube.test(current) && youtube.test(href);
+ let isSamePath = (href, att) => makeURI(current).path.split(att)[0] == makeURI(href).path.split(att)[0];
+ let isSame = (href, att) => current.split(att)[0] == href.split(att)[0];
if (hrefFromOnClick) {
hrefFromOnClick = hrefFromOnClick.toLowerCase();
diff --git a/modules/DocShellCapabilities.jsm b/modules/DocShellCapabilities.jsm
index 1aef9fd..22e9ace 100644
--- a/modules/DocShellCapabilities.jsm
+++ b/modules/DocShellCapabilities.jsm
@@ -32,8 +32,9 @@ this.DocShellCapabilities = {
collect: function(tab) {
let browser = tab.linkedBrowser;
- if (!this.useFrameScript)
- return this.caps.filter(function(cap) !browser.docShell["allow" + cap]);
+ if (!this.useFrameScript) {
+ return this.caps.filter(cap => !browser.docShell["allow" + cap]);
+ }
if (tab.ownerDocument.defaultView.__SSi) {
let tabState = TabState.collect(tab);
diff --git a/modules/MergeWindows.jsm b/modules/MergeWindows.jsm
index 07cabc5..cfd9651 100644
--- a/modules/MergeWindows.jsm
+++ b/modules/MergeWindows.jsm
@@ -209,10 +209,10 @@ this.MergeWindows = {
delete this.isWindowPrivate;
if (TabmixSvc.version(200)) {
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
- this.isWindowPrivate = function(aWindow) PrivateBrowsingUtils.isWindowPrivate(aWindow);
+ this.isWindowPrivate = aWindow => PrivateBrowsingUtils.isWindowPrivate(aWindow);
return this.isWindowPrivate(arguments[0]);
}
- this.isWindowPrivate = function() false;
+ this.isWindowPrivate = () => false;
return false;
},
@@ -255,7 +255,7 @@ this.MergeWindows = {
let windows = [], popUps = [];
let isWINNT = Services.appinfo.OS == "WINNT";
- let more = function() !isWINNT || aOptions.multiple || windows.length === 0;
+ let more = () => !isWINNT || aOptions.multiple || windows.length === 0;
// getEnumerator return windows from oldest to newest, so we use unshift.
// when OS is WINNT and option is not multiple the loop stops when we find the most
// recent suitable window
diff --git a/modules/Shortcuts.jsm b/modules/Shortcuts.jsm
index 2db707b..eb39e84 100644
--- a/modules/Shortcuts.jsm
+++ b/modules/Shortcuts.jsm
@@ -79,14 +79,14 @@ this.Shortcuts = {
// update keys initial value and label
// get our key labels from shortcutsLabels.xml
- let $ = function(id) id && aWindow.document.getElementById(id);
+ let $ = id => id && aWindow.document.getElementById(id);
let container = $("tabmixScrollBox") || $("tabbrowser-tabs");
let labels = {};
if (container) {
let box = aWindow.document.createElement("vbox");
box.setAttribute("shortcutsLabels", true);
container.appendChild(box);
- Array.slice(box.attributes).forEach(function(a) labels[a.name] = a.value);
+ Array.slice(box.attributes).forEach(a => labels[a.name] = a.value);
container.removeChild(box);
}
labels.togglePinTab =
@@ -348,8 +348,9 @@ this.Shortcuts = {
return "";
let modifiers = key.modifiers.replace(/^[\s,]+|[\s,]+$/g,"")
.replace("ctrl", "control").split(",");
- key.modifiers = ["control","meta","accel","alt","shift"].filter(
- function(mod) new RegExp(mod).test(modifiers)).join(",");
+ key.modifiers = ["control","meta","accel","alt","shift"].filter(mod => {
+ return new RegExp(mod).test(modifiers);
+ }).join(",");
// make sure that key and keycod are valid
key.key = key.key.toUpperCase();
diff --git a/modules/Utils.jsm b/modules/Utils.jsm
index fc0ea7e..eeb1b58 100644
--- a/modules/Utils.jsm
+++ b/modules/Utils.jsm
@@ -29,7 +29,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "MergeWindows",
this.TabmixUtils = {
initMessageManager: function(window) {
let mm = window.getGroupMessageManager("browsers");
- FMM_MESSAGES.forEach(function(msg) mm.addMessageListener(msg, this), this);
+ FMM_MESSAGES.forEach(msg => mm.addMessageListener(msg, this));
// Load the frame script after registering listeners.
mm.loadFrameScript("chrome://tabmixplus/content/content.js", true);
@@ -37,7 +37,7 @@ this.TabmixUtils = {
deinit: function(window) {
let mm = window.getGroupMessageManager("browsers");
- FMM_MESSAGES.forEach(function(msg) mm.removeMessageListener(msg, this), this);
+ FMM_MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
},
receiveMessage: function(message) {
diff --git a/modules/log.jsm b/modules/log.jsm
index ce031ac..877b39b 100644
--- a/modules/log.jsm
+++ b/modules/log.jsm
@@ -22,7 +22,7 @@ this.console = {
msg += (msg ? "\n" : "") + "aMethod need to be a string";
if (msg) {
this.assert(msg);
- return {toString: function() msg};
+ return {toString: () => msg};
}
var rootID, methodsList = aMethod.split(".");
if (methodsList[0] == "window")
@@ -36,11 +36,9 @@ this.console = {
obj = aWindow;
if (rootID)
obj = obj.document.getElementById(rootID);
- methodsList.forEach(function(aFn) {
- obj = obj[aFn];
- });
+ methodsList.forEach(aFn => obj = obj[aFn]);
} catch (ex) { }
- return obj || {toString: function() "undefined"};
+ return obj || {toString: () => "undefined"};
},
_timers: {},
--
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