Bug 1340189: P1. Only clear array once parsing is done. r?cpearce draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 16 Feb 2017 17:18:53 +0100
changeset 485630 8dcc477641cacb6da577b481623819bb28566b1f
parent 485623 bf1be6687a3af57a30fef6664b1a1b0dfb14d8c3
child 485631 b0535c3abf043581365af9f2470913ffd0bc0e65
push id45794
push userbmo:jyavenard@mozilla.com
push dateThu, 16 Feb 2017 23:30:50 +0000
reviewerscpearce
bugs1340189
milestone54.0a1
Bug 1340189: P1. Only clear array once parsing is done. r?cpearce MozReview-Commit-ID: 5JxSQYoKP9R
dom/media/gmp/GMPCDMProxy.cpp
--- 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
 }