Bug 1151475 - Part 1: Remove use of expression closure from mail/base/. r=mkmelin

This commit is contained in:
Tooru Fujisawa 2015-04-20 00:16:23 +09:00
Родитель 63b17cce61
Коммит b12d0e2b39
10 изменённых файлов: 40 добавлений и 41 удалений

Просмотреть файл

@ -1134,7 +1134,7 @@ let gFolderTreeView = {
let folderItem = new ftvItem(subFolders[0]);
folderItem._level = 0;
if (flag & nsMsgFolderFlags.Inbox)
folderItem.__defineGetter__("children", function() []);
folderItem.__defineGetter__("children", () => []);
if (position == undefined)
map.push(folderItem);
else
@ -1183,7 +1183,7 @@ let gFolderTreeView = {
// don't show sub-folders of the inbox, but I think Archives/Sent, etc
// should have the sub-folders.
if (flag & nsMsgFolderFlags.Inbox)
child.__defineGetter__("children", function() []);
child.__defineGetter__("children", () => []);
// If we have consecutive children with the same server, then both
// should display as folder - server.
if (prevChild && (child._folder.server == prevChild._folder.server)) {
@ -1507,7 +1507,7 @@ let gFolderTreeView = {
// There are no children in this view!
for (let folder of map) {
folder.__defineGetter__("children", function() []);
folder.__defineGetter__("children", () => []);
folder.addServerName = true;
}
sortFolderItems(map);
@ -1602,7 +1602,7 @@ let gFolderTreeView = {
// There are no children in this view!
for (let item of faves) {
let name = item._folder.abbreviatedName.toLocaleLowerCase();
item.__defineGetter__("children", function() []);
item.__defineGetter__("children", () => []);
item.addServerName = dupeNames.has(name);
}
sortFolderItems(faves);
@ -1655,7 +1655,7 @@ let gFolderTreeView = {
// And we want to display the account name to distinguish folders w/
// the same name.
for (let folder of items) {
folder.__defineGetter__("children", function() []);
folder.__defineGetter__("children", () => []);
folder.addServerName = true;
}
@ -1755,7 +1755,7 @@ let gFolderTreeView = {
get _allSmartFlags() {
delete this._allSmartFlags;
return this._allSmartFlags = this._flagNameList.reduce(
function (res, [flag,, isDeep,]) res | flag, 0);
(res, [flag,, isDeep,]) => res | flag, 0);
},
/**
@ -1764,7 +1764,7 @@ let gFolderTreeView = {
get _allShallowFlags() {
delete this._allShallowFlags;
return this._allShallowFlags = this._flagNameList.reduce(
function (res, [flag,, isDeep,]) isDeep ? res : (res | flag), 0);
(res, [flag,, isDeep,]) => isDeep ? res : (res | flag), 0);
},
/**
@ -2023,7 +2023,7 @@ let gFolderTreeView = {
newChild.useServerNameOnly = true;
}
if (aItem.flags & nsMsgFolderFlags.Inbox)
newChild.__defineGetter__("children", function() []);
newChild.__defineGetter__("children", () => []);
if (parent)
this._addChildToView(parent, parentIndex, newChild);
else {

Просмотреть файл

@ -1655,7 +1655,7 @@
// Sort the matches by index, just to be sure.
// They are probably already sorted, but if they aren't it could
// mess things up at the next step.
matches.sort(function(a, b) a[0] - b[0]);
matches.sort((a, b) => a[0] - b[0]);
// Convert the byte offsets and lengths into character indexes.
let charCodeToByteCount = function(c) {

Просмотреть файл

@ -343,11 +343,11 @@ var FacetContext = {
else
scores = Gloda.scoreNounItems(items);
let scoredItems = items.map(function(item, index) { return [scores[index], item]; });
scoredItems.sort(function(a,b) b[0]-a[0]);
scoredItems.sort((a, b) => b[0]-a[0]);
this._relevantSortedItems = scoredItems.map(scoredItem => scoredItem[1]);
this._dateSortedItems =
this._relevantSortedItems.concat().sort(function(a,b) b.date-a.date);
this._relevantSortedItems.concat().sort((a, b) => b.date-a.date);
},
initialBuild: function() {

Просмотреть файл

@ -265,13 +265,13 @@ DateFacetVis.prototype = {
vis.add(pv.Bar)
.data(bins)
.bottom(0)
.height(function (d) Math.floor(d.items.length * binScale))
.width(function() barWidth)
.left(function() isRTL ? null : (this.index * barPix))
.right(function() isRTL ? (this.index * barPix) : null)
.height(d => Math.floor(d.items.length * binScale))
.width(() => barWidth)
.left(function() { return isRTL ? null : (this.index * barPix); })
.right(function() { return isRTL ? (this.index * barPix) : null; })
.fillStyle("#add2fb")
.event("mouseover", function(d) this.fillStyle("#3465a4"))
.event("mouseout", function(d) this.fillStyle("#add2fb"))
.event("mouseover", function(d) { return this.fillStyle("#3465a4"); })
.event("mouseout", function(d) { return this.fillStyle("#add2fb"); })
.event("click", function(d) {
dis.constraints = [[d.startDate, d.endDate]];
dis.binding.setAttribute("zoomedout", "false");
@ -283,9 +283,9 @@ DateFacetVis.prototype = {
this.hotBars = vis.add(pv.Bar)
.data(this.emptyBins)
.bottom(0)
.height(function (d) Math.floor(d * binScale))
.width(function() barWidth)
.left(function() this.index * barPix)
.height(d => Math.floor(d * binScale))
.width(() => barWidth)
.left(function() { return this.index * barPix; })
.fillStyle("#3465a4");
for (let labelTier of labelTiers) {
@ -293,13 +293,12 @@ DateFacetVis.prototype = {
.data(labelTier.displayValues)
.bottom(-totalAxisLabelHeight + labelTier.vertOffset)
.height(labelTier.vertHeight)
.left(function(d) isRTL ? null : Math.floor(width * d[0]))
.right(function(d) isRTL ? Math.floor(width * d[0]) : null)
.width(function(d)
Math.floor(width * d[1]) - Math.floor(width * d[0]) - 1)
.left(d => isRTL ? null : Math.floor(width * d[0]))
.right(d => isRTL ? Math.floor(width * d[0]) : null)
.width(d => Math.floor(width * d[1]) - Math.floor(width * d[0]) - 1)
.fillStyle("#dddddd")
.event("mouseover", function(d) this.fillStyle("#3465a4"))
.event("mouseout", function(d) this.fillStyle("#dddddd"))
.event("mouseover", function(d) { return this.fillStyle("#3465a4"); })
.event("mouseout", function(d) { return this.fillStyle("#dddddd"); })
.event("click", function(d) {
dis.constraints = [[d[3], d[4]]];
dis.binding.setAttribute("zoomedout", "false");
@ -313,7 +312,7 @@ DateFacetVis.prototype = {
.textAlign("center")
.textBaseline("top")
.textStyle("black")
.text(function(d) d[2]);
.text(d => d[2]);
}
}

Просмотреть файл

@ -25,12 +25,12 @@
<constructor><![CDATA[
let children = Array.slice(this._childNodes);
children.filter(function(aChild) aChild.getAttribute("selected") == "true")
children.filter(aChild => aChild.getAttribute("selected") == "true")
.forEach(this.selectedItems.push, this.selectedItems);
children.filter(function(aChild) !aChild.hasAttribute("context"))
.forEach(function(aChild) aChild.setAttribute("context",
this.getAttribute("itemcontext")), this);
children.filter(aChild => !aChild.hasAttribute("context"))
.forEach(aChild => aChild.setAttribute("context",
this.getAttribute("itemcontext")));
this.sizes = {small: 16, large: 32, tile: 32};
this.messenger = Components.classes["@mozilla.org/messenger;1"]

Просмотреть файл

@ -1173,7 +1173,7 @@ function HideMessageHeaderPane()
function OutputNewsgroups(headerEntry, headerValue)
{
headerValue.split(",").forEach(
function(newsgroup) headerEntry.enclosingBox.addNewsgroupView(newsgroup));
newsgroup => headerEntry.enclosingBox.addNewsgroupView(newsgroup));
headerEntry.enclosingBox.buildViews();
}

Просмотреть файл

@ -1797,9 +1797,9 @@ let TabsInTitlebar = {
},
_update: function (aForce=false) {
function $(id) document.getElementById(id);
function rect(ele) ele.getBoundingClientRect();
function verticalMargins(cstyle) parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop);
function $(id) { return document.getElementById(id); }
function rect(ele) { return ele.getBoundingClientRect(); }
function verticalMargins(cstyle) { return parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop); }
if (!this._initialized || window.fullScreen)
return;

Просмотреть файл

@ -985,7 +985,7 @@ var specialTabs = {
}
},
shouldSwitchTo: function ({ chromePage: x })
shouldSwitchTo: ({ chromePage: x }) =>
contentTabBaseType.shouldSwitchTo({ contentPage: x }),
/**

Просмотреть файл

@ -31,7 +31,7 @@ const Windows8WindowFrameColor = {
// Zero-pad the number just to make sure that it is 8 digits.
customizationColorHex = ("00000000" + customizationColorHex).substr(-8);
let customizationColorArray = customizationColorHex.match(/../g);
let [unused, fgR, fgG, fgB] = customizationColorArray.map(function(val) parseInt(val, 16));
let [unused, fgR, fgG, fgB] = customizationColorArray.map(val => parseInt(val, 16));
let colorizationColorBalance = Registry.readRegKey(HKCU, dwmKey,
"ColorizationColorBalance") || 78;
// Window frame base color when Color Intensity is at 0, see bug 1004576.

Просмотреть файл

@ -112,7 +112,7 @@ OAuth.prototype = {
if (queryIndex != -1) {
urlSpec = url.slice(0, queryIndex);
dataParams = url.slice(queryIndex + 1).split("&")
.map(function(p) p.split("=").map(percentEncode));
.map(p => p.split("=").map(percentEncode));
}
this.log.info("in sign and send url = " + url + "\nurlSpec = " + urlSpec);
this.log.info("dataParams = " + dataParams);
@ -123,8 +123,8 @@ OAuth.prototype = {
let signatureBase =
aMethod + "&" + encodeURIComponent(urlSpec) + "&" +
params.concat(dataParams)
.sort(function(a,b) (a[0] < b[0]) ? -1 : (a[0] > b[0]) ? 1 : 0)
.map(function(p) p.map(percentEncode).join("%3D"))
.sort((a, b) => (a[0] < b[0]) ? -1 : (a[0] > b[0]) ? 1 : 0)
.map(p => p.map(percentEncode).join("%3D"))
.join("%26");
this.log.info("sig base = " + signatureBase);
@ -150,7 +150,7 @@ OAuth.prototype = {
params.push(["oauth_signature", signature]);
let authorization =
"OAuth " + params.map(function (p) p[0] + "=\"" + p[1] + "\"").join(", ");
"OAuth " + params.map(p => p[0] + "=\"" + p[1] + "\"").join(", ");
let options = {
headers: (aHeaders || []).concat([["Authorization", authorization]]),
postData: aPOSTData,