Bug 895359 - [New Tab Page] Switch from promise.js to Promise.jsm r=jaws

This commit is contained in:
Tim Taubert
2014-04-09 11:43:11 +02:00
parent 8e40176d14
commit d9f375e357
3 changed files with 7 additions and 8 deletions

View File

@@ -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");

View File

@@ -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);
}
},
/**

View File

@@ -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);
}
};