Closed
Bug 874128
Opened 11 years ago
Closed 11 years ago
Consider replacing our custom Promise.all with the one from ondras
Categories
(L20n :: JS Library, defect)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: zbraniecki, Unassigned)
Details
When I added Promise.all, I didn't know that ondras wrote his: https://github.com/ondras/promise/blob/master/promise-addons.js It's mostly the same, but it collects results and has an errback.
Comment 1•11 years ago
|
||
The problem is that our Promise.all isn't really an 'all.' ondras' .when rejects the promise the moment it first encounters an error. Other promises passed to .when may finish after the error, and their result is irrelevant; the promise has already been rejected. By setting counter to Infinity in the errback, ondras makes sure the .when promise is never fulfilled. We, OTOH, need a different behavior: we need all promises to finish, and only after they do do we want to invoke the callback. We don't care about the actual result (individual downloads may succeed or fail) as much as we do about making sure that the callback isn't invoked before all downloads finish. To avoid confusion, we could rename our Promise.all to Promise.after or something like that. Also, note that even in a scenario when all downloads fail we still want to invoke the callback and build the Locale object because there might have been inline resources added via ctx.addResource.
Reporter | ||
Comment 2•11 years ago
|
||
you're right. Let's stick to our solution. It's way better. The guy who wrote it must be a genius. Oh wait...
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•