[Pale-Moon] Issue MoonchildProductions/UXP#1828 - Stop using js expression closures in Pale Moon front-end

Stop using non-standard JS expression closures in Pale Moon front-end.
This commit is contained in:
win7-7 2022-04-23 14:51:43 +03:00 • committed by roytam1
commit 264752661b
28 changed files with 244 additions and 149 deletions

View file

@ -34,7 +34,7 @@ var StarUI = {
get _blockedCommands() {
delete this._blockedCommands;
return this._blockedCommands =
["cmd_close", "cmd_closeWindow"].map(function(id) this._element(id), this);
["cmd_close", "cmd_closeWindow"].map(id => this._element(id));
},
_blockCommands: function() {
@ -1258,7 +1258,7 @@ var BookmarkingUI = {
// calls back. For such an edge case, retain all unique entries from both
// arrays.
this._itemIds = this._itemIds.filter(
function(id) aItemIds.indexOf(id) == -1
id => aItemIds.indexOf(id) == -1
).concat(aItemIds);
this._updateStar();

View file

@ -220,7 +220,7 @@ var gSyncUI = {
// Commands
doSync: function() {
setTimeout(function() Weave.Service.errorHandler.syncAndReportErrors(), 0);
setTimeout(() => Weave.Service.errorHandler.syncAndReportErrors(), 0);
},
handleToolbarButton: function() {

View file

@ -1472,7 +1472,7 @@ var gBrowserInit = {
let itemArray = itemBranch.getChildList("");
// See if any privacy.item prefs are set
let doMigrate = itemArray.some(function(name) itemBranch.prefHasUserValue(name));
let doMigrate = itemArray.some(name => itemBranch.prefHasUserValue(name));
// Or if sanitizeOnShutdown is set
if (!doMigrate) {
doMigrate = gPrefService.getBoolPref("privacy.sanitize.sanitizeOnShutdown");
@ -2955,7 +2955,7 @@ const BrowserSearch = {
// Check to see whether we've already added an engine with this title
if (browser.engines) {
if (browser.engines.some(function(e) e.title == engine.title)) {
if (browser.engines.some(e => e.title == engine.title)) {
return;
}
}
@ -4420,7 +4420,7 @@ nsBrowserAccess.prototype = {
},
isTabContentWindow: function(aWindow) {
return gBrowser.browsers.some(function(browser) browser.contentWindow == aWindow);
return gBrowser.browsers.some(browser => browser.contentWindow == aWindow);
}
}
@ -4664,8 +4664,8 @@ var TabsInTitlebar = {
},
_update: function() {
function $(id) document.getElementById(id);
function rect(ele) ele.getBoundingClientRect();
let $ = id => document.getElementById(id);
let rect = ele => ele.getBoundingClientRect();
if (!this._initialized || window.fullScreen) {
return;

View file

@ -55,7 +55,7 @@
<getter><![CDATA[
if (!this._visibleTabs)
this._visibleTabs = Array.filter(this.tabs,
function (tab) !tab.hidden && !tab.closing);
tab => !tab.hidden && !tab.closing);
return this._visibleTabs;
]]></getter>
</property>
@ -2493,7 +2493,7 @@
<body>
<![CDATA[
this.mProgressListeners =
this.mProgressListeners.filter(function (l) l != aListener);
this.mProgressListeners.filter(l => l != aListener);
]]>
</body>
</method>
@ -2510,7 +2510,7 @@
<body>
<![CDATA[
this.mTabsProgressListeners =
this.mTabsProgressListeners.filter(function (l) l != aListener);
this.mTabsProgressListeners.filter(l => l != aListener);
]]>
</body>
</method>
@ -2627,7 +2627,7 @@
<getter>
<![CDATA[
return this._browsers ||
(this._browsers = Array.map(this.tabs, function (tab) tab.linkedBrowser));
(this._browsers = Array.map(this.tabs, tab => tab.linkedBrowser));
]]>
</getter>
</property>
@ -4584,7 +4584,9 @@
// 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.
function clientX(ele) ele.getBoundingClientRect().left;
function clientX(ele) {
return ele.getBoundingClientRect().left;
}
let tabOffsetX = clientX(tab) - clientX(this);
tab._dragData = {
offsetX: event.screenX - window.screenX - tabOffsetX,