Your code appears unnecessarily complicated to me.
Since $.when
also creates a promise, don't bother creating the masterDeferred
yourself, just do:
return $.when.apply($, promises);
The only functional difference is that this version will pass the true
results as individual parameters to the eventual callback, whereas your code will pass a single array of [true, true, ...]
values.