Stop using old-style promises module in about:newtab.

- Rewrite to arrow functions.
- Stop using .defer and .promised

Tag #517.
This commit is contained in:
wolfbeast 2018-06-19 11:43:12 +02:00 • committed by Roy Tam
commit d767e24977
3 changed files with 40 additions and 50 deletions

View file

@ -179,23 +179,23 @@ var gTransformation = {
if (!aSite || aSite == gDrag.draggedSite)
return;
let deferred = Promise.defer();
batch.push(deferred.promise);
let cb = function () deferred.resolve();
if (!cells[aIndex])
batch.push(new Promise(resolve => {
if (!cells[aIndex]) {
// The site disappeared from the grid, hide it.
this.hideSite(aSite, cb);
else if (this._getNodeOpacity(aSite.node) != 1)
this.hideSite(aSite, resolve);
} else if (this._getNodeOpacity(aSite.node) != 1) {
// The site disappeared before but is now back, show it.
this.showSite(aSite, cb);
else
this.showSite(aSite, resolve);
} else {
// The site's position has changed, move it around.
this._moveSite(aSite, aIndex, {unfreeze: unfreeze, callback: cb});
this._moveSite(aSite, aIndex, {unfreeze: unfreeze, callback: resolve});
}
}));
}, this);
let wait = Promise.promised(function () callback && callback());
wait.apply(null, batch);
if (callback) {
Promise.all(batch).then(callback);
}
},
/**