summaryrefslogtreecommitdiffstats
path: root/application/palemoon/base/content/newtab/transformations.js
diff options
context:
space:
mode:
Diffstat (limited to 'application/palemoon/base/content/newtab/transformations.js')
-rw-r--r--application/palemoon/base/content/newtab/transformations.js24
1 files changed, 12 insertions, 12 deletions
diff --git a/application/palemoon/base/content/newtab/transformations.js b/application/palemoon/base/content/newtab/transformations.js
index 0711d7d0a..4fb565fb9 100644
--- a/application/palemoon/base/content/newtab/transformations.js
+++ b/application/palemoon/base/content/newtab/transformations.js
@@ -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);
+ }
},
/**