Last Comment Bug 760337 - Add JS_ASSERT(initialized()) where appropriate in HashTable.h
: Add JS_ASSERT(initialized()) where appropriate in HashTable.h
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: mozilla16
Assigned To: Nicholas Nethercote [:njn]
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2012-05-31 17:45 PDT by Nicholas Nethercote [:njn]
Modified: 2012-06-05 06:22 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (3.46 KB, patch)
2012-06-03 17:58 PDT, Nicholas Nethercote [:njn]
luke: review+
Details | Diff | Splinter Review

Description User image Nicholas Nethercote [:njn] 2012-05-31 17:45:37 PDT
Bug 710922 was caused by calling all() on a hash table that hadn't had init() called on it.  A |JS_ASSERT(initialized())| assertion inside all() would have caught it immediately.  There are probably other places where that assertion would also be helpful.
Comment 1 User image Nicholas Nethercote [:njn] 2012-06-03 17:58:14 PDT
Created attachment 629675 [details] [diff] [review]

This patch adds JS_ASSERT(table) to two sets of HashTable methods.  

- The first set definitely need it: findFreeEntry(), add(), two versions of
  remove(), all().

- The second set don't need it, but it seems like a good idea just to
  encourage people to init() their HashTables immediately:  empty(), 
  count(), capacity(), generation, sizeOf{In,Ex}cludingThis().
Comment 2 User image Luke Wagner [:luke] 2012-06-03 21:26:47 PDT
Comment on attachment 629675 [details] [diff] [review]

Looks good
Comment 3 User image Nicholas Nethercote [:njn] 2012-06-04 18:12:40 PDT
Comment 4 User image Geoff Lankow (:darktrojan) 2012-06-05 06:22:19 PDT

Note You need to log in before you can comment on or make changes to this bug.