Bug 895359 - [New Tab Page] Switch from promise.js to Promise.jsm r=jaws
This commit is contained in:
@@ -13,7 +13,7 @@ Cu.import("resource://gre/modules/PageThumbs.jsm");
|
||||
Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm");
|
||||
Cu.import("resource://gre/modules/DirectoryLinksProvider.jsm");
|
||||
Cu.import("resource://gre/modules/NewTabUtils.jsm");
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Rect",
|
||||
"resource://gre/modules/Geometry.jsm");
|
||||
|
||||
@@ -181,7 +181,7 @@ let gTransformation = {
|
||||
|
||||
let deferred = Promise.defer();
|
||||
batch.push(deferred.promise);
|
||||
let cb = function () deferred.resolve();
|
||||
let cb = deferred.resolve;
|
||||
|
||||
if (!cells[aIndex])
|
||||
// The site disappeared from the grid, hide it.
|
||||
@@ -194,8 +194,9 @@ let gTransformation = {
|
||||
this._moveSite(aSite, aIndex, {unfreeze: unfreeze, callback: cb});
|
||||
}, this);
|
||||
|
||||
let wait = Promise.promised(function () callback && callback());
|
||||
wait.apply(null, batch);
|
||||
if (callback) {
|
||||
Promise.all(batch).then(callback);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -147,8 +147,7 @@ let gUpdater = {
|
||||
});
|
||||
});
|
||||
|
||||
let wait = Promise.promised(aCallback);
|
||||
wait.apply(null, batch);
|
||||
Promise.all(batch).then(aCallback);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -180,7 +179,6 @@ let gUpdater = {
|
||||
gTransformation.showSite(site, function () deferred.resolve());
|
||||
});
|
||||
|
||||
let wait = Promise.promised(aCallback);
|
||||
wait.apply(null, batch);
|
||||
Promise.all(batch).then(aCallback);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user