Bug 1130917 - Part 1 - disallow multiple records with the same name in GMPStorageChild::CreateRecord(). r=edwin a=lmandel
authorJW Wang <jwwang@mozilla.com>
Sun, 08 Feb 2015 20:37:18 +0800
changeset 250207 7a78fefaf5bd
parent 250206 706bf5c21e6d
child 250208 d02a943f7351
push id4521
push usercpearce@mozilla.com
push date2015-03-04 01:22 +0000
treeherdermozilla-beta@8abdbdecd2d6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersedwin, lmandel
bugs1130917
milestone37.0
Bug 1130917 - Part 1 - disallow multiple records with the same name in GMPStorageChild::CreateRecord(). r=edwin a=lmandel
dom/media/gmp/GMPStorageChild.cpp
--- a/dom/media/gmp/GMPStorageChild.cpp
+++ b/dom/media/gmp/GMPStorageChild.cpp
@@ -104,16 +104,21 @@ GMPStorageChild::CreateRecord(const nsCS
   MonitorAutoLock lock(mMonitor);
 
   if (mShutdown) {
     NS_WARNING("GMPStorage used after it's been shutdown!");
     return GMPClosedErr;
   }
 
   MOZ_ASSERT(aRecordName.Length() && aOutRecord);
+
+  if (HasRecord(aRecordName)) {
+    return GMPRecordInUse;
+  }
+
   nsRefPtr<GMPRecordImpl> record(new GMPRecordImpl(this, aRecordName, aClient));
   mRecords.Put(aRecordName, record); // Addrefs
 
   // The GMPRecord holds a self reference until the GMP calls Close() on
   // it. This means the object is always valid (even if neutered) while
   // the GMP expects it to be.
   record.forget(aOutRecord);