Bug 1276669 - Part 7: Don't register static atoms after the table has been sealed. r=erahm, a=ritu
authorNathan Froyd <froydnj@mozilla.com>
Thu, 26 Jan 2017 15:43:38 -0500
changeset 375824 829c02ed316aebbbe061ec5c9f066e3d681f646e
parent 375823 d5ccf239c1423f30e1a9ea1491a8ee7201ef199b
child 375825 712c0d0da7dce945cab161b7dcfa6e6ceec87ea3
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm, ritu
bugs1276669
milestone53.0a2
Bug 1276669 - Part 7: Don't register static atoms after the table has been sealed. r=erahm, a=ritu This change seems like an obvious thing we should have been doing, but we weren't.
xpcom/ds/nsAtomTable.cpp
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -590,17 +590,21 @@ GetAtomHashEntry(const char16_t* aString
   // This is an infallible add.
   return static_cast<AtomTableEntry*>(gAtomTable->Add(&key));
 }
 
 void
 RegisterStaticAtoms(const nsStaticAtom* aAtoms, uint32_t aAtomCount)
 {
   MutexAutoLock lock(*gAtomTableLock);
-  if (!gStaticAtomTable && !gStaticAtomTableSealed) {
+
+  MOZ_RELEASE_ASSERT(!gStaticAtomTableSealed,
+                     "Atom table has already been sealed!");
+
+  if (!gStaticAtomTable) {
     gStaticAtomTable = new StaticAtomTable();
   }
 
   for (uint32_t i = 0; i < aAtomCount; ++i) {
     nsStringBuffer* stringBuffer = aAtoms[i].mStringBuffer;
     nsIAtom** atomp = aAtoms[i].mAtom;
 
     MOZ_ASSERT(nsCRT::IsAscii(static_cast<char16_t*>(stringBuffer->Data())));