Closed Bug 852531 Opened 11 years ago Closed 11 years ago

[New Tab Page] use promises to wait for a batch of operations to complete

Categories

(Firefox :: Tabbed Browser, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 22

People

(Reporter: ttaubert, Assigned: ttaubert)

Details

Attachments

(1 file)

We didn't have Promises when I built the new tab page so I came up with something similar in newtab/batch.js. I'd like to remove that code and just use Promises like:

Promise.all(promise1, promise2, promise3, ..., promiseN)
Comment on attachment 726659 [details] [diff] [review]
use promises to wait for a batch of operations to complete

Review of attachment 726659 [details] [diff] [review]:
-----------------------------------------------------------------

I believe that you are going to be the first user of Promise.promised outside of addon-sdk, so I will be waiting for the try results :)

::: browser/base/content/newtab/transformations.js
@@ +180,5 @@
>          return;
>  
> +      let deferred = Promise.defer();
> +      batch.push(deferred.promise);
> +      let cb = function () deferred.resolve();

Remark: Actually, |deferred.resolve| is probably sufficient, but you are right to not rely on this.
Attachment #726659 - Flags: review?(dteller) → review+
https://hg.mozilla.org/mozilla-central/rev/f6e7195e87db
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 22
Depends on: 963168
No longer depends on: 963168
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: