Bug 1340189: P1. Only clear array once parsing is done. r?cpearce
MozReview-Commit-ID: 5JxSQYoKP9R
--- a/dom/media/gmp/GMPCDMProxy.cpp
+++ b/dom/media/gmp/GMPCDMProxy.cpp
@@ -719,25 +719,24 @@ void
GMPCDMProxy::gmp_Decrypted(uint32_t aId,
DecryptStatus aResult,
const nsTArray<uint8_t>& aDecryptedData)
{
MOZ_ASSERT(IsOnOwnerThread());
#ifdef DEBUG
bool jobIdFound = false;
#endif
- for (size_t i = 0; i < mDecryptionJobs.Length(); i++) {
- DecryptJob* job = mDecryptionJobs[i];
+ for (auto& job : mDecryptionJobs) {
if (job->mId == aId) {
#ifdef DEBUG
jobIdFound = true;
#endif
job->PostResult(aResult, aDecryptedData);
- mDecryptionJobs.RemoveElementAt(i);
}
+ mDecryptionJobs.Clear();
}
#ifdef DEBUG
if (!jobIdFound) {
NS_WARNING("GMPDecryptorChild returned incorrect job ID");
}
#endif
}