зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1424647: Prevent race on AllPromiseHolder::mPromise. r=jwwang
If any of the promises gets resolved/rejected prior MozPromise::All completing, it would return nullptr MozReview-Commit-ID: Lqhv2t2upvF --HG-- extra : rebase_source : 0c85172958c00a2ac3aa0bd33e4e50dd1893c3ba
This commit is contained in:
Родитель
6c3e4bfaae
Коммит
a1172cfb0e
|
@ -341,13 +341,14 @@ public:
|
|||
}
|
||||
|
||||
RefPtr<AllPromiseHolder> holder = new AllPromiseHolder(aPromises.Length());
|
||||
RefPtr<AllPromiseType> promise = holder->Promise();
|
||||
for (size_t i = 0; i < aPromises.Length(); ++i) {
|
||||
aPromises[i]->Then(aProcessingTarget, __func__,
|
||||
[holder, i] (ResolveValueType aResolveValue) -> void { holder->Resolve(i, Move(aResolveValue)); },
|
||||
[holder] (RejectValueType aRejectValue) -> void { holder->Reject(Move(aRejectValue)); }
|
||||
);
|
||||
}
|
||||
return holder->Promise();
|
||||
return promise;
|
||||
}
|
||||
|
||||
class Request : public MozPromiseRefcountable
|
||||
|
|
Загрузка…
Ссылка в новой задаче