Bug 1341200. Part 1 - satisfy least privilege principle by capturing |mSamplesWaitingForKey| instead of |this|. draft
authorJW Wang <jwwang@mozilla.com>
Wed, 22 Feb 2017 16:06:14 +0800
changeset 493133 8f6180ff7cf68210bf5e3d5ae708fe4a65d3f8d4
parent 493132 6874dcb3e095daa473e0d060615c00f4ac904437
child 493134 94c493b76c067f249cab5507cb1e6758d3c21bf5
push id47651
push userjwwang@mozilla.com
push dateFri, 03 Mar 2017 09:41:12 +0000
bugs1341200
milestone54.0a1
Bug 1341200. Part 1 - satisfy least privilege principle by capturing |mSamplesWaitingForKey| instead of |this|. MozReview-Commit-ID: A12HdnP8Vbn
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -167,24 +167,19 @@ public:
     mDecodeRequest.DisconnectIfExists();
     mDecodePromise.RejectIfExists(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
     mThroughputLimiter.Flush();
     for (auto iter = mDecrypts.Iter(); !iter.Done(); iter.Next()) {
       nsAutoPtr<DecryptPromiseRequestHolder>& holder = iter.Data();
       holder->DisconnectIfExists();
       iter.Remove();
     }
-    RefPtr<EMEDecryptor> self = this;
+    RefPtr<SamplesWaitingForKey> k = mSamplesWaitingForKey;
     return mDecoder->Flush()->Then(mTaskQueue, __func__,
-                                   [self, this]() {
-                                     mSamplesWaitingForKey->Flush();
-                                   },
-                                   [self, this]() {
-                                     mSamplesWaitingForKey->Flush();
-                                   });
+                                   [k]() { k->Flush(); });
   }
 
   RefPtr<DecodePromise> Drain() override
   {
     MOZ_ASSERT(mTaskQueue->IsCurrentThreadIn());
     MOZ_ASSERT(!mIsShutdown);
     MOZ_ASSERT(mDecodePromise.IsEmpty() && !mDecodeRequest.Exists(),
                "Must wait for decoding to complete");