Bug 1379728 part 2. Add assertions to ensure we don't multiple-define events in our event name list. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Tue, 11 Jul 2017 17:49:25 -0400
changeset 368372 e3bb0b805eca79dce9c66f6d28cf69eecb87075f
parent 368371 efa1a50149e54b00f13e5c5818a92faacd0ea1bf
child 368373 ea84b4c23270b43d89841b79f94f4c5bb653d3f6
push id32162
push usercbook@mozilla.com
push dateWed, 12 Jul 2017 09:07:26 +0000
treeherdermozilla-central@09a4282d1172 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1379728
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1379728 part 2. Add assertions to ensure we don't multiple-define events in our event name list. r=smaug
dom/base/nsContentUtils.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -944,16 +944,18 @@ nsContentUtils::InitializeEventTable() {
   sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>(
       ArrayLength(eventArray));
   sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>(
       ArrayLength(eventArray));
   sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
 
   // Subtract one from the length because of the trailing null
   for (uint32_t i = 0; i < ArrayLength(eventArray) - 1; ++i) {
+    MOZ_ASSERT(!sAtomEventTable->Lookup(eventArray[i].mAtom),
+               "Double-defining event name; fix your EventNameList.h");
     sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]);
     if (ShouldAddEventToStringEventTable(eventArray[i])) {
       sStringEventTable->Put(
         Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
         eventArray[i]);
     }
   }