Bug 734847 part 2 - treewide changes resulting from the default-infallibility of hashtables; either remove useless result checks, or use the fallible version of APIs, depending on context, r=jlebar
authorBenjamin Smedberg <benjamin@smedbergs.us>
Fri, 18 May 2012 13:30:49 -0400
changeset 94396 8300b50ca0982a3b1c2bed096538dc90bc851fb4
parent 94395 0afd21145f0a0f0719a788cbfe2f19c41ac51c98
child 94397 6a002ac9ea6c3a53dac656f47cdb759d84762a14
push id9586
push userbsmedberg@mozilla.com
push dateFri, 18 May 2012 18:15:42 +0000
treeherdermozilla-inbound@8300b50ca098 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjlebar
bugs734847
milestone15.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 734847 part 2 - treewide changes resulting from the default-infallibility of hashtables; either remove useless result checks, or use the fallible version of APIs, depending on context, r=jlebar
accessible/src/base/nsAccDocManager.cpp
accessible/src/base/nsDocAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeGridAccessible.cpp
browser/extensions/pdfjs/LICENSE
browser/extensions/pdfjs/README.mozilla
browser/extensions/pdfjs/bootstrap.js
browser/extensions/pdfjs/components/PdfStreamConverter.js
browser/extensions/pdfjs/content/web/debugger.js
browser/extensions/pdfjs/content/web/images/bookmark.svg
browser/extensions/pdfjs/content/web/images/check.svg
browser/extensions/pdfjs/content/web/images/comment.svg
browser/extensions/pdfjs/content/web/images/document-print.svg
browser/extensions/pdfjs/content/web/images/download.svg
browser/extensions/pdfjs/content/web/images/go-down.svg
browser/extensions/pdfjs/content/web/images/go-up.svg
browser/extensions/pdfjs/content/web/images/loading-icon.gif
browser/extensions/pdfjs/content/web/images/nav-outline.svg
browser/extensions/pdfjs/content/web/images/nav-thumbs.svg
browser/extensions/pdfjs/content/web/images/pin-down.svg
browser/extensions/pdfjs/content/web/images/pin-up.svg
browser/extensions/pdfjs/content/web/images/zoom-in.svg
browser/extensions/pdfjs/content/web/images/zoom-out.svg
browser/extensions/pdfjs/content/web/viewer-snippet-firefox-extension.html
browser/extensions/pdfjs/content/web/viewer.css
browser/extensions/pdfjs/content/web/viewer.html
browser/extensions/pdfjs/content/web/viewer.js
browser/extensions/pdfjs/extension-files
browser/extensions/pdfjs/icon.png
browser/extensions/pdfjs/icon64.png
browser/extensions/pdfjs/install.rdf.in
browser/extensions/pdfjs/test/Makefile.in
browser/extensions/pdfjs/test/browser_pdfjs_main.js
browser/extensions/pdfjs/test/file_pdfjs_test.pdf
chrome/src/nsChromeRegistry.cpp
chrome/src/nsChromeRegistryChrome.cpp
chrome/src/nsChromeRegistryChrome.h
chrome/src/nsChromeRegistryContent.cpp
content/base/src/nsContentUtils.cpp
content/base/src/nsCrossSiteListenerProxy.cpp
content/base/src/nsDOMAttributeMap.cpp
content/base/src/nsDocument.cpp
content/base/src/nsNameSpaceManager.cpp
content/events/src/nsDOMDataContainerEvent.cpp
content/html/content/src/nsHTMLFormElement.cpp
content/media/ogg/nsOggCodecState.cpp
content/media/ogg/nsOggReader.cpp
content/svg/content/src/nsSVGAttrTearoffTable.h
content/xbl/src/nsBindingManager.cpp
content/xbl/src/nsXBLBinding.cpp
content/xslt/src/xslt/txEXSLTFunctions.cpp
content/xslt/src/xslt/txExecutionState.cpp
content/xslt/src/xslt/txKeyFunctionCall.cpp
content/xul/document/src/nsXULDocument.cpp
content/xul/document/src/nsXULPrototypeCache.cpp
content/xul/templates/src/nsXULContentBuilder.cpp
content/xul/templates/src/nsXULTemplateBuilder.cpp
content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp
content/xul/templates/src/nsXULTreeBuilder.cpp
docshell/base/nsDocShell.cpp
dom/base/nsGlobalWindow.cpp
dom/indexedDB/DatabaseInfo.cpp
dom/indexedDB/FileManager.cpp
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/IndexedDatabaseManager.cpp
dom/indexedDB/TransactionThreadPool.cpp
dom/ipc/CrashReporterParent.cpp
dom/ipc/TabChild.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
dom/plugins/ipc/PluginModuleChild.cpp
dom/plugins/ipc/PluginModuleParent.cpp
dom/src/storage/nsDOMStorage.cpp
dom/src/storage/nsDOMStorageMemoryDB.cpp
dom/workers/RuntimeService.cpp
embedding/components/commandhandler/src/nsCommandManager.cpp
extensions/cookie/nsPermissionManager.cpp
extensions/spellcheck/hunspell/src/mozHunspell.cpp
extensions/spellcheck/src/mozPersonalDictionary.cpp
image/src/imgLoader.cpp
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/src/dombindings.cpp
js/xpconnect/src/xpcprivate.h
layout/base/RestyleTracker.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCounterManager.cpp
layout/base/nsLayoutHistoryState.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresArena.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresShell.cpp
layout/generic/TextOverflow.cpp
layout/inspector/src/nsFontFaceList.cpp
layout/style/Loader.cpp
layout/tables/nsTableFrame.cpp
layout/xul/base/src/nsBoxObject.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
modules/libjar/zipwriter/src/nsZipWriter.cpp
modules/libpref/src/Preferences.cpp
modules/libpref/src/nsPrefBranch.cpp
netwerk/base/src/nsProtocolProxyService.cpp
netwerk/cache/nsDiskCacheDeviceSQL.cpp
netwerk/dns/nsEffectiveTLDService.cpp
netwerk/protocol/res/nsResProtocolHandler.cpp
parser/html/nsHtml5AtomTable.h
parser/html/nsHtml5StringParser.cpp
rdf/base/src/nsRDFXMLSerializer.cpp
security/manager/boot/src/nsStrictTransportSecurityService.cpp
security/manager/ssl/src/nsCertOverrideService.cpp
security/manager/ssl/src/nsCertTree.cpp
security/manager/ssl/src/nsClientAuthRemember.cpp
storage/public/StatementCache.h
storage/src/mozStorageBindingParams.cpp
storage/src/mozStorageConnection.cpp
storage/src/mozStorageRow.cpp
toolkit/components/places/History.cpp
toolkit/components/places/nsFaviconService.cpp
toolkit/components/places/nsNavBookmarks.cpp
toolkit/components/places/nsNavHistory.cpp
toolkit/components/places/nsNavHistoryResult.cpp
toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
toolkit/crashreporter/nsExceptionHandler.cpp
widget/android/nsAppShell.cpp
xpcom/components/nsCategoryManager.cpp
xpcom/components/nsNativeComponentLoader.cpp
xpcom/ds/nsAtomTable.cpp
xpcom/ds/nsCheapSets.h
xpcom/ds/nsHashPropertyBag.cpp
xpcom/ds/nsProperties.cpp
xpcom/ds/nsProperties.h
xpcom/glue/nsBaseHashtable.h
xpcom/glue/nsCategoryCache.cpp
xpcom/glue/nsINIParser.cpp
xpcom/tests/TestHashtables.cpp
xpcom/threads/nsEnvironment.cpp
xpcom/threads/nsThreadManager.cpp
--- a/accessible/src/base/nsAccDocManager.cpp
+++ b/accessible/src/base/nsAccDocManager.cpp
@@ -390,18 +390,17 @@ nsAccDocManager::CreateDocOrRootAccessib
 
   // We only create root accessibles for the true root, otherwise create a
   // doc accessible.
   nsRefPtr<nsDocAccessible> docAcc = isRootDoc ?
     new RootAccessibleWrap(aDocument, rootElm, presShell) :
     new nsDocAccessibleWrap(aDocument, rootElm, presShell);
 
   // Cache the document accessible into document cache.
-  if (!docAcc || !mDocAccessibleCache.Put(aDocument, docAcc))
-    return nsnull;
+  mDocAccessibleCache.Put(aDocument, docAcc);
 
   // Initialize the document accessible.
   if (!docAcc->Init()) {
     docAcc->Shutdown();
     return nsnull;
   }
   docAcc->SetRoleMapEntry(aria::GetRoleMap(aDocument));
 
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1364,27 +1364,21 @@ nsDocAccessible::GetAccessibleOrContaine
 bool
 nsDocAccessible::BindToDocument(nsAccessible* aAccessible,
                                 nsRoleMapEntry* aRoleMapEntry)
 {
   if (!aAccessible)
     return false;
 
   // Put into DOM node cache.
-  if (aAccessible->IsPrimaryForNode() &&
-      !mNodeToAccessibleMap.Put(aAccessible->GetNode(), aAccessible))
-    return false;
+  if (aAccessible->IsPrimaryForNode())
+    mNodeToAccessibleMap.Put(aAccessible->GetNode(), aAccessible);
 
   // Put into unique ID cache.
-  if (!mAccessibleCache.Put(aAccessible->UniqueID(), aAccessible)) {
-    if (aAccessible->IsPrimaryForNode())
-      mNodeToAccessibleMap.Remove(aAccessible->GetNode());
-
-    return false;
-  }
+  mAccessibleCache.Put(aAccessible->UniqueID(), aAccessible);
 
   // Initialize the accessible.
   if (!aAccessible->Init()) {
     NS_ERROR("Failed to initialize an accessible!");
 
     UnbindFromDocument(aAccessible);
     return false;
   }
@@ -1616,20 +1610,17 @@ nsDocAccessible::AddDependentIDsFor(nsAc
       const nsDependentSubstring id = iter.NextID();
       if (id.IsEmpty())
         break;
 
       AttrRelProviderArray* providers = mDependentIDsHash.Get(id);
       if (!providers) {
         providers = new AttrRelProviderArray();
         if (providers) {
-          if (!mDependentIDsHash.Put(id, providers)) {
-            delete providers;
-            providers = nsnull;
-          }
+          mDependentIDsHash.Put(id, providers);
         }
       }
 
       if (providers) {
         AttrRelProvider* provider =
           new AttrRelProvider(relAttr, aRelProvider->GetContent());
         if (provider) {
           providers->AppendElement(provider);
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -569,22 +569,21 @@ nsXULTreeAccessible::GetTreeItemAccessib
 
   void *key = reinterpret_cast<void*>(aRow);
   nsAccessible* cachedTreeItem = mAccessibleCache.GetWeak(key);
   if (cachedTreeItem)
     return cachedTreeItem;
 
   nsRefPtr<nsAccessible> treeItem = CreateTreeItemAccessible(aRow);
   if (treeItem) {
-    if (mAccessibleCache.Put(key, treeItem)) {
-      if (Document()->BindToDocument(treeItem, nsnull))
-        return treeItem;
+    mAccessibleCache.Put(key, treeItem);
+    if (Document()->BindToDocument(treeItem, nsnull))
+      return treeItem;
 
-      mAccessibleCache.Remove(key);
-    }
+    mAccessibleCache.Remove(key);
   }
 
   return nsnull;
 }
 
 void
 nsXULTreeAccessible::InvalidateCache(PRInt32 aRow, PRInt32 aCount)
 {
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -727,22 +727,21 @@ nsXULTreeGridRowAccessible::GetCellAcces
   nsAccessible* cachedCell = mAccessibleCache.GetWeak(key);
   if (cachedCell)
     return cachedCell;
 
   nsRefPtr<nsAccessible> cell =
     new nsXULTreeGridCellAccessibleWrap(mContent, mDoc, this, mTree,
                                         mTreeView, mRow, aColumn);
   if (cell) {
-    if (mAccessibleCache.Put(key, cell)) {
-      if (Document()->BindToDocument(cell, nsnull))
-        return cell;
+    mAccessibleCache.Put(key, cell);
+    if (Document()->BindToDocument(cell, nsnull))
+      return cell;
 
-      mAccessibleCache.Remove(key);
-    }
+    mAccessibleCache.Remove(key);
   }
 
   return nsnull;
 }
 
 void
 nsXULTreeGridRowAccessible::RowInvalidated(PRInt32 aStartColIdx,
                                            PRInt32 aEndColIdx)
--- a/chrome/src/nsChromeRegistry.cpp
+++ b/chrome/src/nsChromeRegistry.cpp
@@ -170,18 +170,17 @@ nsChromeRegistry::GetService()
   }
   NS_ADDREF(gChromeRegistry);
   return gChromeRegistry;
 }
 
 nsresult
 nsChromeRegistry::Init()
 {
-  if (!mOverrideTable.Init())
-    return NS_ERROR_FAILURE;
+  mOverrideTable.Init();
 
   // This initialization process is fairly complicated and may cause reentrant
   // getservice calls to resolve chrome URIs (especially locale files). We
   // don't want that, so we inform the protocol handler about our existence
   // before we are actually fully initialized.
   gChromeRegistry = this;
 
   mInitialized = true;
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -150,19 +150,18 @@ nsChromeRegistryChrome::~nsChromeRegistr
 
 nsresult
 nsChromeRegistryChrome::Init()
 {
   nsresult rv = nsChromeRegistry::Init();
   if (NS_FAILED(rv))
     return rv;
 
-  if (!mOverlayHash.Init() ||
-      !mStyleHash.Init())
-    return NS_ERROR_FAILURE;
+  mOverlayHash.Init();
+  mStyleHash.Init();
   
   mSelectedLocale = NS_LITERAL_CSTRING("en-US");
   mSelectedSkin = NS_LITERAL_CSTRING("classic/1.0");
 
   if (!PL_DHashTableInit(&mPackagesHash, &kTableOps,
                          nsnull, sizeof(PackageEntry), 16))
     return NS_ERROR_FAILURE;
 
--- a/chrome/src/nsChromeRegistryChrome.h
+++ b/chrome/src/nsChromeRegistryChrome.h
@@ -166,17 +166,17 @@ class nsChromeRegistryChrome : public ns
   };
 
   class OverlayListHash
   {
    public:
     OverlayListHash() { }
     ~OverlayListHash() { }
 
-    bool Init() { return mTable.Init(); }
+    void Init() { mTable.Init(); }
     void Add(nsIURI* aBase, nsIURI* aOverlay);
     void Clear() { mTable.Clear(); }
     const nsCOMArray<nsIURI>* GetArray(nsIURI* aBase);
 
    private:
     nsTHashtable<OverlayListEntry> mTable;
   };
 
--- a/chrome/src/nsChromeRegistryContent.cpp
+++ b/chrome/src/nsChromeRegistryContent.cpp
@@ -112,19 +112,17 @@ nsChromeRegistryContent::RegisterPackage
   }
 
   PackageEntry* entry = new PackageEntry;
   entry->flags = aPackage.flags;
   entry->contentBaseURI = content;
   entry->localeBaseURI = locale;
   entry->skinBaseURI = skin;
 
-  nsresult rv = mPackagesHash.Put(aPackage.package, entry);
-  if (NS_FAILED(rv))
-    return;
+  mPackagesHash.Put(aPackage.package, entry);
 }
 
 void
 nsChromeRegistryContent::RegisterResource(const ResourceMapping& aResource)
 {
   nsCOMPtr<nsIIOService> io (do_GetIOService());
   if (!io)
     return;
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -543,40 +543,24 @@ nsContentUtils::InitializeEventTable() {
 #undef WINDOW_ONLY_EVENT
 #undef EVENT
     { nsnull }
   };
 
   sAtomEventTable = new nsDataHashtable<nsISupportsHashKey, EventNameMapping>;
   sStringEventTable = new nsDataHashtable<nsStringHashKey, EventNameMapping>;
   sUserDefinedEvents = new nsCOMArray<nsIAtom>(64);
-
-  if (!sAtomEventTable || !sStringEventTable || !sUserDefinedEvents ||
-      !sAtomEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1) ||
-      !sStringEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1)) {
-    delete sAtomEventTable;
-    sAtomEventTable = nsnull;
-    delete sStringEventTable;
-    sStringEventTable = nsnull;
-    delete sUserDefinedEvents;
-    sUserDefinedEvents = nsnull;
-    return false;
-  }
+  sAtomEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1);
+  sStringEventTable->Init(int(ArrayLength(eventArray) / 0.75) + 1);
 
   // Subtract one from the length because of the trailing null
   for (PRUint32 i = 0; i < ArrayLength(eventArray) - 1; ++i) {
-    if (!sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]) ||
-        !sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
-                                eventArray[i])) {
-      delete sAtomEventTable;
-      sAtomEventTable = nsnull;
-      delete sStringEventTable;
-      sStringEventTable = nsnull;
-      return false;
-    }
+    sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]);
+    sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2),
+                           eventArray[i]);
   }
 
   return true;
 }
 
 void
 nsContentUtils::InitializeTouchEventTable()
 {
@@ -589,25 +573,19 @@ nsContentUtils::InitializeTouchEventTabl
       { nsGkAtoms::on##name_, _id, _type, _struct },
 #include "nsEventNameList.h"
 #undef TOUCH_EVENT
 #undef EVENT
       { nsnull }
     };
     // Subtract one from the length because of the trailing null
     for (PRUint32 i = 0; i < ArrayLength(touchEventArray) - 1; ++i) {
-      if (!sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]) ||
-          !sStringEventTable->Put(Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
-                                  touchEventArray[i])) {
-        delete sAtomEventTable;
-        sAtomEventTable = nsnull;
-        delete sStringEventTable;
-        sStringEventTable = nsnull;
-        return;
-      }
+      sAtomEventTable->Put(touchEventArray[i].mAtom, touchEventArray[i]);
+      sStringEventTable->Put(Substring(nsDependentAtomString(touchEventArray[i].mAtom), 2),
+                             touchEventArray[i]);
     }
   }
 }
 
 static bool
 Is8bit(const nsAString& aString)
 {
   static const PRUnichar EIGHT_BIT = PRUnichar(~0x00FF);
--- a/content/base/src/nsCrossSiteListenerProxy.cpp
+++ b/content/base/src/nsCrossSiteListenerProxy.cpp
@@ -108,17 +108,18 @@ public:
   ~nsPreflightCache()
   {
     Clear();
     MOZ_COUNT_DTOR(nsPreflightCache);
   }
 
   bool Initialize()
   {
-    return mTable.Init();
+    mTable.Init();
+    return true;
   }
 
   CacheEntry* GetEntry(nsIURI* aURI, nsIPrincipal* aPrincipal,
                        bool aWithCredentials, bool aCreate);
   void RemoveEntries(nsIURI* aURI, nsIPrincipal* aPrincipal);
 
   void Clear();
 
@@ -255,24 +256,17 @@ nsPreflightCache::GetEntry(nsIURI* aURI,
       // This will delete 'lruEntry'.
       mTable.Remove(lruEntry->mKey);
 
       NS_ASSERTION(mTable.Count() == PREFLIGHT_CACHE_SIZE - 1,
                    "Somehow tried to remove an entry that was never added!");
     }
   }
   
-  if (!mTable.Put(key, entry)) {
-    // Failed, clean up the new entry.
-    delete entry;
-
-    NS_WARNING("Failed to add entry to the CORS preflight cache!");
-    return nsnull;
-  }
-
+  mTable.Put(key, entry);
   PR_INSERT_LINK(entry, &mList);
 
   return entry;
 }
 
 void
 nsPreflightCache::RemoveEntries(nsIURI* aURI, nsIPrincipal* aPrincipal)
 {
--- a/content/base/src/nsDOMAttributeMap.cpp
+++ b/content/base/src/nsDOMAttributeMap.cpp
@@ -60,17 +60,18 @@ nsDOMAttributeMap::nsDOMAttributeMap(Ele
 {
   // We don't add a reference to our content. If it goes away,
   // we'll be told to drop our reference
 }
 
 bool
 nsDOMAttributeMap::Init()
 {
-  return mAttributeCache.Init();
+  mAttributeCache.Init();
+  return true;
 }
 
 /**
  * Clear map pointer for attributes.
  */
 PLDHashOperator
 RemoveMapRef(nsAttrHashKey::KeyType aKey, nsRefPtr<nsDOMAttribute>& aData,
              void* aUserArg)
@@ -207,19 +208,18 @@ nsDOMAttributeMap::GetAttribute(nsINodeI
 
   nsAttrKey attr(aNodeInfo->NamespaceID(), aNodeInfo->NameAtom());
 
   nsDOMAttribute* node = mAttributeCache.GetWeak(attr);
   if (!node) {
     nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
     nsRefPtr<nsDOMAttribute> newAttr =
       new nsDOMAttribute(this, ni.forget(), EmptyString(), aNsAware);
-    if (newAttr && mAttributeCache.Put(attr, newAttr)) {
-      node = newAttr;
-    }
+    mAttributeCache.Put(attr, newAttr);
+    node = newAttr;
   }
 
   return node;
 }
 
 nsDOMAttribute*
 nsDOMAttributeMap::GetNamedItem(const nsAString& aAttrName, nsresult *aResult)
 {
@@ -347,18 +347,17 @@ nsDOMAttributeMap::SetNamedItemInternal(
     }
 
     nsAutoString value;
     attribute->GetValue(value);
 
     // Add the new attribute to the attribute map before updating
     // its value in the element. @see bug 364413.
     nsAttrKey attrkey(ni->NamespaceID(), ni->NameAtom());
-    rv = mAttributeCache.Put(attrkey, attribute);
-    NS_ENSURE_SUCCESS(rv, rv);
+    mAttributeCache.Put(attrkey, attribute);
     iAttribute->SetMap(this);
 
     rv = mContent->SetAttr(ni->NamespaceID(), ni->NameAtom(),
                            ni->GetPrefixAtom(), value, true);
     if (NS_FAILED(rv)) {
       DropAttribute(ni->NamespaceID(), ni->NameAtom());
     }
   }
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -721,19 +721,17 @@ nsExternalResourceMap::RequestResource(n
   mPendingLoads.Get(clone, getter_AddRefs(load));
   if (load) {
     load.forget(aPendingLoad);
     return nsnull;
   }
 
   load = new PendingLoad(aDisplayDocument);
 
-  if (!mPendingLoads.Put(clone, load)) {
-    return nsnull;
-  }
+  mPendingLoads.Put(clone, load);
 
   if (NS_FAILED(load->StartLoad(clone, aRequestingNode))) {
     // Make sure we don't thrash things by trying this load again, since
     // chances are it failed for good reasons (security check, etc).
     AddExternalResource(clone, nsnull, nsnull, aDisplayDocument);
   } else {
     load.forget(aPendingLoad);
   }
@@ -915,32 +913,24 @@ nsExternalResourceMap::AddExternalResour
     if (NS_FAILED(rv)) {
       doc = nsnull;
       aViewer = nsnull;
       aLoadGroup = nsnull;
     }
   }
 
   ExternalResource* newResource = new ExternalResource();
-  if (newResource && !mMap.Put(aURI, newResource)) {
-    delete newResource;
-    newResource = nsnull;
-    if (NS_SUCCEEDED(rv)) {
-      rv = NS_ERROR_OUT_OF_MEMORY;
-    }
-  }
-
-  if (newResource) {
-    newResource->mDocument = doc;
-    newResource->mViewer = aViewer;
-    newResource->mLoadGroup = aLoadGroup;
-    if (doc) {
-      TransferZoomLevels(aDisplayDocument, doc);
-      TransferShowingState(aDisplayDocument, doc);
-    }
+  mMap.Put(aURI, newResource);
+
+  newResource->mDocument = doc;
+  newResource->mViewer = aViewer;
+  newResource->mLoadGroup = aLoadGroup;
+  if (doc) {
+    TransferZoomLevels(aDisplayDocument, doc);
+    TransferShowingState(aDisplayDocument, doc);
   }
 
   const nsTArray< nsCOMPtr<nsIObserver> > & obs = load->Observers();
   for (PRUint32 i = 0; i < obs.Length(); ++i) {
     obs[i]->Observe(doc, "external-resource-document-created", nsnull);
   }
 
   return rv;
@@ -1995,17 +1985,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 nsresult
 nsDocument::Init()
 {
   if (mCSSLoader || mNodeInfoManager || mScriptLoader) {
     return NS_ERROR_ALREADY_INITIALIZED;
   }
 
   mIdentifierMap.Init();
-  (void)mStyledLinks.Init();
+  mStyledLinks.Init();
   mRadioGroups.Init();
 
   // Force initialization.
   nsINode::nsSlots* slots = GetSlots();
   NS_ENSURE_TRUE(slots,NS_ERROR_OUT_OF_MEMORY);
 
   // Prepend self as mutation-observer whether we need it or not (some
   // subclasses currently do, other don't). This is because the code in
@@ -2036,20 +2026,18 @@ nsDocument::Init()
   NS_ABORT_IF_FALSE(mNodeInfo->NodeType() == nsIDOMNode::DOCUMENT_NODE,
                     "Bad NodeType in aNodeInfo");
 
   NS_ASSERTION(OwnerDoc() == this, "Our nodeinfo is busted!");
 
   mScriptLoader = new nsScriptLoader(this);
   NS_ENSURE_TRUE(mScriptLoader, NS_ERROR_OUT_OF_MEMORY);
 
-  if (!mImageTracker.Init() ||
-      !mPlugins.Init()) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  mImageTracker.Init();
+  mPlugins.Init();
 
   return NS_OK;
 }
 
 void 
 nsIDocument::DeleteAllProperties()
 {
   for (PRUint32 i = 0; i < GetPropertyTableCount(); ++i) {
@@ -5350,19 +5338,17 @@ nsDocument::GetBoxObjectFor(nsIDOMElemen
                                     nsContentUtils::eDOM_PROPERTIES,
                                     "UseOfGetBoxObjectForWarning");
   }
 
   *aResult = nsnull;
 
   if (!mBoxObjectTable) {
     mBoxObjectTable = new nsInterfaceHashtable<nsPtrHashKey<nsIContent>, nsPIBoxObject>;
-    if (mBoxObjectTable && !mBoxObjectTable->Init(12)) {
-      mBoxObjectTable = nsnull;
-    }
+    mBoxObjectTable->Init(12);
   } else {
     // Want to use Get(content, aResult); but it's the wrong type
     *aResult = mBoxObjectTable->GetWeak(content);
     if (*aResult) {
       NS_ADDREF(*aResult);
       return NS_OK;
     }
   }
@@ -6497,17 +6483,17 @@ nsDocument::GetRadioGroup(const nsAStrin
   }
 
   nsRadioGroupStruct* radioGroup;
   if (mRadioGroups.Get(tmKey, &radioGroup)) {
     return radioGroup;
   }
 
   nsAutoPtr<nsRadioGroupStruct> newRadioGroup(new nsRadioGroupStruct());
-  NS_ENSURE_TRUE(mRadioGroups.Put(tmKey, newRadioGroup), nsnull);
+  mRadioGroups.Put(tmKey, newRadioGroup);
 
   return newRadioGroup.forget();
 }
 
 NS_IMETHODIMP
 nsDocument::SetCurrentRadioButton(const nsAString& aName,
                                   nsIDOMHTMLInputElement* aRadio)
 {
@@ -8280,19 +8266,17 @@ nsDocument::AddImage(imgIRequest* aImage
 {
   NS_ENSURE_ARG_POINTER(aImage);
 
   // See if the image is already in the hashtable. If it is, get the old count.
   PRUint32 oldCount = 0;
   mImageTracker.Get(aImage, &oldCount);
 
   // Put the image in the hashtable, with the proper count.
-  bool success = mImageTracker.Put(aImage, oldCount + 1);
-  if (!success)
-    return NS_ERROR_OUT_OF_MEMORY;
+  mImageTracker.Put(aImage, oldCount + 1);
 
   nsresult rv = NS_OK;
 
   // If this is the first insertion and we're locking images, lock this image
   // too.
   if (oldCount == 0 && mLockingImages) {
     rv = aImage->LockImage();
     if (NS_SUCCEEDED(rv))
--- a/content/base/src/nsNameSpaceManager.cpp
+++ b/content/base/src/nsNameSpaceManager.cpp
@@ -135,19 +135,19 @@ private:
 };
 
 static NameSpaceManagerImpl* sNameSpaceManager = nsnull;
 
 NS_IMPL_ISUPPORTS1(NameSpaceManagerImpl, nsINameSpaceManager)
 
 nsresult NameSpaceManagerImpl::Init()
 {
-  nsresult rv = mURIToIDTable.Init(32);
-  NS_ENSURE_SUCCESS(rv, rv);
+  mURIToIDTable.Init(32);
 
+  nsresult rv;
 #define REGISTER_NAMESPACE(uri, id) \
   rv = AddNameSpace(NS_LITERAL_STRING(uri), id); \
   NS_ENSURE_SUCCESS(rv, rv)
 
   // Need to be ordered according to ID.
   REGISTER_NAMESPACE(kXMLNSNameSpaceURI, kNameSpaceID_XMLNS);
   REGISTER_NAMESPACE(kXMLNameSpaceURI, kNameSpaceID_XML);
   REGISTER_NAMESPACE(kXHTMLNameSpaceURI, kNameSpaceID_XHTML);
@@ -283,21 +283,17 @@ nsresult NameSpaceManagerImpl::AddNameSp
                "BAD! AddNameSpace not called in right order!");
 
   nsString* uri = new nsString(aURI);
   if (!uri || !mURIArray.AppendElement(uri)) {
     delete uri;
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
-  if (!mURIToIDTable.Put(uri, aNameSpaceID)) {
-    mURIArray.RemoveElementAt(aNameSpaceID - 1);
-
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  mURIToIDTable.Put(uri, aNameSpaceID);
 
   return NS_OK;
 }
 
 nsresult
 NS_GetNameSpaceManager(nsINameSpaceManager** aInstancePtrResult)
 {
   NS_ENSURE_ARG_POINTER(aInstancePtrResult);
--- a/content/events/src/nsDOMDataContainerEvent.cpp
+++ b/content/events/src/nsDOMDataContainerEvent.cpp
@@ -84,17 +84,18 @@ nsDOMDataContainerEvent::GetData(const n
 NS_IMETHODIMP
 nsDOMDataContainerEvent::SetData(const nsAString& aKey, nsIVariant *aData)
 {
   NS_ENSURE_ARG(aData);
 
   // Make sure this event isn't already being dispatched.
   NS_ENSURE_STATE(!(NS_IS_EVENT_IN_DISPATCH(mEvent)));
   NS_ENSURE_STATE(mData.IsInitialized());
-  return mData.Put(aKey, aData) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  mData.Put(aKey, aData);
+  return NS_OK;
 }
 
 nsresult
 NS_NewDOMDataContainerEvent(nsIDOMEvent** aInstancePtrResult,
                    nsPresContext* aPresContext,
                    nsEvent* aEvent)
 {
   nsDOMDataContainerEvent* it =
--- a/content/html/content/src/nsHTMLFormElement.cpp
+++ b/content/html/content/src/nsHTMLFormElement.cpp
@@ -284,22 +284,19 @@ nsHTMLFormElement::Init()
   nsresult rv = mControls->Init();
   
   if (NS_FAILED(rv))
   {
     mControls = nsnull;
     return rv;
   }
   
-  NS_ENSURE_TRUE(mSelectedRadioButtons.Init(4),
-                 NS_ERROR_OUT_OF_MEMORY);
-  NS_ENSURE_TRUE(mRequiredRadioButtonCounts.Init(4),
-                 NS_ERROR_OUT_OF_MEMORY);
-  NS_ENSURE_TRUE(mValueMissingRadioGroups.Init(4),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mSelectedRadioButtons.Init(4);
+  mRequiredRadioButtonCounts.Init(4);
+  mValueMissingRadioGroups.Init(4);
 
   return NS_OK;
 }
 
 
 // nsISupports
 
 static PLDHashOperator
@@ -1889,18 +1886,17 @@ nsHTMLFormElement::IndexOfControl(nsIFor
   PRInt32 index = nsnull;
   return mControls->IndexOfControl(aControl, &index) == NS_OK ? index : nsnull;
 }
 
 NS_IMETHODIMP
 nsHTMLFormElement::SetCurrentRadioButton(const nsAString& aName,
                                          nsIDOMHTMLInputElement* aRadio)
 {
-  NS_ENSURE_TRUE(mSelectedRadioButtons.Put(aName, aRadio),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mSelectedRadioButtons.Put(aName, aRadio);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLFormElement::GetCurrentRadioButton(const nsAString& aName,
                                          nsIDOMHTMLInputElement** aRadio)
 {
@@ -2139,20 +2135,17 @@ nsFormControlList::nsFormControlList(nsH
 nsFormControlList::~nsFormControlList()
 {
   mForm = nsnull;
   Clear();
 }
 
 nsresult nsFormControlList::Init()
 {
-  NS_ENSURE_TRUE(
-    mNameLookupTable.Init(NS_FORM_CONTROL_LIST_HASHTABLE_SIZE),
-    NS_ERROR_OUT_OF_MEMORY);
-
+  mNameLookupTable.Init(NS_FORM_CONTROL_LIST_HASHTABLE_SIZE);
   return NS_OK;
 }
 
 void
 nsFormControlList::DropFormReference()
 {
   mForm = nsnull;
   Clear();
@@ -2305,19 +2298,17 @@ nsFormControlList::AddElementToTable(nsG
     return NS_OK;
   }
 
   nsCOMPtr<nsISupports> supports;
   mNameLookupTable.Get(aName, getter_AddRefs(supports));
 
   if (!supports) {
     // No entry found, add the form control
-    NS_ENSURE_TRUE(mNameLookupTable.Put(aName,
-                                        NS_ISUPPORTS_CAST(nsIContent*, aChild)),
-                   NS_ERROR_FAILURE);
+    mNameLookupTable.Put(aName, NS_ISUPPORTS_CAST(nsIContent*, aChild));
   } else {
     // Found something in the hash, check its type
     nsCOMPtr<nsIContent> content = do_QueryInterface(supports);
 
     if (content) {
       // Check if the new content is the same as the one we found in the
       // hash, if it is then we leave it in the hash as it is, this will
       // happen if a form control has both a name and an id with the same
@@ -2340,18 +2331,17 @@ nsFormControlList::AddElementToTable(nsG
 
       list->AppendElement(newFirst ? aChild : content);
       list->AppendElement(newFirst ? content : aChild);
 
 
       nsCOMPtr<nsISupports> listSupports = do_QueryObject(list);
 
       // Replace the element with the list.
-      NS_ENSURE_TRUE(mNameLookupTable.Put(aName, listSupports),
-                     NS_ERROR_FAILURE);
+      mNameLookupTable.Put(aName, listSupports);
     } else {
       // There's already a list in the hash, add the child to the list
       nsCOMPtr<nsIDOMNodeList> nodeList = do_QueryInterface(supports);
       NS_ENSURE_TRUE(nodeList, NS_ERROR_FAILURE);
 
       // Upcast, uggly, but it works!
       nsSimpleContentList *list =
         static_cast<nsSimpleContentList*>(nodeList.get());
@@ -2450,17 +2440,17 @@ nsFormControlList::RemoveElementFromTabl
     // If the list is empty we remove if from our hash, this shouldn't
     // happen tho
     mNameLookupTable.Remove(aName);
   } else if (length == 1) {
     // Only one element left, replace the list in the hash with the
     // single element.
     nsIContent* node = list->GetNodeAt(0);
     if (node) {
-      NS_ENSURE_TRUE(mNameLookupTable.Put(aName, node),NS_ERROR_FAILURE);
+      mNameLookupTable.Put(aName, node);
     }
   }
 
   return NS_OK;
 }
 
 nsresult
 nsFormControlList::GetSortedControls(nsTArray<nsGenericHTMLFormElement*>& aControls) const
--- a/content/media/ogg/nsOggCodecState.cpp
+++ b/content/media/ogg/nsOggCodecState.cpp
@@ -1258,22 +1258,17 @@ bool nsSkeletonState::DecodeHeader(ogg_p
     }
 
     // Extract the segment length.
     mLength = LEInt64(aPacket->packet + SKELETON_FILE_LENGTH_OFFSET);
 
     LOG(PR_LOG_DEBUG, ("Skeleton segment length: %lld", mLength));
 
     // Initialize the serianlno-to-index map.
-    bool init = mIndex.Init();
-    if (!init) {
-      NS_WARNING("Failed to initialize Ogg skeleton serialno-to-index map");
-      mActive = false;
-      return mDoneReadingHeaders = true;
-    }
+    mIndex.Init();
     mActive = true;
   } else if (IsSkeletonIndex(aPacket) && mVersion >= SKELETON_VERSION(4,0)) {
     if (!DecodeIndex(aPacket)) {
       // Failed to parse index, or invalid/hostile index. DecodeIndex() will
       // have deactivated the track.
       return mDoneReadingHeaders = true;
     }
 
--- a/content/media/ogg/nsOggReader.cpp
+++ b/content/media/ogg/nsOggReader.cpp
@@ -121,21 +121,17 @@ nsOggReader::nsOggReader(nsBuiltinDecode
 
 nsOggReader::~nsOggReader()
 {
   ogg_sync_clear(&mOggState);
   MOZ_COUNT_DTOR(nsOggReader);
 }
 
 nsresult nsOggReader::Init(nsBuiltinDecoderReader* aCloneDonor) {
-  bool init = mCodecStates.Init();
-  NS_ASSERTION(init, "Failed to initialize mCodecStates");
-  if (!init) {
-    return NS_ERROR_FAILURE;
-  }
+  mCodecStates.Init();
   int ret = ogg_sync_init(&mOggState);
   NS_ENSURE_TRUE(ret == 0, NS_ERROR_FAILURE);
   return NS_OK;
 }
 
 nsresult nsOggReader::ResetDecode()
 {
   NS_ASSERTION(mDecoder->OnDecodeThread(), "Should be on decode thread.");
@@ -200,18 +196,17 @@ nsresult nsOggReader::ReadMetadata(nsVid
       // can follow in this Ogg segment, so there will be no other bitstreams
       // in the Ogg (unless it's invalid).
       readAllBOS = true;
     } else if (!mCodecStates.Get(serial, nsnull)) {
       // We've not encountered a stream with this serial number before. Create
       // an nsOggCodecState to demux it, and map that to the nsOggCodecState
       // in mCodecStates.
       codecState = nsOggCodecState::Create(&page);
-      DebugOnly<bool> r = mCodecStates.Put(serial, codecState);
-      NS_ASSERTION(r, "Failed to insert into mCodecStates");
+      mCodecStates.Put(serial, codecState);
       bitstreams.AppendElement(codecState);
       mKnownStreams.AppendElement(serial);
       if (codecState &&
           codecState->GetType() == nsOggCodecState::TYPE_VORBIS &&
           !mVorbisState)
       {
         // First Vorbis bitstream, we'll play this one. Subsequent Vorbis
         // bitstreams will be ignored.
--- a/content/svg/content/src/nsSVGAttrTearoffTable.h
+++ b/content/svg/content/src/nsSVGAttrTearoffTable.h
@@ -99,21 +99,17 @@ nsSVGAttrTearoffTable<SimpleType, Tearof
 
   // We shouldn't be adding a tear-off if there already is one. If that happens,
   // something is wrong.
   if (mTable.Get(aSimple, nsnull)) {
     NS_ABORT_IF_FALSE(false, "There is already a tear-off for this object.");
     return;
   }
 
-#ifdef DEBUG
-  bool result =
-#endif
-    mTable.Put(aSimple, aTearoff);
-  NS_ABORT_IF_FALSE(result, "Out of memory.");
+  mTable.Put(aSimple, aTearoff);
 }
 
 template<class SimpleType, class TearoffType>
 void
 nsSVGAttrTearoffTable<SimpleType, TearoffType>::RemoveTearoff(
     SimpleType* aSimple)
 {
   if (!mTable.IsInitialized()) {
--- a/content/xbl/src/nsBindingManager.cpp
+++ b/content/xbl/src/nsBindingManager.cpp
@@ -549,18 +549,17 @@ nsBindingManager::GetBinding(nsIContent*
 
   return nsnull;
 }
 
 nsresult
 nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
 {
   if (!mBindingTable.IsInitialized()) {
-    if (!mBindingTable.Init())
-      return NS_ERROR_OUT_OF_MEMORY;
+    mBindingTable.Init();
   }
 
   // After this point, aBinding will be the most-derived binding for aContent.
   // If we already have a binding for aContent in our table, make sure to
   // remove it from the attached stack.  Otherwise we might end up firing its
   // constructor twice (if aBinding inherits from it) or firing its constructor
   // after aContent has been deleted (if aBinding is null and the content node
   // dies before we process mAttachedStack).
@@ -579,36 +578,34 @@ nsBindingManager::SetBinding(nsIContent*
     // Don't remove items here as that could mess up an executing
     // ProcessAttachedQueue
     PRUint32 index = mAttachedStack.IndexOf(oldBinding);
     if (index != mAttachedStack.NoIndex) {
       mAttachedStack[index] = nsnull;
     }
   }
   
-  bool result = true;
-
   if (aBinding) {
     aContent->SetFlags(NODE_MAY_BE_IN_BINDING_MNGR);
-    result = mBindingTable.Put(aContent, aBinding);
+    mBindingTable.Put(aContent, aBinding);
   } else {
     mBindingTable.Remove(aContent);
 
     // The death of the bindings means the death of the JS wrapper,
     // and the flushing of our explicit and anonymous insertion point
     // lists.
     SetWrappedJS(aContent, nsnull);
     SetContentListFor(aContent, nsnull);
     SetAnonymousNodesFor(aContent, nsnull);
     if (oldBinding) {
       oldBinding->SetBoundElement(nsnull);
     }
   }
 
-  return result ? NS_OK : NS_ERROR_FAILURE;
+  return NS_OK;
 }
 
 nsIContent*
 nsBindingManager::GetInsertionParent(nsIContent* aContent)
 { 
   if (mInsertionParentTable.ops) {
     return static_cast<nsIContent*>
                       (LookupObject(mInsertionParentTable, aContent));
@@ -1096,22 +1093,21 @@ nsBindingManager::ExecuteDetachedHandler
   }
 }
 
 nsresult
 nsBindingManager::PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
 {
   NS_PRECONDITION(aDocumentInfo, "Must have a non-null documentinfo!");
   
-  NS_ENSURE_TRUE(mDocumentTable.IsInitialized() || mDocumentTable.Init(16),
-                 NS_ERROR_OUT_OF_MEMORY);
+  if (!mDocumentTable.IsInitialized())
+    mDocumentTable.Init(16);
 
-  NS_ENSURE_TRUE(mDocumentTable.Put(aDocumentInfo->DocumentURI(),
-                                    aDocumentInfo),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mDocumentTable.Put(aDocumentInfo->DocumentURI(),
+                     aDocumentInfo);
 
   return NS_OK;
 }
 
 void
 nsBindingManager::RemoveXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
 {
   if (mDocumentTable.IsInitialized()) {
@@ -1128,21 +1124,20 @@ nsBindingManager::GetXBLDocumentInfo(nsI
   return mDocumentTable.GetWeak(aURL);
 }
 
 nsresult
 nsBindingManager::PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener)
 {
   NS_PRECONDITION(aListener, "Must have a non-null listener!");
   
-  NS_ENSURE_TRUE(mLoadingDocTable.IsInitialized() || mLoadingDocTable.Init(16),
-                 NS_ERROR_OUT_OF_MEMORY);
+  if (!mLoadingDocTable.IsInitialized())
+    mLoadingDocTable.Init(16);
   
-  NS_ENSURE_TRUE(mLoadingDocTable.Put(aURL, aListener),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mLoadingDocTable.Put(aURL, aListener);
 
   return NS_OK;
 }
 
 nsIStreamListener*
 nsBindingManager::GetLoadingDocListener(nsIURI* aURL)
 {
   if (!mLoadingDocTable.IsInitialized())
@@ -1350,18 +1345,19 @@ static PLDHashOperator
 EnumRuleProcessors(nsISupports *aKey, nsXBLBinding *aBinding, void* aClosure)
 {
   RuleProcessorSet *set = static_cast<RuleProcessorSet*>(aClosure);
   for (nsXBLBinding *binding = aBinding; binding;
        binding = binding->GetBaseBinding()) {
     nsIStyleRuleProcessor *ruleProc =
       binding->PrototypeBinding()->GetRuleProcessor();
     if (ruleProc) {
-      if (!set->IsInitialized() && !set->Init(16))
-        return PL_DHASH_STOP;
+      if (!set->IsInitialized()) {
+        set->Init(16);
+      }
       set->PutEntry(ruleProc);
     }
   }
   return PL_DHASH_NEXT;
 }
 
 struct WalkAllRulesData {
   nsIStyleRuleProcessor::EnumFunc mFunc;
--- a/content/xbl/src/nsXBLBinding.cpp
+++ b/content/xbl/src/nsXBLBinding.cpp
@@ -1433,32 +1433,24 @@ nsXBLBinding::HasInsertionParent(nsICont
 
 nsresult
 nsXBLBinding::GetInsertionPointsFor(nsIContent* aParent,
                                     nsInsertionPointList** aResult)
 {
   if (!mInsertionPointTable) {
     mInsertionPointTable =
       new nsClassHashtable<nsISupportsHashKey, nsInsertionPointList>;
-    if (!mInsertionPointTable || !mInsertionPointTable->Init(4)) {
-      delete mInsertionPointTable;
-      mInsertionPointTable = nsnull;
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mInsertionPointTable->Init(4);
   }
 
   mInsertionPointTable->Get(aParent, aResult);
 
   if (!*aResult) {
     *aResult = new nsInsertionPointList;
-    if (!*aResult || !mInsertionPointTable->Put(aParent, *aResult)) {
-      delete *aResult;
-      *aResult = nsnull;
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mInsertionPointTable->Put(aParent, *aResult);
     if (aParent) {
       aParent->SetFlags(NODE_IS_INSERTION_PARENT);
     }
   }
 
   return NS_OK;
 }
 
--- a/content/xslt/src/xslt/txEXSLTFunctions.cpp
+++ b/content/xslt/src/xslt/txEXSLTFunctions.cpp
@@ -402,29 +402,25 @@ txEXSLTFunctionCall::evaluate(txIEvalCon
                                    getter_AddRefs(nodes));
             NS_ENSURE_SUCCESS(rv, rv);
 
             nsRefPtr<txNodeSet> resultSet;
             rv = aContext->recycler()->getNodeSet(getter_AddRefs(resultSet));
             NS_ENSURE_SUCCESS(rv, rv);
 
             nsTHashtable<nsStringHashKey> hash;
-            if (!hash.Init()) {
-                return NS_ERROR_OUT_OF_MEMORY;
-            }
+            hash.Init();
 
             PRInt32 i, len = nodes->size();
             for (i = 0; i < len; ++i) {
                 nsAutoString str;
                 const txXPathNode& node = nodes->get(i);
                 txXPathNodeUtils::appendNodeValue(node, str);
                 if (!hash.GetEntry(str)) {
-                    if (!hash.PutEntry(str)) {
-                        return NS_ERROR_OUT_OF_MEMORY;
-                    }
+                    hash.PutEntry(str);
                     rv = resultSet->append(node);
                     NS_ENSURE_SUCCESS(rv, rv);
                 }
             }
 
             NS_ADDREF(*aResult = resultSet);
 
             return NS_OK;
--- a/content/xslt/src/xslt/txExecutionState.cpp
+++ b/content/xslt/src/xslt/txExecutionState.cpp
@@ -46,18 +46,17 @@
 #include "txLog.h"
 #include "txURIUtils.h"
 #include "txXMLParser.h"
 
 const PRInt32 txExecutionState::kMaxRecursionDepth = 20000;
 
 nsresult txLoadedDocumentsHash::init(txXPathNode* aSourceDocument)
 {
-    nsresult rv = Init(8);
-    NS_ENSURE_SUCCESS(rv, rv);
+    Init(8);
 
     mSourceDocument = aSourceDocument;
     
     nsAutoString baseURI;
     txXPathNodeUtils::getBaseURI(*mSourceDocument, baseURI);
 
     txLoadedDocumentEntry* entry = PutEntry(baseURI);
     if (!entry) {
--- a/content/xslt/src/xslt/txKeyFunctionCall.cpp
+++ b/content/xslt/src/xslt/txKeyFunctionCall.cpp
@@ -267,25 +267,20 @@ txKeyHash::getKeyNodes(const txExpandedN
     }
 
     return NS_OK;
 }
 
 nsresult
 txKeyHash::init()
 {
-    nsresult rv = mKeyValues.Init(8);
-    NS_ENSURE_SUCCESS(rv, rv);
+    mKeyValues.Init(8);
+    mIndexedKeys.Init(1);
+    mEmptyNodeSet = new txNodeSet(nsnull);
 
-    rv = mIndexedKeys.Init(1);
-    NS_ENSURE_SUCCESS(rv, rv);
-    
-    mEmptyNodeSet = new txNodeSet(nsnull);
-    NS_ENSURE_TRUE(mEmptyNodeSet, NS_ERROR_OUT_OF_MEMORY);
-    
     return NS_OK;
 }
 
 
 /**
  * Adds a match/use pair.
  * @param aMatch  match-pattern
  * @param aUse    use-expression
--- a/content/xul/document/src/nsXULDocument.cpp
+++ b/content/xul/document/src/nsXULDocument.cpp
@@ -1868,20 +1868,17 @@ NS_IMETHODIMP
 nsXULDocument::SetTemplateBuilderFor(nsIContent* aContent,
                                      nsIXULTemplateBuilder* aBuilder)
 {
     if (! mTemplateBuilderTable) {
         if (!aBuilder) {
             return NS_OK;
         }
         mTemplateBuilderTable = new BuilderTable;
-        if (! mTemplateBuilderTable || !mTemplateBuilderTable->Init()) {
-            mTemplateBuilderTable = nsnull;
-            return NS_ERROR_OUT_OF_MEMORY;
-        }
+        mTemplateBuilderTable->Init();
     }
 
     if (aBuilder) {
         mTemplateBuilderTable->Put(aContent, aBuilder);
     }
     else {
         mTemplateBuilderTable->Remove(aContent);
     }
@@ -2644,19 +2641,19 @@ nsXULDocument::LoadOverlay(const nsAStri
     nsresult rv;
 
     nsCOMPtr<nsIURI> uri;
     rv = NS_NewURI(getter_AddRefs(uri), aURL, nsnull);
     if (NS_FAILED(rv)) return rv;
 
     if (aObserver) {
         nsIObserver* obs = nsnull;
-        NS_ENSURE_TRUE(mOverlayLoadObservers.IsInitialized() || mOverlayLoadObservers.Init(), 
-                       NS_ERROR_OUT_OF_MEMORY);
-        
+        if (!mOverlayLoadObservers.IsInitialized()) {
+            mOverlayLoadObservers.Init();
+        }
         obs = mOverlayLoadObservers.GetWeak(uri);
 
         if (obs) {
             // We don't support loading the same overlay twice into the same
             // document - that doesn't make sense anyway.
             return NS_ERROR_FAILURE;
         }
         mOverlayLoadObservers.Put(uri, aObserver);
@@ -3243,18 +3240,19 @@ nsXULDocument::DoneWalking()
                 // yet been attached. This can be a race condition because dynamic
                 // overlay loading can take varying amounts of time depending on
                 // whether or not the overlay prototype is in the XUL cache. The
                 // most likely effect of this bug is odd UI initialization due to
                 // methods and properties that do not work.
                 // XXXbz really, we shouldn't be firing binding constructors
                 // until after StartLayout returns!
 
-                NS_ENSURE_TRUE(mPendingOverlayLoadNotifications.IsInitialized() || mPendingOverlayLoadNotifications.Init(), 
-                               NS_ERROR_OUT_OF_MEMORY);
+                if (!mPendingOverlayLoadNotifications.IsInitialized()) {
+                    mPendingOverlayLoadNotifications.Init();
+                }
                 
                 mPendingOverlayLoadNotifications.Get(overlayURI, getter_AddRefs(obs));
                 if (!obs) {
                     mOverlayLoadObservers.Get(overlayURI, getter_AddRefs(obs));
                     NS_ASSERTION(obs, "null overlay load observer?");
                     mPendingOverlayLoadNotifications.Put(overlayURI, obs);
                 }
             }
--- a/content/xul/document/src/nsXULPrototypeCache.cpp
+++ b/content/xul/document/src/nsXULPrototypeCache.cpp
@@ -204,28 +204,27 @@ nsXULPrototypeCache::GetPrototype(nsIURI
     return newProto;
 }
 
 nsresult
 nsXULPrototypeCache::PutPrototype(nsXULPrototypeDocument* aDocument)
 {
     nsCOMPtr<nsIURI> uri = aDocument->GetURI();
     // Put() releases any old value and addrefs the new one
-    NS_ENSURE_TRUE(mPrototypeTable.Put(uri, aDocument), NS_ERROR_OUT_OF_MEMORY);
+    mPrototypeTable.Put(uri, aDocument);
 
     return NS_OK;
 }
 
 nsresult
 nsXULPrototypeCache::PutStyleSheet(nsCSSStyleSheet* aStyleSheet)
 {
     nsIURI* uri = aStyleSheet->GetSheetURI();
 
-    NS_ENSURE_TRUE(mStyleSheetTable.Put(uri, aStyleSheet),
-                   NS_ERROR_OUT_OF_MEMORY);
+    mStyleSheetTable.Put(uri, aStyleSheet);
 
     return NS_OK;
 }
 
 
 JSScript*
 nsXULPrototypeCache::GetScript(nsIURI* aURI)
 {
@@ -261,17 +260,17 @@ nsXULPrototypeCache::PutScript(nsIURI* a
         NS_WARNING(message.get());
 #endif
         // Reuse the callback used for enumeration in FlushScripts
         ReleaseScriptObjectCallback(aURI, existingEntry, nsnull);
     }
 
     CacheScriptEntry entry = {aScriptObject};
 
-    NS_ENSURE_TRUE(mScriptTable.Put(aURI, entry), NS_ERROR_OUT_OF_MEMORY);
+    mScriptTable.Put(aURI, entry);
 
     // Lock the object from being gc'd until it is removed from the cache
     nsCOMPtr<nsIScriptRuntime> rt;
     nsresult rv = NS_GetJSRuntime(getter_AddRefs(rt));
     if (NS_SUCCEEDED(rv))
         rv = rt->HoldScriptObject(aScriptObject);
     NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to GC lock the object");
 
@@ -291,18 +290,17 @@ nsXULPrototypeCache::FlushScripts()
 nsresult
 nsXULPrototypeCache::PutXBLDocumentInfo(nsXBLDocumentInfo* aDocumentInfo)
 {
     nsIURI* uri = aDocumentInfo->DocumentURI();
 
     nsRefPtr<nsXBLDocumentInfo> info;
     mXBLDocTable.Get(uri, getter_AddRefs(info));
     if (!info) {
-        NS_ENSURE_TRUE(mXBLDocTable.Put(uri, aDocumentInfo),
-                       NS_ERROR_OUT_OF_MEMORY);
+        mXBLDocTable.Put(uri, aDocumentInfo);
     }
     return NS_OK;
 }
 
 static PLDHashOperator
 FlushSkinXBL(nsIURI* aKey, nsRefPtr<nsXBLDocumentInfo>& aDocInfo, void* aClosure)
 {
   nsCAutoString str;
--- a/content/xul/templates/src/nsXULContentBuilder.cpp
+++ b/content/xul/templates/src/nsXULContentBuilder.cpp
@@ -1236,19 +1236,18 @@ nsXULContentBuilder::CreateContainerCont
         }
 
         if (mFlags & eLoggingEnabled)
             OutputMatchToLog(resultid, newmatch, true);
 
         if (prevmatch) {
             prevmatch->mNext = newmatch;
         }
-        else if (!mMatchMap.Put(resultid, newmatch)) {
-            nsTemplateMatch::Destroy(mPool, newmatch, true);
-            return NS_ERROR_OUT_OF_MEMORY;
+        else {
+            mMatchMap.Put(resultid, newmatch);
         }
 
         if (removematch) {
             newmatch->mNext = removematch->mNext;
             nsTemplateMatch::Destroy(mPool, removematch, true);
         }
         else {
             newmatch->mNext = existingmatch;
--- a/content/xul/templates/src/nsXULTemplateBuilder.cpp
+++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp
@@ -206,18 +206,18 @@ nsXULTemplateBuilder::InitGlobals()
             return rv;
     }
 
 #ifdef PR_LOGGING
     if (! gXULTemplateLog)
         gXULTemplateLog = PR_NewLogModule("nsXULTemplateBuilder");
 #endif
 
-    if (!mMatchMap.IsInitialized() && !mMatchMap.Init())
-        return NS_ERROR_OUT_OF_MEMORY;
+    if (!mMatchMap.IsInitialized())
+        mMatchMap.Init();
 
     const size_t bucketsizes[] = { sizeof(nsTemplateMatch) };
     return mPool.Init("nsXULTemplateBuilder", bucketsizes, 1, 256);
 }
 
 void
 nsXULTemplateBuilder::CleanUp(bool aIsFinal)
 {
@@ -786,18 +786,17 @@ nsXULTemplateBuilder::UpdateResultInCont
 
                         findmatch = findmatch->mNext;
                     }
                 }
 
                 if (oldmatch == firstmatch) {
                     // the match to remove is at the beginning
                     if (oldmatch->mNext) {
-                        if (!mMatchMap.Put(aOldId, oldmatch->mNext))
-                            return NS_ERROR_OUT_OF_MEMORY;
+                        mMatchMap.Put(aOldId, oldmatch->mNext);
                     }
                     else {
                         mMatchMap.Remove(aOldId);
                     }
                 }
 
                 if (prevmatch)
                     prevmatch->mNext = nextmatch;
@@ -960,23 +959,17 @@ nsXULTemplateBuilder::UpdateResultInCont
                         }
 
                         newmatch = newmatch->mNext;
                     }
                 }
 
                 // put the match in the map if there isn't a previous match
                 if (! prevmatch) {
-                    if (!mMatchMap.Put(aNewId, newmatch)) {
-                        // The match may have already matched a rule above, so
-                        // HasBeenRemoved should be called to indicate that it
-                        // is being removed again.
-                        nsTemplateMatch::Destroy(mPool, newmatch, true);
-                        return rv;
-                    }
+                    mMatchMap.Put(aNewId, newmatch);
                 }
             }
 
             // hook up the match last in case an error occurs
             if (prevmatch)
                 prevmatch->mNext = newmatch;
         }
         else {
@@ -995,20 +988,17 @@ nsXULTemplateBuilder::UpdateResultInCont
                 if (NS_FAILED(rv)) {
                     nsTemplateMatch::Destroy(mPool, newmatch, false);
                     return rv;
                 }
 
                 acceptedmatch = newmatch;
             }
 
-            if (!mMatchMap.Put(aNewId, newmatch)) {
-                nsTemplateMatch::Destroy(mPool, newmatch, true);
-                return NS_ERROR_OUT_OF_MEMORY;
-            }
+            mMatchMap.Put(aNewId, newmatch);
         }
     }
 
     // The ReplaceMatch method is builder specific and removes the generated
     // content for a match.
 
     // Remove the content for a match that was active and needs to be replaced.
     if (replacedmatch) {
--- a/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
+++ b/content/xul/templates/src/nsXULTemplateQueryProcessorRDF.cpp
@@ -337,25 +337,22 @@ nsXULTemplateQueryProcessorRDF::Initiali
                                                       nsIXULTemplateBuilder* aBuilder,
                                                       nsIDOMNode* aRootNode)
 {
     if (!mQueryProcessorRDFInited) {
         nsresult rv = InitGlobals();
         if (NS_FAILED(rv))
             return rv;
 
-        if (!mMemoryElementToResultMap.IsInitialized() &&
-            !mMemoryElementToResultMap.Init())
-            return NS_ERROR_OUT_OF_MEMORY;
-        if (!mBindingDependencies.IsInitialized() &&
-            !mBindingDependencies.Init())
-            return NS_ERROR_OUT_OF_MEMORY;
-        if (!mRuleToBindingsMap.IsInitialized() &&
-            !mRuleToBindingsMap.Init())
-            return NS_ERROR_OUT_OF_MEMORY;
+        if (!mMemoryElementToResultMap.IsInitialized())
+            mMemoryElementToResultMap.Init();
+        if (!mBindingDependencies.IsInitialized())
+            mBindingDependencies.Init();
+        if (!mRuleToBindingsMap.IsInitialized())
+            mRuleToBindingsMap.Init();
 
         mQueryProcessorRDFInited = true;
     }
 
     // don't do anything if generation has already been done
     if (mGenerationStarted)
         return NS_ERROR_UNEXPECTED;
 
@@ -615,18 +612,17 @@ nsXULTemplateQueryProcessorRDF::AddBindi
     nsCOMPtr<nsIRDFResource> property;
     nsresult rv = gRDFService->GetUnicodeResource(aExpr, getter_AddRefs(property));
     if (NS_FAILED(rv))
         return rv;
 
     nsRefPtr<RDFBindingSet> bindings = mRuleToBindingsMap.GetWeak(aRuleNode);
     if (!bindings) {
         bindings = new RDFBindingSet();
-        if (!bindings || !mRuleToBindingsMap.Put(aRuleNode, bindings))
-            return NS_ERROR_OUT_OF_MEMORY;
+        mRuleToBindingsMap.Put(aRuleNode, bindings);
     }
 
     return bindings->AddBinding(aVar, aRef, property);
 }
 
 NS_IMETHODIMP
 nsXULTemplateQueryProcessorRDF::TranslateRef(nsISupports* aDatasource,
                                                            const nsAString& aRefString,
@@ -1761,20 +1757,17 @@ nsXULTemplateQueryProcessorRDF::AddBindi
                                                      nsIRDFResource* aResource)
 {
     nsCOMArray<nsXULTemplateResultRDF>* arr;
     if (!mBindingDependencies.Get(aResource, &arr)) {
         arr = new nsCOMArray<nsXULTemplateResultRDF>();
         if (!arr)
             return NS_ERROR_OUT_OF_MEMORY;
 
-        if (!mBindingDependencies.Put(aResource, arr)) {
-            delete arr;
-            return NS_ERROR_OUT_OF_MEMORY;
-        }
+        mBindingDependencies.Put(aResource, arr);
     }
 
     PRInt32 index = arr->IndexOf(aResult);
     if (index == -1)
         return arr->AppendObject(aResult);
 
     return NS_OK;
 }
@@ -1806,20 +1799,17 @@ nsXULTemplateQueryProcessorRDF::AddMemor
         PLHashNumber hash = (element.operator->())->Hash();
 
         nsCOMArray<nsXULTemplateResultRDF>* arr;
         if (!mMemoryElementToResultMap.Get(hash, &arr)) {
             arr = new nsCOMArray<nsXULTemplateResultRDF>();
             if (!arr)
                 return NS_ERROR_OUT_OF_MEMORY;
 
-            if (!mMemoryElementToResultMap.Put(hash, arr)) {
-                delete arr;
-                return NS_ERROR_OUT_OF_MEMORY;
-            }
+            mMemoryElementToResultMap.Put(hash, arr);
         }
 
         // results may be added more than once so they will all get deleted properly
         arr->AppendObject(aResult);
     }
 
     return NS_OK;
 }
--- a/content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp
+++ b/content/xul/templates/src/nsXULTemplateQueryProcessorXML.cpp
@@ -250,19 +250,18 @@ nsXULTemplateQueryProcessorXML::Initiali
         doc->GetDocumentElement(getter_AddRefs(mRoot));
     else
       mRoot = do_QueryInterface(aDatasource);
     NS_ENSURE_STATE(mRoot);
 
     mEvaluator = do_CreateInstance("@mozilla.org/dom/xpath-evaluator;1");
     NS_ENSURE_TRUE(mEvaluator, NS_ERROR_OUT_OF_MEMORY);
 
-    if (!mRuleToBindingsMap.IsInitialized() &&
-        !mRuleToBindingsMap.Init())
-        return NS_ERROR_OUT_OF_MEMORY;
+    if (!mRuleToBindingsMap.IsInitialized())
+        mRuleToBindingsMap.Init();
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULTemplateQueryProcessorXML::Done()
 {
     mGenerationStarted = false;
@@ -395,18 +394,17 @@ nsXULTemplateQueryProcessorXML::AddBindi
                                            const nsAString& aExpr)
 {
     if (mGenerationStarted)
         return NS_ERROR_FAILURE;
 
     nsRefPtr<nsXMLBindingSet> bindings = mRuleToBindingsMap.GetWeak(aRuleNode);
     if (!bindings) {
         bindings = new nsXMLBindingSet();
-        if (!bindings || !mRuleToBindingsMap.Put(aRuleNode, bindings))
-            return NS_ERROR_OUT_OF_MEMORY;
+        mRuleToBindingsMap.Put(aRuleNode, bindings);
     }
 
     nsCOMPtr<nsIDOMXPathExpression> compiledexpr;
     nsresult rv =
         CreateExpression(aExpr, aRuleNode, getter_AddRefs(compiledexpr));
     if (NS_FAILED(rv)) {
         nsXULContentUtils::LogTemplateError(ERROR_TEMPLATE_BAD_BINDING_XPATH);
         return NS_OK;
--- a/content/xul/templates/src/nsXULTreeBuilder.cpp
+++ b/content/xul/templates/src/nsXULTreeBuilder.cpp
@@ -1738,19 +1738,18 @@ nsXULTreeBuilder::OpenSubtreeForQuerySet
             if (mFlags & eLoggingEnabled)
                 OutputMatchToLog(resultid, newmatch, true);
 
         }
 
         if (prevmatch) {
             prevmatch->mNext = newmatch;
         }
-        else if (!mMatchMap.Put(resultid, newmatch)) {
-            nsTemplateMatch::Destroy(mPool, newmatch, true);
-            return NS_ERROR_OUT_OF_MEMORY;
+        else {
+            mMatchMap.Put(resultid, newmatch);
         }
     }
 
     *aDelta = count;
     return rv;
 }
 
 nsresult
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -872,18 +872,17 @@ nsDocShell::Init()
     NS_ASSERTION(mLoadGroup, "Something went wrong!");
 
     mContentListener = new nsDSURIContentListener(this);
     NS_ENSURE_TRUE(mContentListener, NS_ERROR_OUT_OF_MEMORY);
 
     rv = mContentListener->Init();
     NS_ENSURE_SUCCESS(rv, rv);
 
-    if (!mStorages.Init())
-        return NS_ERROR_OUT_OF_MEMORY;
+    mStorages.Init();
 
     // We want to hold a strong ref to the loadgroup, so it better hold a weak
     // ref to us...  use an InterfaceRequestorProxy to do this.
     nsCOMPtr<InterfaceRequestorProxy> proxy =
         new InterfaceRequestorProxy(static_cast<nsIInterfaceRequestor*>
                                                (this));
     NS_ENSURE_TRUE(proxy, NS_ERROR_OUT_OF_MEMORY);
     mLoadGroup->SetNotificationCallbacks(proxy);
@@ -2437,18 +2436,17 @@ nsDocShell::GetSessionStorageForPrincipa
         nsCOMPtr<nsPIDOMStorage> pistorage = do_QueryInterface(newstorage);
         if (!pistorage)
             return NS_ERROR_FAILURE;
 
         rv = pistorage->InitAsSessionStorage(aPrincipal, aDocumentURI);
         if (NS_FAILED(rv))
             return rv;
 
-        if (!mStorages.Put(origin, newstorage))
-            return NS_ERROR_OUT_OF_MEMORY;
+        mStorages.Put(origin, newstorage);
 
         newstorage.swap(*aStorage);
 #if defined(PR_LOGGING) && defined(DEBUG)
         PR_LOG(gDocShellLog, PR_LOG_DEBUG,
                ("nsDocShell[%p]: created a new sessionStorage %p",
                 this, *aStorage));
 #endif
     }
@@ -2575,18 +2573,17 @@ nsDocShell::AddSessionStorage(nsIPrincip
             if (mStorages.GetWeak(origin))
                 return NS_ERROR_NOT_AVAILABLE;
 
 #if defined(PR_LOGGING) && defined(DEBUG)
             PR_LOG(gDocShellLog, PR_LOG_DEBUG,
                    ("nsDocShell[%p]: was added a sessionStorage %p",
                     this, aStorage));
 #endif
-            if (!mStorages.Put(origin, aStorage))
-                return NS_ERROR_OUT_OF_MEMORY;
+            mStorages.Put(origin, aStorage);
         }
         else {
             return topDocShell->AddSessionStorage(aPrincipal, aStorage);
         }
     }
 
     return NS_OK;
 }
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -811,24 +811,17 @@ nsGlobalWindow::Init()
                "gEntropyCollector should have been initialized!");
 
 #ifdef PR_LOGGING
   gDOMLeakPRLog = PR_NewLogModule("DOMLeak");
   NS_ASSERTION(gDOMLeakPRLog, "gDOMLeakPRLog should have been initialized!");
 #endif
 
   sWindowsById = new WindowByIdTable();
-  // There are two reasons to have Init() failing: if we were not able to
-  // alloc the memory or if the size we want to init is too high. None of them
-  // should happen.
-#ifdef DEBUG
-  NS_ASSERTION(sWindowsById->Init(), "Init() should not fail!");
-#else
   sWindowsById->Init();
-#endif
 }
 
 static PLDHashOperator
 DisconnectEventTargetObjects(nsPtrHashKey<nsDOMEventTargetHelper>* aKey,
                              void* aClosure)
 {
   nsRefPtr<nsDOMEventTargetHelper> target = aKey->GetKey();
   target->DisconnectFromOwner();
@@ -6740,20 +6733,18 @@ nsGlobalWindow::GetCachedXBLPrototypeHan
   }
   return handler;
 }
 
 void
 nsGlobalWindow::CacheXBLPrototypeHandler(nsXBLPrototypeHandler* aKey,
                                          nsScriptObjectHolder<JSObject>& aHandler)
 {
-  if (!mCachedXBLPrototypeHandlers.IsInitialized() &&
-      !mCachedXBLPrototypeHandlers.Init()) {
-    NS_ERROR("Failed to initiailize hashtable!");
-    return;
+  if (!mCachedXBLPrototypeHandlers.IsInitialized()) {
+    mCachedXBLPrototypeHandlers.Init();
   }
 
   if (!mCachedXBLPrototypeHandlers.Count()) {
     // Can't use macros to get the participant because nsGlobalChromeWindow also
     // runs through this code. Use QueryInterface to get the correct objects.
     nsXPCOMCycleCollectionParticipant* participant;
     CallQueryInterface(this, &participant);
     NS_ASSERTION(participant,
--- a/dom/indexedDB/DatabaseInfo.cpp
+++ b/dom/indexedDB/DatabaseInfo.cpp
@@ -68,20 +68,17 @@ PLDHashOperator
 CloneObjectStoreInfo(const nsAString& aKey,
                      ObjectStoreInfo* aData,
                      void* aUserArg)
 {
   ObjectStoreInfoHash* hash = static_cast<ObjectStoreInfoHash*>(aUserArg);
 
   nsRefPtr<ObjectStoreInfo> newInfo(new ObjectStoreInfo(*aData));
 
-  if (!hash->Put(aKey, newInfo)) {
-    NS_WARNING("Out of memory?");
-    return PL_DHASH_STOP;
-  }
+  hash->Put(aKey, newInfo);
 
   return PL_DHASH_NEXT;
 }
 
 }
 
 DatabaseInfo::~DatabaseInfo()
 {
@@ -173,33 +170,26 @@ DatabaseInfo::Get(nsIAtom* aId,
 bool
 DatabaseInfo::Put(DatabaseInfo* aInfo)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(aInfo, "Null pointer!");
 
   if (!gDatabaseHash) {
     nsAutoPtr<DatabaseHash> databaseHash(new DatabaseHash());
-    if (!databaseHash->Init()) {
-      NS_ERROR("Failed to initialize hashtable!");
-      return false;
-    }
-
+    databaseHash->Init();
     gDatabaseHash = databaseHash.forget();
   }
 
   if (gDatabaseHash->Get(aInfo->id, nsnull)) {
     NS_ERROR("Already know about this database!");
     return false;
   }
 
-  if (!gDatabaseHash->Put(aInfo->id, aInfo)) {
-    NS_ERROR("Put failed!");
-    return false;
-  }
+  gDatabaseHash->Put(aInfo->id, aInfo);
 
   return true;
 }
 
 // static
 void
 DatabaseInfo::Remove(nsIAtom* aId)
 {
@@ -275,29 +265,27 @@ DatabaseInfo::GetObjectStore(const nsASt
 bool
 DatabaseInfo::PutObjectStore(ObjectStoreInfo* aInfo)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(aInfo, "Null pointer!");
 
   if (!objectStoreHash) {
     nsAutoPtr<ObjectStoreInfoHash> hash(new ObjectStoreInfoHash());
-    if (!hash->Init()) {
-      NS_ERROR("Failed to initialize hashtable!");
-      return false;
-    }
+    hash->Init();
     objectStoreHash = hash.forget();
   }
 
   if (objectStoreHash->Get(aInfo->name, nsnull)) {
     NS_ERROR("Already have an entry for this objectstore!");
     return false;
   }
 
-  return objectStoreHash->Put(aInfo->name, aInfo);
+  objectStoreHash->Put(aInfo->name, aInfo);
+  return true;
 }
 
 void
 DatabaseInfo::RemoveObjectStore(const nsAString& aName)
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
   NS_ASSERTION(GetObjectStore(aName), "Don't know about this one!");
 
@@ -318,18 +306,15 @@ DatabaseInfo::Clone()
   dbInfo->version = version;
   dbInfo->id = id;
   dbInfo->filePath = filePath;
   dbInfo->nextObjectStoreId = nextObjectStoreId;
   dbInfo->nextIndexId = nextIndexId;
 
   if (objectStoreHash) {
     dbInfo->objectStoreHash = new ObjectStoreInfoHash();
-    if (!dbInfo->objectStoreHash->Init()) {
-      return nsnull;
-    }
-
+    dbInfo->objectStoreHash->Init();
     objectStoreHash->EnumerateRead(CloneObjectStoreInfo,
                                    dbInfo->objectStoreHash);
   }
 
   return dbInfo.forget();
 }
--- a/dom/indexedDB/FileManager.cpp
+++ b/dom/indexedDB/FileManager.cpp
@@ -73,17 +73,17 @@ EnumerateToTArray(const PRUint64& aKey,
 } // anonymous namespace
 
 nsresult
 FileManager::Init(nsIFile* aDirectory,
                   mozIStorageConnection* aConnection)
 {
   NS_ASSERTION(!NS_IsMainThread(), "Wrong thread!");
 
-  NS_ENSURE_TRUE(mFileInfos.Init(), NS_ERROR_OUT_OF_MEMORY);
+  mFileInfos.Init();
 
   bool exists;
   nsresult rv = aDirectory->Exists(&exists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (exists) {
     bool isDirectory;
     rv = aDirectory->IsDirectory(&isDirectory);
@@ -181,20 +181,17 @@ FileManager::Load(mozIStorageConnection*
     rv = stmt->GetInt32(1, &refcount);
     NS_ENSURE_SUCCESS(rv, rv);
 
     NS_ASSERTION(refcount, "This shouldn't happen!");
 
     nsRefPtr<FileInfo> fileInfo = FileInfo::Create(this, id);
     fileInfo->mDBRefCnt = refcount;
 
-    if (!mFileInfos.Put(id, fileInfo)) {
-      NS_WARNING("Out of memory?");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mFileInfos.Put(id, fileInfo);
 
     mLastFileId = NS_MAX(id, mLastFileId);
   }
 
   mLoaded = true;
 
   return NS_OK;
 }
@@ -268,20 +265,17 @@ FileManager::GetNewFileInfo()
 
   {
     MutexAutoLock lock(IndexedDatabaseManager::FileMutex());
 
     PRInt64 id = mLastFileId + 1;
 
     fileInfo = FileInfo::Create(this, id);
 
-    if (!mFileInfos.Put(id, fileInfo)) {
-      NS_WARNING("Out of memory?");
-      return nsnull;
-    }
+    mFileInfos.Put(id, fileInfo);
 
     mLastFileId = id;
   }
 
   nsRefPtr<FileInfo> result = fileInfo.forget();
   return result.forget();
 }
 
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -131,20 +131,17 @@ IDBTransaction::Create(IDBDatabase* aDat
   
   transaction->mDatabaseInfo = aDatabase->Info();
 
   if (!transaction->mObjectStoreNames.AppendElements(aObjectStoreNames)) {
     NS_ERROR("Out of memory!");
     return nsnull;
   }
 
-  if (!transaction->mCachedStatements.Init()) {
-    NS_ERROR("Failed to initialize hash!");
-    return nsnull;
-  }
+  transaction->mCachedStatements.Init();
 
   if (!aDispatchDelayed) {
     nsCOMPtr<nsIAppShell> appShell = do_GetService(kAppShellCID);
     NS_ENSURE_TRUE(appShell, nsnull);
 
     nsresult rv = appShell->RunBeforeNextEvent(transaction);
     NS_ENSURE_SUCCESS(rv, nsnull);
 
@@ -391,19 +388,17 @@ IDBTransaction::GetCachedStatement(const
       (void)mConnection->GetLastErrorString(msg);
       error.Append(msg);
       error.AppendLiteral("`.");
       NS_ERROR(error.get());
     }
 #endif
     NS_ENSURE_SUCCESS(rv, nsnull);
 
-    if (!mCachedStatements.Put(aQuery, stmt)) {
-      NS_ERROR("Out of memory?!");
-    }
+    mCachedStatements.Put(aQuery, stmt);
   }
 
   return stmt.forget();
 }
 
 bool
 IDBTransaction::IsOpen() const
 {
@@ -840,17 +835,17 @@ CommitHelper::RevertAutoIncrementCounts(
     ObjectStoreInfo* info = mAutoIncrementObjectStores[i]->Info();
     info->nextAutoIncrementId = info->comittedAutoIncrementId;
   }
 }
 
 nsresult
 UpdateRefcountFunction::Init()
 {
-  NS_ENSURE_TRUE(mFileInfoEntries.Init(), NS_ERROR_OUT_OF_MEMORY);
+  mFileInfoEntries.Init();
 
   return NS_OK;
 }
 
 NS_IMPL_THREADSAFE_ISUPPORTS1(UpdateRefcountFunction, mozIStorageFunction)
 
 NS_IMETHODIMP
 UpdateRefcountFunction::OnFunctionCall(mozIStorageValueArray* aValues,
@@ -906,20 +901,17 @@ UpdateRefcountFunction::ProcessValue(moz
     PRInt64 id = fileIds.ElementAt(i);
 
     FileInfoEntry* entry;
     if (!mFileInfoEntries.Get(id, &entry)) {
       nsRefPtr<FileInfo> fileInfo = mFileManager->GetFileInfo(id);
       NS_ASSERTION(fileInfo, "Shouldn't be null!");
 
       nsAutoPtr<FileInfoEntry> newEntry(new FileInfoEntry(fileInfo));
-      if (!mFileInfoEntries.Put(id, newEntry)) {
-        NS_WARNING("Out of memory?");
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
+      mFileInfoEntries.Put(id, newEntry);
       entry = newEntry.forget();
     }
 
     switch (aUpdateType) {
       case eIncrement:
         entry->mDelta++;
         break;
       case eDecrement:
--- a/dom/indexedDB/IndexedDatabaseManager.cpp
+++ b/dom/indexedDB/IndexedDatabaseManager.cpp
@@ -223,22 +223,19 @@ IndexedDatabaseManager::GetOrCreate()
                                               PREF_INDEXEDDB_QUOTA,
                                               DEFAULT_QUOTA_MB))) {
       NS_WARNING("Unable to respond to quota pref changes!");
       gIndexedDBQuotaMB = DEFAULT_QUOTA_MB;
     }
 
     instance = new IndexedDatabaseManager();
 
-    if (!instance->mLiveDatabases.Init() ||
-        !instance->mQuotaHelperHash.Init() ||
-        !instance->mFileManagers.Init()) {
-      NS_WARNING("Out of memory!");
-      return nsnull;
-    }
+    instance->mLiveDatabases.Init();
+    instance->mQuotaHelperHash.Init();
+    instance->mFileManagers.Init();
 
     // We need a thread-local to hold the current window.
     NS_ASSERTION(instance->mCurrentWindowIndex == BAD_TLS_INDEX, "Huh?");
 
     if (PR_NewThreadPrivateIndex(&instance->mCurrentWindowIndex, nsnull) !=
         PR_SUCCESS) {
       NS_ERROR("PR_NewThreadPrivateIndex failed, IndexedDB disabled");
       instance->mCurrentWindowIndex = BAD_TLS_INDEX;
@@ -337,20 +334,17 @@ IndexedDatabaseManager::RegisterDatabase
   if (IsShuttingDown()) {
     return false;
   }
 
   // Add this database to its origin array if it exists, create it otherwise.
   nsTArray<IDBDatabase*>* array;
   if (!mLiveDatabases.Get(aDatabase->Origin(), &array)) {
     nsAutoPtr<nsTArray<IDBDatabase*> > newArray(new nsTArray<IDBDatabase*>());
-    if (!mLiveDatabases.Put(aDatabase->Origin(), newArray)) {
-      NS_WARNING("Out of memory?");
-      return false;
-    }
+    mLiveDatabases.Put(aDatabase->Origin(), newArray);
     array = newArray.forget();
   }
   if (!array->AppendElement(aDatabase)) {
     NS_WARNING("Out of memory?");
     return false;
   }
 
   aDatabase->mRegistered = true;
@@ -725,17 +719,17 @@ IndexedDatabaseManager::EnsureOriginIsIn
 
   nsAutoTArray<nsString, 20> subdirsToProcess;
   nsAutoTArray<nsCOMPtr<nsIFile> , 20> unknownFiles;
 
   nsAutoPtr<nsTArray<nsRefPtr<FileManager> > > fileManagers(
     new nsTArray<nsRefPtr<FileManager> >());
 
   nsTHashtable<nsStringHashKey> validSubdirs;
-  NS_ENSURE_TRUE(validSubdirs.Init(20), NS_ERROR_OUT_OF_MEMORY);
+  validSubdirs.Init(20);
   
   nsCOMPtr<nsISimpleEnumerator> entries;
   rv = directory->GetDirectoryEntries(getter_AddRefs(entries));
   NS_ENSURE_SUCCESS(rv, rv);
 
   bool hasMore;
   while (NS_SUCCEEDED((rv = entries->HasMoreElements(&hasMore))) && hasMore) {
     nsCOMPtr<nsISupports> entry;
@@ -803,20 +797,17 @@ IndexedDatabaseManager::EnsureOriginIsIn
     rv = fileManager->Init(fileManagerDirectory, connection);
     NS_ENSURE_SUCCESS(rv, rv);
 
     fileManagers->AppendElement(fileManager);
 
     rv = ss->UpdateQuotaInformationForFile(file);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    if (!validSubdirs.PutEntry(dbBaseFilename)) {
-      NS_WARNING("Out of memory?");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    validSubdirs.PutEntry(dbBaseFilename);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   for (PRUint32 i = 0; i < subdirsToProcess.Length(); i++) {
     const nsString& subdir = subdirsToProcess[i];
     if (!validSubdirs.GetEntry(subdir)) {
       NS_WARNING("Unknown subdirectory found!");
       return NS_ERROR_UNEXPECTED;
@@ -839,21 +830,17 @@ IndexedDatabaseManager::EnsureOriginIsIn
       // The journal file may exists even after db has been correctly opened.
       if (!StringEndsWith(leafName, NS_LITERAL_STRING(".sqlite-journal"))) {
         NS_WARNING("Unknown file found!");
         return NS_ERROR_UNEXPECTED;
       }
     }
   }
 
-  if (!mFileManagers.Put(aOrigin, fileManagers)) {
-    NS_WARNING("Out of memory?");
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
+  mFileManagers.Put(aOrigin, fileManagers);
   fileManagers.forget();
 
   NS_ADDREF(*aDirectory = directory);
   return NS_OK;
 }
 
 bool
 IndexedDatabaseManager::QuotaIsLiftedInternal()
@@ -873,18 +860,17 @@ IndexedDatabaseManager::QuotaIsLiftedInt
   MutexAutoLock autoLock(mQuotaHelperMutex);
 
   mQuotaHelperHash.Get(window, getter_AddRefs(helper));
 
   if (!helper) {
     helper = new CheckQuotaHelper(window, mQuotaHelperMutex);
     createdHelper = true;
 
-    bool result = mQuotaHelperHash.Put(window, helper);
-    NS_ENSURE_TRUE(result, result);
+    mQuotaHelperHash.Put(window, helper);
 
     // Unlock while calling out to XPCOM
     {
       MutexAutoUnlock autoUnlock(mQuotaHelperMutex);
 
       nsresult rv = NS_DispatchToMainThread(helper);
       NS_ENSURE_SUCCESS(rv, false);
     }
@@ -961,20 +947,17 @@ IndexedDatabaseManager::GetASCIIOriginFr
 already_AddRefed<FileManager>
 IndexedDatabaseManager::GetOrCreateFileManager(const nsACString& aOrigin,
                                                const nsAString& aDatabaseName)
 {
   nsTArray<nsRefPtr<FileManager> >* array;
   if (!mFileManagers.Get(aOrigin, &array)) {
     nsAutoPtr<nsTArray<nsRefPtr<FileManager> > > newArray(
       new nsTArray<nsRefPtr<FileManager> >());
-    if (!mFileManagers.Put(aOrigin, newArray)) {
-      NS_WARNING("Out of memory?");
-      return nsnull;
-    }
+    mFileManagers.Put(aOrigin, newArray);
     array = newArray.forget();
   }
 
   nsRefPtr<FileManager> fileManager;
   for (PRUint32 i = 0; i < array->Length(); i++) {
     nsRefPtr<FileManager> fm = array->ElementAt(i);
 
     if (fm->DatabaseName().Equals(aDatabaseName)) {
--- a/dom/indexedDB/TransactionThreadPool.cpp
+++ b/dom/indexedDB/TransactionThreadPool.cpp
@@ -159,20 +159,17 @@ TransactionThreadPool::Shutdown()
   }
 }
 
 nsresult
 TransactionThreadPool::Init()
 {
   NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
 
-  if (!mTransactionsInProgress.Init()) {
-    NS_WARNING("Failed to init hash!");
-    return NS_ERROR_FAILURE;
-  }
+  mTransactionsInProgress.Init();
 
   nsresult rv;
   mThreadPool = do_CreateInstance(NS_THREADPOOL_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = mThreadPool->SetThreadLimit(kThreadLimit);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -463,20 +460,17 @@ TransactionThreadPool::Dispatch(IDBTrans
   }
 
   if (!transactionInfo->objectStoreNames.AppendElements(objectStoreNames)) {
     NS_WARNING("Out of memory!");
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
   if (autoDBTransactionInfo) {
-    if (!mTransactionsInProgress.Put(databaseId, autoDBTransactionInfo)) {
-      NS_WARNING("Failed to put!");
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mTransactionsInProgress.Put(databaseId, autoDBTransactionInfo);
     autoDBTransactionInfo.forget();
   }
 
   return mThreadPool->Dispatch(transactionInfo->queue, NS_DISPATCH_NORMAL);
 }
 
 bool
 TransactionThreadPool::WaitForAllDatabasesToComplete(
--- a/dom/ipc/CrashReporterParent.cpp
+++ b/dom/ipc/CrashReporterParent.cpp
@@ -119,18 +119,17 @@ bool
 CrashReporterParent::GenerateHangCrashReport(const AnnotationTable* processNotes)
 {
     if (mChildDumpID.IsEmpty())
         return false;
 
     GenerateChildData(processNotes);
 
     CrashReporter::AnnotationTable notes;
-    if (!notes.Init(4))
-        return false;
+    notes.Init(4);
     notes.Put(nsDependentCString("HangID"), NS_ConvertUTF16toUTF8(mHangID));
     if (!CrashReporter::AppendExtraData(mParentDumpID, notes))
         NS_WARNING("problem appending parent data to .extra");
     return true;
 }
 
 bool
 CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -379,25 +379,25 @@ static nsInterfaceHashtable<nsPtrHashKey
 
 NS_IMETHODIMP
 TabChild::OpenDialog(PRUint32 aType, const nsACString& aName,
                      const nsACString& aFeatures,
                      nsIDialogParamBlock* aArguments,
                      nsIDOMElement* aFrameElement)
 {
   if (!gActiveDialogs.IsInitialized()) {
-    NS_ENSURE_STATE(gActiveDialogs.Init());
+    gActiveDialogs.Init();
   }
   InfallibleTArray<PRInt32> intParams;
   InfallibleTArray<nsString> stringParams;
   ParamsToArrays(aArguments, intParams, stringParams);
   PContentDialogChild* dialog =
     SendPContentDialogConstructor(aType, nsCString(aName),
                                   nsCString(aFeatures), intParams, stringParams);
-  NS_ENSURE_STATE(gActiveDialogs.Put(dialog, aArguments));
+  gActiveDialogs.Put(dialog, aArguments);
   nsIThread *thread = NS_GetCurrentThread();
   while (gActiveDialogs.GetWeak(dialog)) {
     if (!NS_ProcessNextEvent(thread)) {
       break;
     }
   }
   return NS_OK;
 }
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1039,19 +1039,19 @@ NS_IMETHODIMP nsPluginInstanceOwner::Get
     *result = PL_strdup("US_ASCII");
   } else if (charset.EqualsLiteral("ISO-8859-1") ||
       !nsCRT::strncmp(PromiseFlatCString(charset).get(), "UTF", 3)) {
     *result = ToNewCString(charset);
   } else {
     if (!gCharsetMap) {
       const int NUM_CHARSETS = sizeof(charsets) / sizeof(moz2javaCharset);
       gCharsetMap = new nsDataHashtable<nsDepCharHashKey, const char*>();
-      if (!gCharsetMap || !gCharsetMap->Init(NUM_CHARSETS))
+      if (!gCharsetMap)
         return NS_ERROR_OUT_OF_MEMORY;
-
+      gCharsetMap->Init(NUM_CHARSETS);
       for (PRUint16 i = 0; i < NUM_CHARSETS; i++) {
         gCharsetMap->Put(charsets[i].mozName, charsets[i].javaName);
       }
     }
     // if found mapping, return it; otherwise return original charset
     const char *mapping;
     *result = gCharsetMap->Get(charset.get(), &mapping) ? PL_strdup(mapping) :
                                                           ToNewCString(charset);
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -132,17 +132,18 @@ PluginInstanceParent::~PluginInstancePar
             DeallocShmem(mRemoteImageDataShmem);
         }
     }
 }
 
 bool
 PluginInstanceParent::Init()
 {
-    return !!mScriptableObjects.Init();
+    mScriptableObjects.Init();
+    return true;
 }
 
 void
 PluginInstanceParent::ActorDestroy(ActorDestroyReason why)
 {
 #if defined(OS_WIN)
     if (why == AbnormalShutdown) {
         // If the plugin process crashes, this is the only
@@ -1537,17 +1538,18 @@ PluginInstanceParent::NPP_URLNotify(cons
 bool
 PluginInstanceParent::RegisterNPObjectForActor(
                                            NPObject* aObject,
                                            PluginScriptableObjectParent* aActor)
 {
     NS_ASSERTION(aObject && aActor, "Null pointers!");
     NS_ASSERTION(mScriptableObjects.IsInitialized(), "Hash not initialized!");
     NS_ASSERTION(!mScriptableObjects.Get(aObject, nsnull), "Duplicate entry!");
-    return !!mScriptableObjects.Put(aObject, aActor);
+    mScriptableObjects.Put(aObject, aActor);
+    return true;
 }
 
 void
 PluginInstanceParent::UnregisterNPObject(NPObject* aObject)
 {
     NS_ASSERTION(aObject, "Null pointer!");
     NS_ASSERTION(mScriptableObjects.IsInitialized(), "Hash not initialized!");
     NS_ASSERTION(mScriptableObjects.Get(aObject, nsnull), "Unknown entry!");
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -172,30 +172,19 @@ PluginModuleChild::Init(const std::strin
     PLUGIN_LOG_DEBUG_METHOD;
 
 #ifdef XP_WIN
     COMMessageFilter::Initialize(this);
 #endif
 
     NS_ASSERTION(aChannel, "need a channel");
 
-    if (!mObjectMap.Init()) {
-       NS_WARNING("Failed to initialize object hashtable!");
-       return false;
-    }
-
-    if (!mStringIdentifiers.Init()) {
-       NS_ERROR("Failed to initialize string identifier hashtable!");
-       return false;
-    }
-
-    if (!mIntIdentifiers.Init()) {
-       NS_ERROR("Failed to initialize int identifier hashtable!");
-       return false;
-    }
+    mObjectMap.Init();
+    mStringIdentifiers.Init();
+    mIntIdentifiers.Init();
 
     if (!InitGraphics())
         return false;
 
     mPluginFilename = aPluginFilename.c_str();
     nsCOMPtr<nsILocalFile> localFile;
     NS_NewLocalFile(NS_ConvertUTF8toUTF16(mPluginFilename),
                     true,
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -132,19 +132,17 @@ PluginModuleParent::PluginModuleParent(c
     , mClearSiteDataSupported(false)
     , mGetSitesWithDataSupported(false)
     , mNPNIface(NULL)
     , mPlugin(NULL)
     , mTaskFactory(this)
 {
     NS_ASSERTION(mSubprocess, "Out of memory!");
 
-    if (!mIdentifiers.Init()) {
-        NS_ERROR("Out of memory");
-    }
+    mIdentifiers.Init();
 
     Preferences::RegisterCallback(TimeoutChanged, kChildTimeoutPref, this);
     Preferences::RegisterCallback(TimeoutChanged, kParentTimeoutPref, this);
 }
 
 PluginModuleParent::~PluginModuleParent()
 {
     NS_ASSERTION(OkToCleanup(), "unsafe destruction");
--- a/dom/src/storage/nsDOMStorage.cpp
+++ b/dom/src/storage/nsDOMStorage.cpp
@@ -268,22 +268,17 @@ NS_IMPL_ISUPPORTS3(nsDOMStorageManager,
 //static
 nsresult
 nsDOMStorageManager::Initialize()
 {
   gStorageManager = new nsDOMStorageManager();
   if (!gStorageManager)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  if (!gStorageManager->mStorages.Init()) {
-    delete gStorageManager;
-    gStorageManager = nsnull;
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
+  gStorageManager->mStorages.Init();
   NS_ADDREF(gStorageManager);
 
   // No observers needed in non-chrome
   if (XRE_GetProcessType() != GeckoProcessType_Default)
     return NS_OK;
 
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   if (!os)
--- a/dom/src/storage/nsDOMStorageMemoryDB.cpp
+++ b/dom/src/storage/nsDOMStorageMemoryDB.cpp
@@ -41,18 +41,17 @@
 #include "nsDOMError.h"
 #include "nsDOMStorage.h"
 #include "nsDOMStorageMemoryDB.h"
 #include "nsNetUtil.h"
 
 nsresult
 nsDOMStorageMemoryDB::Init(nsDOMStoragePersistentDB* aPreloadDB)
 {
-  if (!mData.Init(20))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mData.Init(20);
 
   mPreloadDB = aPreloadDB;
   return NS_OK;
 }
 
 static PLDHashOperator
 AllKeyEnum(nsSessionStorageEntry* aEntry, void* userArg)
 {
@@ -81,20 +80,17 @@ nsDOMStorageMemoryDB::GetItemsTable(DOMS
     return NS_OK;
 
   *aMemoryStorage = nsnull;
 
   nsInMemoryStorage* storageData = new nsInMemoryStorage();
   if (!storageData)
     return NS_ERROR_OUT_OF_MEMORY;
 
-  if (!storageData->mTable.Init()) {
-    delete storageData;
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  storageData->mTable.Init();
 
   if (mPreloadDB) {
     nsresult rv;
 
     nsTHashtable<nsSessionStorageEntry> keys;
     keys.Init();
 
     rv = mPreloadDB->GetAllKeys(aStorage, &keys);
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -634,21 +634,17 @@ RuntimeService::RegisterWorker(JSContext
 
     MutexAutoLock lock(mMutex);
 
     if (!mDomainMap.Get(domain, &domainInfo)) {
       NS_ASSERTION(!parent, "Shouldn't have a parent here!");
 
       domainInfo = new WorkerDomainInfo();
       domainInfo->mDomain = domain;
-
-      if (!mDomainMap.Put(domain, domainInfo)) {
-        delete domainInfo;
-        domainInfo = nsnull;
-      }
+      mDomainMap.Put(domain, domainInfo);
     }
 
     if (domainInfo) {
       queued = gMaxWorkersPerDomain &&
                domainInfo->ActiveWorkerCount() >= gMaxWorkersPerDomain &&
                !domain.IsEmpty();
 
       if (queued) {
@@ -691,23 +687,17 @@ RuntimeService::RegisterWorker(JSContext
 
     nsPIDOMWindow* window = aWorkerPrivate->GetWindow();
 
     nsTArray<WorkerPrivate*>* windowArray;
     if (!mWindowMap.Get(window, &windowArray)) {
       NS_ASSERTION(!parent, "Shouldn't have a parent here!");
 
       windowArray = new nsTArray<WorkerPrivate*>(1);
-
-      if (!mWindowMap.Put(window, windowArray)) {
-        delete windowArray;
-        UnregisterWorker(aCx, aWorkerPrivate);
-        JS_ReportOutOfMemory(aCx);
-        return false;
-      }
+      mWindowMap.Put(window, windowArray);
     }
 
     NS_ASSERTION(!windowArray->Contains(aWorkerPrivate),
                  "Already know about this worker!");
     windowArray->AppendElement(aWorkerPrivate);
   }
 
   if (!queued && !ScheduleWorker(aCx, aWorkerPrivate)) {
@@ -910,21 +900,18 @@ RuntimeService::ShutdownIdleThreads(nsIT
 nsresult
 RuntimeService::Init()
 {
   AssertIsOnMainThread();
 
   mIdleThreadTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
   NS_ENSURE_STATE(mIdleThreadTimer);
 
-  bool ok = mDomainMap.Init();
-  NS_ENSURE_STATE(ok);
-
-  ok = mWindowMap.Init();
-  NS_ENSURE_STATE(ok);
+  mDomainMap.Init();
+  mWindowMap.Init();
 
   nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
   NS_ENSURE_TRUE(obs, NS_ERROR_FAILURE);
 
   nsresult rv =
     obs->AddObserver(this, NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID, false);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/embedding/components/commandhandler/src/nsCommandManager.cpp
+++ b/embedding/components/commandhandler/src/nsCommandManager.cpp
@@ -111,17 +111,17 @@ NS_INTERFACE_MAP_END
 /* void init (in nsIDOMWindow aWindow); */
 NS_IMETHODIMP
 nsCommandManager::Init(nsIDOMWindow *aWindow)
 {
   NS_ENSURE_ARG_POINTER(aWindow);
   
   NS_ASSERTION(aWindow, "Need non-null window here");
   mWindow = aWindow;      // weak ptr
-  NS_ENSURE_TRUE(mObserversTable.Init(), NS_ERROR_OUT_OF_MEMORY);
+  mObserversTable.Init();
   return NS_OK;
 }
 
 /* void commandStatusChanged (in DOMString aCommandName, in long aChangeFlags); */
 NS_IMETHODIMP
 nsCommandManager::CommandStatusChanged(const char * aCommandName)
 {
   nsCOMArray<nsIObserver>* commandObservers;
@@ -158,18 +158,17 @@ nsCommandManager::AddCommandObserver(nsI
 
   // XXX todo: handle special cases of aCommandToObserve being null, or empty
 
   // for each command in the table, we make a list of observers for that command
   nsCOMArray<nsIObserver>* commandObservers;
   if (!mObserversTable.Get(aCommandToObserve, &commandObservers))
   {
     nsAutoPtr<nsCOMArray<nsIObserver> > array(new nsCOMArray<nsIObserver>);
-    if (!array || !mObserversTable.Put(aCommandToObserve, array))
-      return NS_ERROR_OUT_OF_MEMORY;
+    mObserversTable.Put(aCommandToObserve, array);
 
     commandObservers = array.forget();
   }
 
   // need to check that this command observer hasn't already been registered
   PRInt32 existingIndex = commandObservers->IndexOf(aCommandObserver);
   if (existingIndex == -1)
     rv = commandObservers->AppendObject(aCommandObserver);
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -188,19 +188,17 @@ nsPermissionManager::GetXPCOMSingleton()
   return gPermissionManager;
 }
 
 nsresult
 nsPermissionManager::Init()
 {
   nsresult rv;
 
-  if (!mHostTable.Init()) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  mHostTable.Init();
 
   mObserverService = do_GetService("@mozilla.org/observer-service;1", &rv);
   if (NS_SUCCEEDED(rv)) {
     mObserverService->AddObserver(this, "profile-before-change", true);
     mObserverService->AddObserver(this, "profile-do-change", true);
   }
 
   if (IsChildProcess()) {
--- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp
+++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp
@@ -118,19 +118,17 @@ NS_MEMORY_REPORTER_IMPLEMENT(Hunspell,
   HunspellGetCurrentAllocatedSize,
   "Memory used by the Hunspell spell checking engine.  This number accounts "
   "for the memory in use by Hunspell's internal data structures."
 )
 
 nsresult
 mozHunspell::Init()
 {
-  if (!mDictionaries.Init())
-    return NS_ERROR_OUT_OF_MEMORY;
-
+  mDictionaries.Init();
   LoadDictionaryList();
 
   nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
   if (obs) {
     obs->AddObserver(this, "profile-do-change", true);
     obs->AddObserver(this, "profile-after-change", true);
   }
 
--- a/extensions/spellcheck/src/mozPersonalDictionary.cpp
+++ b/extensions/spellcheck/src/mozPersonalDictionary.cpp
@@ -85,18 +85,18 @@ mozPersonalDictionary::mozPersonalDictio
 }
 
 mozPersonalDictionary::~mozPersonalDictionary()
 {
 }
 
 nsresult mozPersonalDictionary::Init()
 {
-  if (!mDictionaryTable.Init() || !mIgnoreTable.Init())
-    return NS_ERROR_OUT_OF_MEMORY;
+  mDictionaryTable.Init();
+  mIgnoreTable.Init();
 
   nsresult rv;
   nsCOMPtr<nsIObserverService> svc = 
            do_GetService("@mozilla.org/observer-service;1", &rv);
    
   if (NS_SUCCEEDED(rv) && svc) 
     rv = svc->AddObserver(this, "profile-do-change", true); // we want to reload the dictionary if the profile switches
 
--- a/image/src/imgLoader.cpp
+++ b/image/src/imgLoader.cpp
@@ -910,20 +910,18 @@ nsresult imgLoader::InitCache()
   NS_ADDREF(gCacheObserver);
 
   os->AddObserver(gCacheObserver, "memory-pressure", false);
   os->AddObserver(gCacheObserver, "chrome-flush-skin-caches", false);
   os->AddObserver(gCacheObserver, "chrome-flush-caches", false);
 
   gCacheTracker = new imgCacheExpirationTracker();
 
-  if (!sCache.Init())
-      return NS_ERROR_OUT_OF_MEMORY;
-  if (!sChromeCache.Init())
-      return NS_ERROR_OUT_OF_MEMORY;
+  sCache.Init();
+  sChromeCache.Init();
 
   PRInt32 timeweight;
   rv = Preferences::GetInt("image.cache.timeweight", &timeweight);
   if (NS_SUCCEEDED(rv))
     sCacheTimeWeight = timeweight / 1000.0;
   else
     sCacheTimeWeight = 0.5;
 
@@ -1078,18 +1076,17 @@ bool imgLoader::PutIntoCache(nsIURI *key
            ("[this=%p] imgLoader::PutIntoCache -- Replacing cached element", nsnull));
 
     RemoveFromCache(key);
   } else {
     PR_LOG(gImgLog, PR_LOG_DEBUG,
            ("[this=%p] imgLoader::PutIntoCache -- Element NOT already in the cache", nsnull));
   }
 
-  if (!cache.Put(spec, entry))
-    return false;
+  cache.Put(spec, entry);
 
   // We can be called to resurrect an evicted entry.
   if (entry->Evicted())
     entry->SetEvicted(false);
 
   // If we're resurrecting an entry with no proxies, put it back in the
   // tracker and queue.
   if (entry->HasNoProxies()) {
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -449,22 +449,19 @@ mozJSComponentLoader::ReallyInit()
         do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
     if (!secman)
         return NS_ERROR_FAILURE;
 
     rv = secman->GetSystemPrincipal(getter_AddRefs(mSystemPrincipal));
     if (NS_FAILED(rv) || !mSystemPrincipal)
         return NS_ERROR_FAILURE;
 
-    if (!mModules.Init(32))
-        return NS_ERROR_OUT_OF_MEMORY;
-    if (!mImports.Init(32))
-        return NS_ERROR_OUT_OF_MEMORY;
-    if (!mInProgressImports.Init(32))
-        return NS_ERROR_OUT_OF_MEMORY;
+    mModules.Init(32);
+    mImports.Init(32);
+    mInProgressImports.Init(32);
 
     nsCOMPtr<nsIObserverService> obsSvc =
         do_GetService(kObserverServiceContractID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = obsSvc->AddObserver(this, "xpcom-shutdown-loaders", false);
     NS_ENSURE_SUCCESS(rv, rv);
 
@@ -602,18 +599,17 @@ mozJSComponentLoader::LoadModule(FileLoc
         /* XXX report error properly */
 #ifdef DEBUG
         fprintf(stderr, "mJCL: couldn't get nsIModule from jsval\n");
 #endif
         return NULL;
     }
 
     // Cache this module for later
-    if (!mModules.Put(spec, entry))
-        return NULL;
+    mModules.Put(spec, entry);
 
     // The hash owns the ModuleEntry now, forget about it
     return entry.forget();
 }
 
 // Some stack based classes for cleaning up on early return
 #ifdef HAVE_PR_MEMMAP
 class FileAutoCloser
@@ -1136,18 +1132,19 @@ mozJSComponentLoader::ImportInto(const n
     nsCAutoString key;
     rv = resolvedURI->GetSpec(key);
     NS_ENSURE_SUCCESS(rv, rv);
 
     ModuleEntry* mod;
     nsAutoPtr<ModuleEntry> newEntry;
     if (!mImports.Get(key, &mod) && !mInProgressImports.Get(key, &mod)) {
         newEntry = new ModuleEntry;
-        if (!newEntry || !mInProgressImports.Put(key, newEntry))
+        if (!newEntry)
             return NS_ERROR_OUT_OF_MEMORY;
+        mInProgressImports.Put(key, newEntry);
 
         JS::Anchor<jsval> exception(JSVAL_VOID);
         rv = GlobalForLocation(sourceLocalFile, resURI, &newEntry->global,
                                &newEntry->location, &exception.get());
 
         mInProgressImports.Remove(key);
 
         if (NS_FAILED(rv)) {
@@ -1251,18 +1248,17 @@ mozJSComponentLoader::ImportInto(const n
                      PromiseFlatCString(aLocation).get()));
             }
 #endif
         }
     }
 
     // Cache this module for later
     if (newEntry) {
-        if (!mImports.Put(key, newEntry))
-            return NS_ERROR_OUT_OF_MEMORY;
+        mImports.Put(key, newEntry);
         newEntry.forget();
     }
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 mozJSComponentLoader::Unload(const nsACString & aLocation)
--- a/js/xpconnect/src/dombindings.cpp
+++ b/js/xpconnect/src/dombindings.cpp
@@ -435,18 +435,18 @@ ListBase<LC>::getPrototype(JSContext *cx
         scope->GetCachedDOMPrototypes();
 
     JSObject *interfacePrototype;
     if (cache.IsInitialized()) {
         if (cache.Get(sInterfaceClass.name, &interfacePrototype)) {
             xpc_UnmarkGrayObject(interfacePrototype);
             return interfacePrototype;
         }
-    } else if (!cache.Init()) {
-        return NULL;
+    } else {
+        cache.Init();
     }
 
     JSObject* proto = Base::getPrototype(cx, scope, receiver);
     if (!proto)
         return NULL;
 
     JSObject *global = scope->GetGlobalJSObject();
     interfacePrototype = JS_NewObject(cx, Jsvalify(&sInterfacePrototypeClass), proto, global);
@@ -486,17 +486,17 @@ ListBase<LC>::getPrototype(JSContext *cx
     if (!JS_DefineProperty(cx, receiver, sInterfaceClass.name, OBJECT_TO_JSVAL(interface), NULL,
                            NULL, 0))
         return NULL;
 
     // This needs to happen after we've set all our own properties on interfacePrototype, to
     // overwrite the value set by InvalidateProtoShape_add when we set our own properties.
     js::SetReservedSlot(interfacePrototype, 0, PrivateUint32Value(USE_CACHE));
 
-    if (!cache.Put(sInterfaceClass.name, interfacePrototype))
+    if (!cache.Put(sInterfaceClass.name, interfacePrototype, fallible_t()))
         return NULL;
 
     return interfacePrototype;
 }
 
 template<class LC>
 JSObject *
 ListBase<LC>::create(JSContext *cx, JSObject *scope, ListType *aList,
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -4375,41 +4375,41 @@ xpc_NewSystemInheritingJSObject(JSContex
 
 nsISupports *
 XPC_GetIdentityObject(JSContext *cx, JSObject *obj);
 
 namespace xpc {
 
 struct CompartmentPrivate
 {
+    typedef nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *> ExpandoMap;
+    typedef nsTHashtable<nsPtrHashKey<JSObject> > DOMExpandoMap;
+
     CompartmentPrivate(bool wantXrays)
         : wantXrays(wantXrays)
     {
         MOZ_COUNT_CTOR(xpc::CompartmentPrivate);
     }
 
     ~CompartmentPrivate();
 
     bool wantXrays;
     nsAutoPtr<JSObject2JSObjectMap> waiverWrapperMap;
     // NB: we don't want this map to hold a strong reference to the wrapper.
-    nsAutoPtr<nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *> > expandoMap;
-    nsAutoPtr<nsTHashtable<nsPtrHashKey<JSObject> > > domExpandoMap;
+    nsAutoPtr<ExpandoMap> expandoMap;
+    nsAutoPtr<DOMExpandoMap> domExpandoMap;
     nsCString location;
 
     bool RegisterExpandoObject(XPCWrappedNative *wn, JSObject *expando) {
         if (!expandoMap) {
-            expandoMap = new nsDataHashtable<nsPtrHashKey<XPCWrappedNative>, JSObject *>();
-            if (!expandoMap->Init(8)) {
-                expandoMap = nsnull;
-                return false;
-            }
+            expandoMap = new ExpandoMap();
+            expandoMap->Init(8);
         }
         wn->SetHasExpandoObject();
-        return expandoMap->Put(wn, expando);
+        return expandoMap->Put(wn, expando, mozilla::fallible_t());
     }
 
     /**
      * This lookup does not change the color of the JSObject meaning that the
      * object returned is not guaranteed to be kept alive past the next CC.
      *
      * This should only be called if you are certain that the return value won't
      * be passed into a JS API function and that it won't be stored without
@@ -4425,23 +4425,20 @@ struct CompartmentPrivate
      */
     JSObject *LookupExpandoObject(XPCWrappedNative *wn) {
         JSObject *obj = LookupExpandoObjectPreserveColor(wn);
         return xpc_UnmarkGrayObject(obj);
     }
 
     bool RegisterDOMExpandoObject(JSObject *expando) {
         if (!domExpandoMap) {
-            domExpandoMap = new nsTHashtable<nsPtrHashKey<JSObject> >();
-            if (!domExpandoMap->Init(8)) {
-                domExpandoMap = nsnull;
-                return false;
-            }
+            domExpandoMap = new DOMExpandoMap();
+            domExpandoMap->Init(8);
         }
-        return domExpandoMap->PutEntry(expando);
+        return domExpandoMap->PutEntry(expando, mozilla::fallible_t());
     }
     void RemoveDOMExpandoObject(JSObject *expando) {
         if (domExpandoMap)
             domExpandoMap->RemoveEntry(expando);
     }
 };
 
 }
--- a/layout/base/RestyleTracker.h
+++ b/layout/base/RestyleTracker.h
@@ -71,18 +71,18 @@ public:
                     "Shouldn't have both restyle flags set");
     NS_PRECONDITION((mRestyleBits & ~ELEMENT_PENDING_RESTYLE_FLAGS) != 0,
                     "Must have root flag");
     NS_PRECONDITION((mRestyleBits & ~ELEMENT_PENDING_RESTYLE_FLAGS) !=
                     (ELEMENT_ALL_RESTYLE_FLAGS & ~ELEMENT_PENDING_RESTYLE_FLAGS),
                     "Shouldn't have both root flags");
   }
 
-  bool Init() {
-    return mPendingRestyles.Init();
+  void Init() {
+    mPendingRestyles.Init();
   }
 
   PRUint32 Count() const {
     return mPendingRestyles.Count();
   }
 
   /**
    * Add a restyle for the given element to the tracker.  Returns true
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -1390,19 +1390,18 @@ nsCSSFrameConstructor::nsCSSFrameConstru
   , mHoverGeneration(0)
   , mRebuildAllExtraHint(nsChangeHint(0))
   , mPendingRestyles(ELEMENT_HAS_PENDING_RESTYLE |
                      ELEMENT_IS_POTENTIAL_RESTYLE_ROOT, this)
   , mPendingAnimationRestyles(ELEMENT_HAS_PENDING_ANIMATION_RESTYLE |
                               ELEMENT_IS_POTENTIAL_ANIMATION_RESTYLE_ROOT, this)
 {
   // XXXbz this should be in Init() or something!
-  if (!mPendingRestyles.Init() || !mPendingAnimationRestyles.Init()) {
-    // now what?
-  }
+  mPendingRestyles.Init();
+  mPendingAnimationRestyles.Init();
 
 #ifdef DEBUG
   static bool gFirstTime = true;
   if (gFirstTime) {
     gFirstTime = false;
     char* flags = PR_GetEnv("GECKO_FRAMECTOR_DEBUG_FLAGS");
     if (flags) {
       bool error = false;
--- a/layout/base/nsCounterManager.cpp
+++ b/layout/base/nsCounterManager.cpp
@@ -270,20 +270,17 @@ nsCounterManager::AddResetOrIncrement(ns
 nsCounterList*
 nsCounterManager::CounterListFor(const nsSubstring& aCounterName)
 {
     // XXX Why doesn't nsTHashtable provide an API that allows us to use
     // get/put in one hashtable lookup?
     nsCounterList *counterList;
     if (!mNames.Get(aCounterName, &counterList)) {
         counterList = new nsCounterList();
-        if (!mNames.Put(aCounterName, counterList)) {
-            delete counterList;
-            return nsnull;
-        }
+        mNames.Put(aCounterName, counterList);
     }
     return counterList;
 }
 
 static PLDHashOperator
 RecalcDirtyLists(const nsAString& aKey, nsCounterList* aList, void* aClosure)
 {
     if (aList->IsDirty())
--- a/layout/base/nsLayoutHistoryState.cpp
+++ b/layout/base/nsLayoutHistoryState.cpp
@@ -91,23 +91,25 @@ NS_NewLayoutHistoryState(nsILayoutHistor
 NS_IMPL_ISUPPORTS2(nsLayoutHistoryState,
                    nsILayoutHistoryState,
                    nsISupportsWeakReference)
 
 nsresult
 nsLayoutHistoryState::Init()
 {
   mScrollPositionOnly = false;
-  return mStates.Init() ? NS_OK : NS_ERROR_FAILURE;
+  mStates.Init();
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLayoutHistoryState::AddState(const nsCString& aStateKey, nsPresState* aState)
 {
-  return mStates.Put(aStateKey, aState) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+  mStates.Put(aStateKey, aState);
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsLayoutHistoryState::GetState(const nsCString& aKey, nsPresState** aState)
 {
   bool entryExists = mStates.Get(aKey, aState);
 
   if (entryExists && mScrollPositionOnly) {
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -138,21 +138,17 @@ typedef FrameMetrics::ViewID ViewID;
 
 static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
 
 typedef nsDataHashtable<nsUint64HashKey, nsIContent*> ContentMap;
 static ContentMap* sContentMap = NULL;
 static ContentMap& GetContentMap() {
   if (!sContentMap) {
     sContentMap = new ContentMap();
-#ifdef DEBUG
-    nsresult rv =
-#endif
     sContentMap->Init();
-    NS_ABORT_IF_FALSE(NS_SUCCEEDED(rv), "Could not initialize map.");
   }
   return *sContentMap;
 }
 
 
 bool
 nsLayoutUtils::Are3DTransformsEnabled()
 {
--- a/layout/base/nsPresArena.cpp
+++ b/layout/base/nsPresArena.cpp
@@ -284,34 +284,32 @@ namespace {
 
 class FreeList : public PLDHashEntryHdr
 {
 public:
   typedef PRUint32 KeyType;
   nsTArray<void *> mEntries;
   size_t mEntrySize;
 
-protected:
   typedef const void* KeyTypePointer;
   KeyTypePointer mKey;
 
   FreeList(KeyTypePointer aKey) : mEntrySize(0), mKey(aKey) {}
   // Default copy constructor and destructor are ok.
 
   bool KeyEquals(KeyTypePointer const aKey) const
   { return mKey == aKey; }
 
   static KeyTypePointer KeyToPointer(KeyType aKey)
   { return NS_INT32_TO_PTR(aKey); }
 
   static PLDHashNumber HashKey(KeyTypePointer aKey)
   { return NS_PTR_TO_INT32(aKey); }
 
   enum { ALLOW_MEMMOVE = false };
-  friend class nsTHashtable<FreeList>;
 };
 
 }
 
 struct nsPresArena::State {
   nsTHashtable<FreeList> mFreeLists;
   PLArenaPool mPool;
 
@@ -332,19 +330,16 @@ struct nsPresArena::State {
     NS_ABORT_IF_FALSE(aSize > 0, "PresArena cannot allocate zero bytes");
 
     // We only hand out aligned sizes
     aSize = PL_ARENA_ALIGN(&mPool, aSize);
 
     // If there is no free-list entry for this type already, we have
     // to create one now, to record its size.
     FreeList* list = mFreeLists.PutEntry(aCode);
-    if (!list) {
-      return nsnull;
-    }
 
     nsTArray<void*>::index_type len = list->mEntries.Length();
     if (list->mEntrySize == 0) {
       NS_ABORT_IF_FALSE(len == 0, "list with entries but no recorded size");
       list->mEntrySize = aSize;
     } else {
       NS_ABORT_IF_FALSE(list->mEntrySize == aSize,
                         "different sizes for same object type code");
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -949,19 +949,19 @@ nsPresContext::Init(nsDeviceContext* aDe
 
   mDeviceContext = aDeviceContext;
   NS_ADDREF(mDeviceContext);
 
   if (mDeviceContext->SetPixelScale(mFullZoom))
     mDeviceContext->FlushFontCache();
   mCurAppUnitsPerDevPixel = AppUnitsPerDevPixel();
 
-  for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i)
-    if (!mImageLoaders[i].Init())
-      return NS_ERROR_OUT_OF_MEMORY;
+  for (PRUint32 i = 0; i < IMAGE_LOAD_TYPE_COUNT; ++i) {
+    mImageLoaders[i].Init();
+  }
 
   mEventManager = new nsEventStateManager();
   NS_ADDREF(mEventManager);
 
   mTransitionManager = new nsTransitionManager(this);
 
   mAnimationManager = new nsAnimationManager(this);
 
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -762,19 +762,17 @@ PresShell::Init(nsIDocument* aDocument,
       (nsnull == aViewManager)) {
     return NS_ERROR_NULL_POINTER;
   }
   if (mDocument) {
     NS_WARNING("PresShell double init'ed");
     return NS_ERROR_ALREADY_INITIALIZED;
   }
 
-  if (!mFramesToDirty.Init()) {
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
+  mFramesToDirty.Init();
 
   mDocument = aDocument;
   NS_ADDREF(mDocument);
   mViewManager = aViewManager;
 
   // Create our frame constructor.
   mFrameConstructor = new nsCSSFrameConstructor(mDocument, this);
 
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -582,19 +582,17 @@ TextOverflow::ProcessLine(const nsDispla
                mRight.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP,
                "TextOverflow with 'clip' for both sides");
   mLeft.Reset();
   mLeft.mActive = mLeft.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP;
   mRight.Reset();
   mRight.mActive = mRight.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP;
   
   FrameHashtable framesToHide;
-  if (!framesToHide.Init(100)) {
-    return;
-  }
+  framesToHide.Init(100);
   AlignmentEdges alignmentEdges;
   ExamineLineFrames(aLine, &framesToHide, &alignmentEdges);
   bool needLeft = mLeft.IsNeeded();
   bool needRight = mRight.IsNeeded();
   if (!needLeft && !needRight) {
     return;
   }
   NS_ASSERTION(mLeft.mStyle->mType != NS_STYLE_TEXT_OVERFLOW_CLIP ||
--- a/layout/inspector/src/nsFontFaceList.cpp
+++ b/layout/inspector/src/nsFontFaceList.cpp
@@ -123,16 +123,14 @@ nsFontFaceList::AddFontsFromTextRun(gfxT
       nsRefPtr<nsCSSFontFaceRule> rule;
       nsUserFontSet* fontSet =
         static_cast<nsUserFontSet*>(aFrame->PresContext()->GetUserFontSet());
       if (fontSet) {
         rule = fontSet->FindRuleForEntry(fe);
       }
       nsCOMPtr<nsFontFace> ff =
         new nsFontFace(fe, iter.GetGlyphRun()->mMatchType, rule);
-      if (!mFontFaces.Put(fe, ff)) {
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
+      mFontFaces.Put(fe, ff);
     }
   }
 
   return NS_OK;
 }
--- a/layout/style/Loader.cpp
+++ b/layout/style/Loader.cpp
@@ -1097,20 +1097,25 @@ Loader::CreateSheet(nsIURI* aURI,
                     const nsAString& aTitle,                       
                     StyleSheetState& aSheetState,
                     bool *aIsAlternate,
                     nsCSSStyleSheet** aSheet)
 {
   LOG(("css::Loader::CreateSheet"));
   NS_PRECONDITION(aSheet, "Null out param!");
 
-  NS_ENSURE_TRUE((mCompleteSheets.IsInitialized() || mCompleteSheets.Init()) &&
-                   (mLoadingDatas.IsInitialized() || mLoadingDatas.Init()) &&
-                   (mPendingDatas.IsInitialized() || mPendingDatas.Init()),
-                 NS_ERROR_OUT_OF_MEMORY);
+  if (!mCompleteSheets.IsInitialized()) {
+    mCompleteSheets.Init();
+  }
+  if (!mLoadingDatas.IsInitialized()) {
+    mLoadingDatas.Init();
+  }
+  if (!mPendingDatas.IsInitialized()) {
+    mPendingDatas.Init();
+  }
 
   nsresult rv = NS_OK;
   *aSheet = nsnull;
   aSheetState = eSheetStateUnknown;
 
   // Check the alternate state before doing anything else, because it
   // can mess with our hashtables.
   *aIsAlternate = IsAlternate(aTitle, aHasAlternateRel);
@@ -1592,24 +1597,17 @@ Loader::LoadSheet(SheetLoadData* aLoadDa
 #endif
 
   if (NS_FAILED(rv)) {
     LOG_ERROR(("  Failed to create stream loader"));
     SheetComplete(aLoadData, rv);
     return rv;
   }
 
-  if (!mLoadingDatas.Put(&key, aLoadData)) {
-    LOG_ERROR(("  Failed to put data in loading table"));
-    aLoadData->mIsCancelled = true;
-    channel->Cancel(NS_ERROR_OUT_OF_MEMORY);
-    SheetComplete(aLoadData, NS_ERROR_OUT_OF_MEMORY);
-    return NS_ERROR_OUT_OF_MEMORY;
-  }
-
+  mLoadingDatas.Put(&key, aLoadData);
   aLoadData->mIsLoading = true;
 
   return NS_OK;
 }
 
 /**
  * ParseSheet handles parsing the data stream.  The main idea here is
  * to push the current load data onto the parse stack before letting
@@ -1946,19 +1944,17 @@ Loader::LoadStyleLink(nsIContent* aEleme
                                           aObserver, principal);
   NS_ADDREF(data);
 
   // If we have to parse and it's an alternate non-inline, defer it
   if (aURL && state == eSheetNeedsParser && mLoadingDatas.Count() != 0 &&
       *aIsAlternate) {
     LOG(("  Deferring alternate sheet load"));
     URIAndPrincipalHashKey key(data->mURI, data->mLoaderPrincipal);
-    if (!mPendingDatas.Put(&key, data)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mPendingDatas.Put(&key, data);
 
     data->mMustNotify = true;
     return NS_OK;
   }
 
   // Load completion will free the data
   rv = LoadSheet(data, state);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -495,20 +495,17 @@ void nsTableFrame::ResetRowIndices(const
 {
   // Iterate over the row groups and adjust the row indices of all rows
   // omit the rowgroups that will be inserted later
   RowGroupArray rowGroups;
   OrderRowGroups(rowGroups);
 
   PRInt32 rowIndex = 0;
   nsTHashtable<nsPtrHashKey<nsTableRowGroupFrame> > excludeRowGroups;
-  if (!excludeRowGroups.Init()) {
-    NS_ERROR("Failed to initialize excludeRowGroups hash.");
-    return;
-  }
+  excludeRowGroups.Init();
   nsFrameList::Enumerator excludeRowGroupsEnumerator(aRowGroupsToExclude);
   while (!excludeRowGroupsEnumerator.AtEnd()) {
     excludeRowGroups.PutEntry(static_cast<nsTableRowGroupFrame*>(excludeRowGroupsEnumerator.get()));
     excludeRowGroupsEnumerator.Next();
   }
 
   for (PRUint32 rgX = 0; rgX < rowGroups.Length(); rgX++) {
     nsTableRowGroupFrame* rgFrame = rowGroups[rgX];
--- a/layout/xul/base/src/nsBoxObject.cpp
+++ b/layout/xul/base/src/nsBoxObject.cpp
@@ -338,25 +338,21 @@ nsBoxObject::GetPropertyAsSupports(const
 NS_IMETHODIMP
 nsBoxObject::SetPropertyAsSupports(const PRUnichar* aPropertyName, nsISupports* aValue)
 {
   NS_ENSURE_ARG(aPropertyName && *aPropertyName);
   
   if (!mPropertyTable) {  
     mPropertyTable = new nsInterfaceHashtable<nsStringHashKey,nsISupports>;  
     if (!mPropertyTable) return NS_ERROR_OUT_OF_MEMORY;
-    if (!mPropertyTable->Init(8)) {
-       mPropertyTable = nsnull;
-       return NS_ERROR_FAILURE;
-    }
+    mPropertyTable->Init(8);
   }
 
   nsDependentString propertyName(aPropertyName);
-  if (!mPropertyTable->Put(propertyName, aValue))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mPropertyTable->Put(propertyName, aValue);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsBoxObject::GetProperty(const PRUnichar* aPropertyName, PRUnichar** aResult)
 {
   nsCOMPtr<nsISupports> data;
   nsresult rv = GetPropertyAsSupports(aPropertyName,getter_AddRefs(data));
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -204,19 +204,19 @@ nsTreeBodyFrame::Init(nsIContent*     aC
                       nsIFrame*       aPrevInFlow)
 {
   nsresult rv = nsLeafBoxFrame::Init(aContent, aParent, aPrevInFlow);
   NS_ENSURE_SUCCESS(rv, rv);
 
   mIndentation = GetIndentation();
   mRowHeight = GetRowHeight();
 
-  NS_ENSURE_TRUE(mCreatedListeners.Init(), NS_ERROR_OUT_OF_MEMORY);
-
-  NS_ENSURE_TRUE(mImageCache.Init(16), NS_ERROR_OUT_OF_MEMORY);
+  mCreatedListeners.Init();
+
+  mImageCache.Init(16);
   EnsureBoxObject();
 
   return rv;
 }
 
 nsSize
 nsTreeBodyFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
 {
--- a/modules/libjar/zipwriter/src/nsZipWriter.cpp
+++ b/modules/libjar/zipwriter/src/nsZipWriter.cpp
@@ -229,18 +229,17 @@ nsresult nsZipWriter::ReadFile(nsIFile *
                     }
                     rv = header->ReadCDSHeader(inputStream);
                     if (NS_FAILED(rv)) {
                         inputStream->Close();
                         mEntryHash.Clear();
                         mHeaders.Clear();
                         return rv;
                     }
-                    if (!mEntryHash.Put(header->mName, mHeaders.Count()))
-                        return NS_ERROR_OUT_OF_MEMORY;
+                    mEntryHash.Put(header->mName, mHeaders.Count());
                     if (!mHeaders.AppendObject(header))
                         return NS_ERROR_OUT_OF_MEMORY;
                 }
 
                 return inputStream->Close();
             }
         }
 
@@ -611,20 +610,17 @@ NS_IMETHODIMP nsZipWriter::RemoveEntry(c
             inputStream->Close();
 
             // Rewrite header offsets and update hash
             PRUint32 shift = (mHeaders[pos + 1]->mOffset -
                               mHeaders[pos]->mOffset);
             mCDSOffset -= shift;
             PRInt32 pos2 = pos + 1;
             while (pos2 < mHeaders.Count()) {
-                if (!mEntryHash.Put(mHeaders[pos2]->mName, pos2-1)) {
-                    Cleanup();
-                    return NS_ERROR_OUT_OF_MEMORY;
-                }
+                mEntryHash.Put(mHeaders[pos2]->mName, pos2-1);
                 mHeaders[pos2]->mOffset -= shift;
                 pos2++;
             }
         }
         else {
             // Remove the last entry is just a case of moving the CDS
             mCDSOffset = mHeaders[pos]->mOffset;
             rv = SeekCDS();
@@ -799,20 +795,18 @@ nsresult nsZipWriter::InternalAddEntryDi
     nsresult rv = header->WriteFileHeader(mStream);
     if (NS_FAILED(rv)) {
         Cleanup();
         return rv;
     }
 
     mCDSDirty = true;
     mCDSOffset += header->GetFileHeaderLength();
-    if (!mEntryHash.Put(header->mName, mHeaders.Count())) {
-        Cleanup();
-        return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mEntryHash.Put(header->mName, mHeaders.Count());
+
     if (!mHeaders.AppendObject(header)) {
         Cleanup();
         return NS_ERROR_OUT_OF_MEMORY;
     }
 
     return NS_OK;
 }
 
@@ -851,20 +845,17 @@ void nsZipWriter::Cleanup()
 
 /*
  * Called when writing a file to the zip is complete.
  */
 nsresult nsZipWriter::EntryCompleteCallback(nsZipHeader* aHeader,
                                             nsresult aStatus)
 {
     if (NS_SUCCEEDED(aStatus)) {
-        if (!mEntryHash.Put(aHeader->mName, mHeaders.Count())) {
-            SeekCDS();
-            return NS_ERROR_OUT_OF_MEMORY;
-        }
+        mEntryHash.Put(aHeader->mName, mHeaders.Count());
         if (!mHeaders.AppendObject(aHeader)) {
             mEntryHash.Remove(aHeader->mName);
             SeekCDS();
             return NS_ERROR_OUT_OF_MEMORY;
         }
         mCDSDirty = true;
         mCDSOffset += aHeader->mCSize + aHeader->GetFileHeaderLength();
 
--- a/modules/libpref/src/Preferences.cpp
+++ b/modules/libpref/src/Preferences.cpp
@@ -1433,18 +1433,18 @@ Preferences::RegisterCallback(PrefChange
     observer->AppendClosure(aClosure);
     return NS_OK;
   }
 
   observer = new ValueObserver(aPref, aCallback);
   observer->AppendClosure(aClosure);
   nsresult rv = AddStrongObserver(observer, aPref);
   NS_ENSURE_SUCCESS(rv, rv);
-  return gObserverTable->Put(observer, observer) ? NS_OK :
-                                                   NS_ERROR_OUT_OF_MEMORY;
+  gObserverTable->Put(observer, observer);
+  return NS_OK;
 }
 
 // static
 nsresult
 Preferences::UnregisterCallback(PrefChangedFunc aCallback,
                                 const char* aPref,
                                 void* aClosure)
 {
--- a/modules/libpref/src/nsPrefBranch.cpp
+++ b/modules/libpref/src/nsPrefBranch.cpp
@@ -586,22 +586,17 @@ NS_IMETHODIMP nsPrefBranch::AddObserver(
   }
 
   if (mObservers.Get(pCallback)) {
     NS_WARNING("Ignoring duplicate observer.");
     delete pCallback;
     return NS_OK;
   }
 
-  bool putSucceeded = mObservers.Put(pCallback, pCallback);
-
-  if (!putSucceeded) {
-    delete pCallback;
-    return NS_ERROR_FAILURE;
-  }
+  mObservers.Put(pCallback, pCallback);
 
   // We must pass a fully qualified preference name to the callback
   // aDomain == nsnull is the only possible failure, and we trapped it with
   // NS_ENSURE_ARG above.
   pref = getPrefName(aDomain);
   PREF_RegisterCallback(pref, NotifyObserver, pCallback);
   return NS_OK;
 }
--- a/netwerk/base/src/nsProtocolProxyService.cpp
+++ b/netwerk/base/src/nsProtocolProxyService.cpp
@@ -331,18 +331,17 @@ nsProtocolProxyService::~nsProtocolProxy
     NS_ASSERTION(mHostFiltersArray.Length() == 0 && mFilters == nsnull &&
                  mPACMan == nsnull, "what happened to xpcom-shutdown?");
 }
 
 // nsProtocolProxyService methods
 nsresult
 nsProtocolProxyService::Init()
 {
-    if (!mFailedProxies.Init())
-        return NS_ERROR_OUT_OF_MEMORY;
+    mFailedProxies.Init();
 
     // failure to access prefs is non-fatal
     nsCOMPtr<nsIPrefBranch> prefBranch =
             do_GetService(NS_PREFSERVICE_CONTRACTID);
     if (prefBranch) {
         // monitor proxy prefs
         prefBranch->AddObserver(PROXY_PREF_BRANCH, this, false);
 
--- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp
+++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp
@@ -1177,26 +1177,25 @@ nsOfflineCacheDevice::Init()
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 nsresult
 nsOfflineCacheDevice::InitActiveCaches()
 {
-  NS_ENSURE_TRUE(mCaches.Init(), NS_ERROR_OUT_OF_MEMORY);
-  NS_ENSURE_TRUE(mActiveCachesByGroup.Init(), NS_ERROR_OUT_OF_MEMORY);
-
-  nsresult rv = mActiveCaches.Init(5);
-  NS_ENSURE_SUCCESS(rv, rv);
+  mCaches.Init();
+  mActiveCachesByGroup.Init();
+
+  mActiveCaches.Init(5);
 
   AutoResetStatement statement(mStatement_EnumerateGroups);
 
   bool hasRows;
-  rv = statement->ExecuteStep(&hasRows);
+  nsresult rv = statement->ExecuteStep(&hasRows);
   NS_ENSURE_SUCCESS(rv, rv);
 
   while (hasRows)
   {
     nsCAutoString group;
     statement->GetUTF8String(0, group);
     nsCString clientID;
     statement->GetUTF8String(1, clientID);
--- a/netwerk/dns/nsEffectiveTLDService.cpp
+++ b/netwerk/dns/nsEffectiveTLDService.cpp
@@ -67,18 +67,17 @@ nsresult
 nsEffectiveTLDService::Init()
 {
   NS_TIME_FUNCTION;
 
   // We'll probably have to rehash at least once, since nsTHashtable doesn't
   // use a perfect hash, but at least we'll save a few rehashes along the way.
   // Next optimization here is to precompute the hash using something like
   // gperf, but one step at a time.  :-)
-  if (!mHash.Init(ArrayLength(gEntries) - 1))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mHash.Init(ArrayLength(gEntries) - 1);
 
   nsresult rv;
   mIDNService = do_GetService(NS_IDNSERVICE_CONTRACTID, &rv);
   if (NS_FAILED(rv)) return rv;
 
   // Initialize eTLD hash from static array
   for (PRUint32 i = 0; i < ArrayLength(gEntries) - 1; i++) {
 #ifdef DEBUG
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -152,18 +152,17 @@ nsResProtocolHandler::nsResProtocolHandl
 nsResProtocolHandler::~nsResProtocolHandler()
 {
     gResHandler = nsnull;
 }
 
 nsresult
 nsResProtocolHandler::Init()
 {
-    if (!mSubstitutions.Init(32))
-        return NS_ERROR_UNEXPECTED;
+    mSubstitutions.Init(32);
 
     nsresult rv;
 
     mIOService = do_GetIOService(&rv);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCAutoString appURI, greURI;
     rv = mozilla::Omnijar::GetURIString(mozilla::Omnijar::APP, appURI);
@@ -357,30 +356,32 @@ nsResProtocolHandler::SetSubstitution(co
         return NS_OK;
     }
 
     // If baseURI isn't a resource URI, we can set the substitution immediately.
     nsCAutoString scheme;
     nsresult rv = baseURI->GetScheme(scheme);
     NS_ENSURE_SUCCESS(rv, rv);
     if (!scheme.Equals(NS_LITERAL_CSTRING("resource"))) {
-        return mSubstitutions.Put(root, baseURI) ? NS_OK : NS_ERROR_UNEXPECTED;
+        mSubstitutions.Put(root, baseURI);
+        return NS_OK;
     }
 
     // baseURI is a resource URI, let's resolve it first.
     nsCAutoString newBase;
     rv = ResolveURI(baseURI, newBase);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIURI> newBaseURI;
     rv = mIOService->NewURI(newBase, nsnull, nsnull,
                             getter_AddRefs(newBaseURI));
     NS_ENSURE_SUCCESS(rv, rv);
 
-    return mSubstitutions.Put(root, newBaseURI) ? NS_OK : NS_ERROR_UNEXPECTED;
+    mSubstitutions.Put(root, newBaseURI);
+    return NS_OK;
 }
 
 NS_IMETHODIMP
 nsResProtocolHandler::GetSubstitution(const nsACString& root, nsIURI **result)
 {
     NS_ENSURE_ARG_POINTER(result);
 
     if (mSubstitutions.Get(root, result))
--- a/parser/html/nsHtml5AtomTable.h
+++ b/parser/html/nsHtml5AtomTable.h
@@ -105,21 +105,20 @@ class nsHtml5AtomEntry : public nsString
  */
 class nsHtml5AtomTable
 {
   public:
     nsHtml5AtomTable();
     ~nsHtml5AtomTable();
     
     /**
-     * Must be called after the constructor before use. Returns true
-     * when successful and false on OOM failure.
+     * Must be called after the constructor before use.
      */
-    inline bool Init() {
-      return mTable.Init();
+    inline void Init() {
+      mTable.Init();
     }
     
     /**
      * Obtains the atom for the given string in the scope of this atom table.
      */
     nsIAtom* GetAtom(const nsAString& aKey);
     
     /**
--- a/parser/html/nsHtml5StringParser.cpp
+++ b/parser/html/nsHtml5StringParser.cpp
@@ -48,17 +48,17 @@
 NS_IMPL_ISUPPORTS0(nsHtml5StringParser)
 
 nsHtml5StringParser::nsHtml5StringParser()
   : mExecutor(new nsHtml5TreeOpExecutor(true))
   , mTreeBuilder(new nsHtml5TreeBuilder(mExecutor, nsnull))
   , mTokenizer(new nsHtml5Tokenizer(mTreeBuilder, false))
 {
   MOZ_COUNT_CTOR(nsHtml5StringParser);
-  mAtomTable.Init(); // we aren't checking for OOM anyway...
+  mAtomTable.Init();
   mTokenizer->setInterner(&mAtomTable);
 }
 
 nsHtml5StringParser::~nsHtml5StringParser()
 {
   MOZ_COUNT_DTOR(nsHtml5StringParser);
 }
 
--- a/rdf/base/src/nsRDFXMLSerializer.cpp
+++ b/rdf/base/src/nsRDFXMLSerializer.cpp
@@ -249,40 +249,43 @@ nsRDFXMLSerializer::RegisterQName(nsIRDF
     aResource->GetValueUTF8(uri);
 
     nsNameSpaceMap::const_iterator iter = mNameSpaces.GetNameSpaceOf(uri);
     if (iter != mNameSpaces.last()) {
         NS_ENSURE_TRUE(iter->mPrefix, NS_ERROR_UNEXPECTED);
         iter->mPrefix->ToUTF8String(qname);
         qname.Append(':');
         qname += StringTail(uri, uri.Length() - iter->mURI.Length());
-        return mQNames.Put(aResource, qname) ? NS_OK : NS_ERROR_FAILURE;
+        mQNames.Put(aResource, qname);
+        return NS_OK;
     }
 
     // Okay, so we don't have it in our map. Try to make one up. This
     // is very bogus.
     PRInt32 i = uri.RFindChar('#'); // first try a '#'
     if (i == -1) {
         i = uri.RFindChar('/');
         if (i == -1) {
             // Okay, just punt and assume there is _no_ namespace on
             // this thing...
-            return mQNames.Put(aResource, uri) ? NS_OK : NS_ERROR_FAILURE;
+            mQNames.Put(aResource, uri);
+            return NS_OK;
         }
     }
 
     // Take whatever is to the right of the '#' or '/' and call it the
     // local name, make up a prefix.
     nsCOMPtr<nsIAtom> prefix = EnsureNewPrefix();
     mNameSpaces.Put(StringHead(uri, i+1), prefix);
     prefix->ToUTF8String(qname);
     qname.Append(':');
     qname += StringTail(uri, uri.Length() - (i + 1));
 
-    return mQNames.Put(aResource, qname) ? NS_OK : NS_ERROR_FAILURE;
+    mQNames.Put(aResource, qname);
+    return NS_OK;
 }
 
 nsresult
 nsRDFXMLSerializer::GetQName(nsIRDFResource* aResource, nsCString& aQName)
 {
     return mQNames.Get(aResource, &aQName) ? NS_OK : NS_ERROR_UNEXPECTED;
 }
 
--- a/security/manager/boot/src/nsStrictTransportSecurityService.cpp
+++ b/security/manager/boot/src/nsStrictTransportSecurityService.cpp
@@ -109,18 +109,18 @@ nsStrictTransportSecurityService::Init()
      do_GetService(NS_PRIVATE_BROWSING_SERVICE_CONTRACTID);
    if (pbs)
      pbs->GetPrivateBrowsingEnabled(&mInPrivateMode);
 
    mObserverService = mozilla::services::GetObserverService();
    if (mObserverService)
      mObserverService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, false);
 
-   if (mInPrivateMode && !mPrivateModeHostTable.Init())
-     return NS_ERROR_OUT_OF_MEMORY;
+   if (mInPrivateMode)
+     mPrivateModeHostTable.Init();
 
    return NS_OK;
 }
 
 nsresult
 nsStrictTransportSecurityService::GetHost(nsIURI *aURI, nsACString &aResult)
 {
   nsCOMPtr<nsIURI> innerURI = NS_GetInnermostURI(aURI);
@@ -395,19 +395,18 @@ nsStrictTransportSecurityService::Observ
                                           const char *topic,
                                           const PRUnichar *data)
 {
   if (strcmp(topic, NS_PRIVATE_BROWSING_SWITCH_TOPIC) == 0) {
     if(NS_LITERAL_STRING(NS_PRIVATE_BROWSING_ENTER).Equals(data)) {
       // Indication to start recording stuff locally and not writing changes
       // out to the permission manager.
 
-      if (!mPrivateModeHostTable.IsInitialized()
-          && !mPrivateModeHostTable.Init()) {
-        return NS_ERROR_OUT_OF_MEMORY;
+      if (!mPrivateModeHostTable.IsInitialized()) {
+        mPrivateModeHostTable.Init();
       }
       mInPrivateMode = true;
     }
     else if (NS_LITERAL_STRING(NS_PRIVATE_BROWSING_LEAVE).Equals(data)) {
       mPrivateModeHostTable.Clear();
       mInPrivateMode = false;
     }
   }
--- a/security/manager/ssl/src/nsCertOverrideService.cpp
+++ b/security/manager/ssl/src/nsCertOverrideService.cpp
@@ -131,18 +131,17 @@ nsCertOverrideService::~nsCertOverrideSe
 nsresult
 nsCertOverrideService::Init()
 {
   if (!NS_IsMainThread()) {
     NS_NOTREACHED("nsCertOverrideService initialized off main thread");
     return NS_ERROR_NOT_SAME_THREAD;
   }
 
-  if (!mSettingsTable.Init())
-    return NS_ERROR_OUT_OF_MEMORY;
+  mSettingsTable.Init();
 
   mOidTagForStoringNewHashes = SEC_OID_SHA256;
 
   SECOidData *od = SECOID_FindOIDByTag(mOidTagForStoringNewHashes);
   if (!od)
     return NS_ERROR_FAILURE;
 
   char *dotted_oid = CERT_GetOidString(&od->oid);
--- a/security/manager/ssl/src/nsCertTree.cpp
+++ b/security/manager/ssl/src/nsCertTree.cpp
@@ -492,18 +492,17 @@ nsCertTree::GetCertsByTypeFromCertList(C
   PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("GetCertsByTypeFromCertList"));
   if (!aCertList)
     return NS_ERROR_FAILURE;
 
   if (!mOriginalOverrideService)
     return NS_ERROR_FAILURE;
 
   nsTHashtable<nsCStringHashKey> allHostPortOverrideKeys;
-  if (!allHostPortOverrideKeys.Init())
-    return NS_ERROR_OUT_OF_MEMORY;
+  allHostPortOverrideKeys.Init();
 
   if (aWantedType == nsIX509Cert::SERVER_CERT) {
     mOriginalOverrideService->
       EnumerateCertOverrides(nsnull, 
                              CollectAllHostPortOverridesCallback, 
                              &allHostPortOverrideKeys);
   }
 
--- a/security/manager/ssl/src/nsClientAuthRemember.cpp
+++ b/security/manager/ssl/src/nsClientAuthRemember.cpp
@@ -76,18 +76,17 @@ nsClientAuthRememberService::~nsClientAu
 nsresult
 nsClientAuthRememberService::Init()
 {
   if (!NS_IsMainThread()) {
     NS_ERROR("nsClientAuthRememberService::Init called off the main thread");
     return NS_ERROR_NOT_SAME_THREAD;
   }
 
-  if (!mSettingsTable.Init())
-    return NS_ERROR_OUT_OF_MEMORY;
+  mSettingsTable.Init();
 
   nsCOMPtr<nsIObserverService> observerService =
       mozilla::services::GetObserverService();
   if (observerService) {
     observerService->AddObserver(this, "profile-before-change", true);
   }
 
   return NS_OK;
--- a/storage/public/StatementCache.h
+++ b/storage/public/StatementCache.h
@@ -66,19 +66,17 @@ public:
    * @param aConnection
    *        A reference to the nsCOMPtr for the connection this cache is to be
    *        used for.  This nsCOMPtr must at least live as long as this class,
    *        otherwise crashes will happen.
    */
   StatementCache(nsCOMPtr<mozIStorageConnection>& aConnection)
   : mConnection(aConnection)
   {
-    if (!mCachedStatements.Init()) {
-      NS_ERROR("Out of memory!?");
-    }
+    mCachedStatements.Init();
   }
 
   /**
    * Obtains a cached statement.  If this statement is not yet created, it will
    * be created and stored for later use.
    *
    * @param aQuery
    *        The SQL string (either a const char [] or nsACString) to get a
@@ -89,19 +87,17 @@ public:
   already_AddRefed<StatementType>
   GetCachedStatement(const nsACString& aQuery)
   {
     nsCOMPtr<StatementType> stmt;
     if (!mCachedStatements.Get(aQuery, getter_AddRefs(stmt))) {
       stmt = CreateStatement(aQuery);
       NS_ENSURE_TRUE(stmt, nsnull);
 
-      if (!mCachedStatements.Put(aQuery, stmt)) {
-        NS_ERROR("Out of memory!?");
-      }
+      mCachedStatements.Put(aQuery, stmt);
     }
     return stmt.forget();
   }
 
   template<int N>
   NS_ALWAYS_INLINE already_AddRefed<StatementType>
   GetCachedStatement(const char (&aQuery)[N])
   {
--- a/storage/src/mozStorageBindingParams.cpp
+++ b/storage/src/mozStorageBindingParams.cpp
@@ -304,18 +304,17 @@ BindingParams::BindByName(const nsACStri
 }
 
 NS_IMETHODIMP
 AsyncBindingParams::BindByName(const nsACString &aName,
                                nsIVariant *aValue)
 {
   NS_ENSURE_FALSE(mLocked, NS_ERROR_UNEXPECTED);
 
-  if (!mNamedParameters.Put(aName, aValue))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mNamedParameters.Put(aName, aValue);
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 BindingParams::BindUTF8StringByName(const nsACString &aName,
                                     const nsACString &aValue)
 {
--- a/storage/src/mozStorageConnection.cpp
+++ b/storage/src/mozStorageConnection.cpp
@@ -1418,18 +1418,17 @@ Connection::CreateFunction(const nsACStr
                                       NULL,
                                       NULL);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
   FunctionInfo info = { aFunction,
                         Connection::FunctionInfo::SIMPLE,
                         aNumArguments };
-  NS_ENSURE_TRUE(mFunctions.Put(aFunctionName, info),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mFunctions.Put(aFunctionName, info);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Connection::CreateAggregateFunction(const nsACString &aFunctionName,
                                     PRInt32 aNumArguments,
                                     mozIStorageAggregateFunction *aFunction)
@@ -1454,18 +1453,17 @@ Connection::CreateAggregateFunction(cons
                                       aggregateFunctionStepHelper,
                                       aggregateFunctionFinalHelper);
   if (srv != SQLITE_OK)
     return convertResultCode(srv);
 
   FunctionInfo info = { aFunction,
                         Connection::FunctionInfo::AGGREGATE,
                         aNumArguments };
-  NS_ENSURE_TRUE(mFunctions.Put(aFunctionName, info),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mFunctions.Put(aFunctionName, info);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 Connection::RemoveFunction(const nsACString &aFunctionName)
 {
   if (!mDBConn) return NS_ERROR_NOT_INITIALIZED;
--- a/storage/src/mozStorageRow.cpp
+++ b/storage/src/mozStorageRow.cpp
@@ -49,17 +49,17 @@ namespace storage {
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Row
 
 nsresult
 Row::initialize(sqlite3_stmt *aStatement)
 {
   // Initialize the hash table
-  NS_ENSURE_TRUE(mNameHashtable.Init(), NS_ERROR_OUT_OF_MEMORY);
+  mNameHashtable.Init();
 
   // Get the number of results
   mNumCols = ::sqlite3_column_count(aStatement);
 
   // Start copying over values
   for (PRUint32 i = 0; i < mNumCols; i++) {
     // Store the value
     nsIVariant *variant = nsnull;
--- a/toolkit/components/places/History.cpp
+++ b/toolkit/components/places/History.cpp
@@ -1933,18 +1933,17 @@ History::RegisterVisitedCallback(nsIURI*
 {
   NS_ASSERTION(aURI, "Must pass a non-null URI!");
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
     NS_PRECONDITION(aLink, "Must pass a non-null Link!");
   }
 
   // First, ensure that our hash table is setup.
   if (!mObservers.IsInitialized()) {
-    NS_ENSURE_TRUE(mObservers.Init(VISIT_OBSERVERS_INITIAL_CACHE_SIZE),
-                   NS_ERROR_OUT_OF_MEMORY);
+    mObservers.Init(VISIT_OBSERVERS_INITIAL_CACHE_SIZE);
   }
 
   // Obtain our array of observers for this URI.
 #ifdef DEBUG
   bool keyAlreadyExists = !!mObservers.GetEntry(aURI);
 #endif
   KeyClass* key = mObservers.PutEntry(aURI);
   NS_ENSURE_TRUE(key, NS_ERROR_OUT_OF_MEMORY);
--- a/toolkit/components/places/nsFaviconService.cpp
+++ b/toolkit/components/places/nsFaviconService.cpp
@@ -135,22 +135,18 @@ nsFaviconService::~nsFaviconService()
 
 
 nsresult
 nsFaviconService::Init()
 {
   mDB = Database::GetDatabase();
   NS_ENSURE_STATE(mDB);
 
-  // Init failed favicon cache.
-  if (!mFailedFavicons.Init(MAX_FAVICON_CACHE_SIZE))
-    return NS_ERROR_OUT_OF_MEMORY;
-
-  if (!mUnassociatedIcons.Init(MAX_UNASSOCIATED_FAVICONS))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mFailedFavicons.Init(MAX_FAVICON_CACHE_SIZE);
+  mUnassociatedIcons.Init(MAX_UNASSOCIATED_FAVICONS);
 
   mOptimizedIconDimension = Preferences::GetInt(
     "places.favicons.optimizeToDimension", OPTIMIZED_FAVICON_DIMENSION
   );
 
   mExpireUnassociatedIconsTimer = do_CreateInstance("@mozilla.org/timer;1");
   NS_ENSURE_STATE(mExpireUnassociatedIconsTimer);
 
@@ -975,18 +971,17 @@ NS_IMETHODIMP
 nsFaviconService::AddFailedFavicon(nsIURI* aFaviconURI)
 {
   NS_ENSURE_ARG(aFaviconURI);
 
   nsCAutoString spec;
   nsresult rv = aFaviconURI->GetSpec(spec);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (! mFailedFavicons.Put(spec, mFailedFaviconSerial))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mFailedFavicons.Put(spec, mFailedFaviconSerial);
   mFailedFaviconSerial ++;
 
   if (mFailedFavicons.Count() > MAX_FAVICON_CACHE_SIZE) {
     // need to expire some entries, delete the FAVICON_CACHE_REDUCE_COUNT number
     // of items that are the oldest
     PRUint32 threshold = mFailedFaviconSerial -
                          MAX_FAVICON_CACHE_SIZE + FAVICON_CACHE_REDUCE_COUNT;
     mFailedFavicons.Enumerate(ExpireFailedFaviconsCallback, &threshold);
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -2672,18 +2672,17 @@ nsNavBookmarks::EnsureKeywordsHash() {
   while (NS_SUCCEEDED(stmt->ExecuteStep(&hasMore)) && hasMore) {
     PRInt64 itemId;
     rv = stmt->GetInt64(0, &itemId);
     NS_ENSURE_SUCCESS(rv, rv);
     nsAutoString keyword;
     rv = stmt->GetString(1, keyword);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    rv = mBookmarkToKeywordHash.Put(itemId, keyword);
-    NS_ENSURE_SUCCESS(rv, rv);
+    mBookmarkToKeywordHash.Put(itemId, keyword);
   }
 
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsNavBookmarks::RunInBatchMode(nsINavHistoryBatchCallback* aCallback,
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -336,26 +336,22 @@ nsNavHistory::Init()
   NS_TIME_FUNCTION;
 
   LoadPrefs();
 
   mDB = Database::GetDatabase();
   NS_ENSURE_STATE(mDB);
 
   // recent events hash tables
-  NS_ENSURE_TRUE(mRecentTyped.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
-                 NS_ERROR_OUT_OF_MEMORY);
-  NS_ENSURE_TRUE(mRecentLink.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
-                 NS_ERROR_OUT_OF_MEMORY);
-  NS_ENSURE_TRUE(mRecentBookmark.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mRecentTyped.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE);
+  mRecentLink.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE);
+  mRecentBookmark.Init(RECENT_EVENTS_INITIAL_CACHE_SIZE);
 
   // Embed visits hash table.
-  NS_ENSURE_TRUE(mEmbedVisits.Init(EMBED_VISITS_INITIAL_CACHE_SIZE),
-                 NS_ERROR_OUT_OF_MEMORY);
+  mEmbedVisits.Init(EMBED_VISITS_INITIAL_CACHE_SIZE);
 
   /*****************************************************************************
    *** IMPORTANT NOTICE!
    ***
    *** Nothing after these add observer calls should return anything but NS_OK.
    *** If a failure code is returned, this nsNavHistory object will be held onto
    *** by the observer service and the preference service. 
    ****************************************************************************/
--- a/toolkit/components/places/nsNavHistoryResult.cpp
+++ b/toolkit/components/places/nsNavHistoryResult.cpp
@@ -4342,18 +4342,17 @@ nsNavHistoryResult::Init(nsINavHistoryQu
       return NS_ERROR_OUT_OF_MEMORY;
   }
   rv = aOptions->Clone(getter_AddRefs(mOptions));
   NS_ENSURE_SUCCESS(rv, rv);
   mSortingMode = aOptions->SortingMode();
   rv = aOptions->GetSortingAnnotation(mSortingAnnotation);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  if (!mBookmarkFolderObservers.Init(128))
-    return NS_ERROR_OUT_OF_MEMORY;
+  mBookmarkFolderObservers.Init(128);
 
   NS_ASSERTION(mRootNode->mIndentLevel == -1,
                "Root node's indent level initialized wrong");
   mRootNode->FillStats();
 
   return NS_OK;
 }
 
--- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp
@@ -4392,19 +4392,17 @@ nsUrlClassifierDBService::GetTables(nsIU
   return mWorkerProxy->GetTables(proxyCallback);
 }
 
 NS_IMETHODIMP
 nsUrlClassifierDBService::SetHashCompleter(const nsACString &tableName,
                                            nsIUrlClassifierHashCompleter *completer)
 {
   if (completer) {
-    if (!mCompleters.Put(tableName, completer)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mCompleters.Put(tableName, completer);
   } else {
     mCompleters.Remove(tableName);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/toolkit/crashreporter/nsExceptionHandler.cpp
+++ b/toolkit/crashreporter/nsExceptionHandler.cpp
@@ -692,18 +692,17 @@ nsresult SetExceptionHandler(nsILocalFil
   crashReporterAPILock = new Mutex("crashReporterAPILock");
   NS_ASSERTION(!notesFieldLock, "Shouldn't have a lock yet");
   notesFieldLock = new Mutex("notesFieldLock");
 
   crashReporterAPIData_Hash =
     new nsDataHashtable<nsCStringHashKey,nsCString>();
   NS_ENSURE_TRUE(crashReporterAPIData_Hash, NS_ERROR_OUT_OF_MEMORY);
 
-  rv = crashReporterAPIData_Hash->Init();
-  NS_ENSURE_SUCCESS(rv, rv);
+  crashReporterAPIData_Hash->Init();
 
   notesField = new nsCString();
   NS_ENSURE_TRUE(notesField, NS_ERROR_OUT_OF_MEMORY);
 
   // locate crashreporter executable
   nsCOMPtr<nsIFile> exePath;
   rv = aXREDirectory->Clone(getter_AddRefs(exePath));
   NS_ENSURE_SUCCESS(rv, rv);
@@ -1282,18 +1281,17 @@ nsresult AnnotateCrashReport(const nsACS
     }
     if (!reporter->SendAnnotateCrashReport(nsCString(key), escapedData))
       return NS_ERROR_FAILURE;
     return NS_OK;
   }
 
   MutexAutoLock lock(*crashReporterAPILock);
 
-  rv = crashReporterAPIData_Hash->Put(key, escapedData);
-  NS_ENSURE_SUCCESS(rv, rv);
+  crashReporterAPIData_Hash->Put(key, escapedData);
 
   // now rebuild the file contents
   crashReporterAPIData->Truncate(0);
   crashReporterAPIData_Hash->EnumerateRead(EnumerateEntries,
                                            crashReporterAPIData);
 
   return NS_OK;
 }
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -771,17 +771,18 @@ void
 nsAppShell::OnResume()
 {
 }
 
 nsresult
 nsAppShell::AddObserver(const nsAString &aObserverKey, nsIObserver *aObserver)
 {
     NS_ASSERTION(aObserver != nsnull, "nsAppShell::AddObserver: aObserver is null!");
-    return mObserversHash.Put(aObserverKey, aObserver) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+    mObserversHash.Put(aObserverKey, aObserver);
+    return NS_OK;
 }
 
 /**
  * The XPCOM event that will call the observer on the main thread.
  */
 class ObserverCaller : public nsRunnable {
 public:
     ObserverCaller(nsIObserver *aObserver, const char *aTopic, const PRUnichar *aData) :
--- a/xpcom/components/nsCategoryManager.cpp
+++ b/xpcom/components/nsCategoryManager.cpp
@@ -237,21 +237,17 @@ EntryEnumerator::Create(nsTHashtable<Cat
 
 CategoryNode*
 CategoryNode::Create(PLArenaPool* aArena)
 {
   CategoryNode* node = new(aArena) CategoryNode();
   if (!node)
     return nsnull;
 
-  if (!node->mTable.Init()) {
-    delete node;
-    return nsnull;
-  }
-
+  node->mTable.Init();
   return node;
 }
 
 CategoryNode::~CategoryNode()
 {
 }
 
 void*
--- a/xpcom/components/nsNativeComponentLoader.cpp
+++ b/xpcom/components/nsNativeComponentLoader.cpp
@@ -100,18 +100,18 @@ NS_IMPL_RELEASE_USING_AGGREGATOR(nsNativ
                                  nsComponentManagerImpl::gComponentManager)
 
 nsresult
 nsNativeModuleLoader::Init()
 {
     NS_ASSERTION(NS_IsMainThread(), "Startup not on main thread?");
 
     LOG(PR_LOG_DEBUG, ("nsNativeModuleLoader::Init()"));
-
-    return mLibraries.Init() ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
+    mLibraries.Init();
+    return NS_OK;
 }
 
 class LoadModuleMainThreadRunnable : public nsRunnable
 {
 public:
     LoadModuleMainThreadRunnable(nsNativeModuleLoader* loader,
                                  FileLocation &file)
         : mLoader(loader)
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -555,21 +555,22 @@ RegisterStaticAtoms(const nsStaticAtom* 
 {
   // this does three things:
   // 1) wraps each static atom in a wrapper, if necessary
   // 2) initializes the address pointed to by each mBits slot
   // 3) puts the atom into the static atom table as well
   
   if (!gStaticAtomTable && !gStaticAtomTableSealed) {
     gStaticAtomTable = new nsDataHashtable<nsStringHashKey, nsIAtom*>();
-    if (!gStaticAtomTable || !gStaticAtomTable->Init()) {
+    if (!gStaticAtomTable) {
       delete gStaticAtomTable;
       gStaticAtomTable = nsnull;
       return NS_ERROR_OUT_OF_MEMORY;
     }
+    gStaticAtomTable->Init();
   }
   
   for (PRUint32 i=0; i<aAtomCount; i++) {
 #ifdef NS_STATIC_ATOM_USE_WIDE_STRINGS
     NS_ASSERTION(nsCRT::IsAscii((PRUnichar*)aAtoms[i].mStringBuffer->Data()),
                  "Static atoms must be ASCII!");
 
     PRUint32 stringLen =
--- a/xpcom/ds/nsCheapSets.h
+++ b/xpcom/ds/nsCheapSets.h
@@ -119,32 +119,26 @@ nsCheapSet<EntryType>::Put(const KeyType
     mState = ONE;
     return NS_OK;
   case ONE:
     {
       nsTHashtable<EntryType> *table = new nsTHashtable<EntryType>();
       if (!table) {
         return NS_ERROR_OUT_OF_MEMORY;
       }
-      if (!table->Init()) {
-        return NS_ERROR_FAILURE;
-      }
+      table->Init();
       EntryType *entry = GetSingleEntry();
-      if (!table->PutEntry(entry->GetKey())) {
-        return NS_ERROR_OUT_OF_MEMORY;
-      }
+      table->PutEntry(entry->GetKey());
       entry->~EntryType();
       mUnion.table = table;
       mState = MANY;
     }
     // Fall through.
   case MANY:
-    if (!mUnion.table->PutEntry(aVal)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
+    mUnion.table->PutEntry(aVal);
     return NS_OK;
   default:
     NS_NOTREACHED("bogus state");
     return NS_OK;
   }
 }
 
 template<typename EntryType>
--- a/xpcom/ds/nsHashPropertyBag.cpp
+++ b/xpcom/ds/nsHashPropertyBag.cpp
@@ -76,19 +76,17 @@ NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
   NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
   NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
 NS_INTERFACE_MAP_END
 
 nsresult
 nsHashPropertyBag::Init()
 {
-    // we can only assume that Init will fail only due to OOM.
-    if (!mPropertyHash.Init())
-        return NS_ERROR_OUT_OF_MEMORY;
+    mPropertyHash.Init();
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHashPropertyBag::HasKey(const nsAString& name, bool *aResult)
 {
     *aResult = mPropertyHash.Get(name, nsnull);
 
@@ -114,19 +112,17 @@ nsHashPropertyBag::GetProperty(const nsA
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHashPropertyBag::SetProperty(const nsAString& name, nsIVariant *value)
 {
     NS_ENSURE_ARG_POINTER(value);
 
-    bool success = mPropertyHash.Put(name, value);
-    if (!success)
-        return NS_ERROR_FAILURE;
+    mPropertyHash.Put(name, value);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHashPropertyBag::DeleteProperty(const nsAString& name)
 {
     // is it too much to ask for ns*Hashtable to return
--- a/xpcom/ds/nsProperties.cpp
+++ b/xpcom/ds/nsProperties.cpp
@@ -57,18 +57,18 @@ nsProperties::Get(const char* prop, cons
     }
     return (value) ? value->QueryInterface(uuid, result) : NS_ERROR_NO_INTERFACE;
 }
 
 NS_IMETHODIMP
 nsProperties::Set(const char* prop, nsISupports* value)
 {
     NS_ENSURE_ARG(prop);
-
-    return Put(prop, value) ? NS_OK : NS_ERROR_FAILURE;
+    Put(prop, value);
+    return NS_OK;
 }
 
 NS_IMETHODIMP
 nsProperties::Undefine(const char* prop)
 {
     NS_ENSURE_ARG(prop);
 
     nsCOMPtr<nsISupports> value;
--- a/xpcom/ds/nsProperties.h
+++ b/xpcom/ds/nsProperties.h
@@ -60,14 +60,15 @@ typedef nsInterfaceHashtable<nsCharPtrHa
 class nsProperties : public nsIProperties,
                      public nsProperties_HashBase {
 public:
 
   NS_DECL_AGGREGATED
   NS_DECL_NSIPROPERTIES
 
   nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); }
+  nsresult Init() { nsProperties_HashBase::Init(); return NS_OK; }
 
 private:
   ~nsProperties() { }
 };
 
 #endif /* nsProperties_h___ */
--- a/xpcom/glue/nsBaseHashtable.h
+++ b/xpcom/glue/nsBaseHashtable.h
@@ -453,18 +453,18 @@ nsBaseHashtableMT<KeyClass,DataType,User
   if (this->mLock)
     PR_DestroyLock(this->mLock);
 }
 
 template<class KeyClass,class DataType,class UserDataType>
 void
 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Init(PRUint32 initSize)
 {
-  if (!nsTHashtable<EntryType>::IsInitialized() && !nsTHashtable<EntryType>::Init(initSize))
-    NS_RUNTIMEABORT("OOM");
+  if (!nsTHashtable<EntryType>::IsInitialized())
+    nsTHashtable<EntryType>::Init(initSize);
 
   this->mLock = PR_NewLock();
   if (!this->mLock)
     NS_RUNTIMEABORT("OOM");
 }
 
 template<class KeyClass,class DataType,class UserDataType>
 PRUint32
@@ -491,22 +491,18 @@ nsBaseHashtableMT<KeyClass,DataType,User
 }
 
 template<class KeyClass,class DataType,class UserDataType>
 void
 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Put(KeyType      aKey,
                                                            UserDataType aData)
 {
   PR_Lock(this->mLock);
-  bool res =
-    nsBaseHashtable<KeyClass,DataType,UserDataType>::Put(aKey, aData);
+  nsBaseHashtable<KeyClass,DataType,UserDataType>::Put(aKey, aData);
   PR_Unlock(this->mLock);
-
-  if (!res)
-    NS_RUNTIMEABORT("OOM");
 }
 
 template<class KeyClass,class DataType,class UserDataType>
 void
 nsBaseHashtableMT<KeyClass,DataType,UserDataType>::Remove(KeyType aKey)
 {
   PR_Lock(this->mLock);
   nsBaseHashtable<KeyClass,DataType,UserDataType>::Remove(aKey);
--- a/xpcom/glue/nsCategoryCache.cpp
+++ b/xpcom/glue/nsCategoryCache.cpp
@@ -42,21 +42,17 @@
 #include "nsXPCOMCID.h"
 
 #include "nsCategoryCache.h"
 
 nsCategoryObserver::nsCategoryObserver(const char* aCategory,
                                        nsCategoryListener* aListener)
   : mListener(nsnull), mCategory(aCategory), mObserversRemoved(false)
 {
-  if (!mHash.Init()) {
-    // OOM
-    return;
-  }
-
+  mHash.Init();
   mListener = aListener;
 
   // First, enumerate the currently existing entries
   nsCOMPtr<nsICategoryManager> catMan =
     do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
   if (!catMan)
     return;
 
--- a/xpcom/glue/nsINIParser.cpp
+++ b/xpcom/glue/nsINIParser.cpp
@@ -128,18 +128,17 @@ nsINIParser::Init(const char *aPath)
 static const char kNL[] = "\r\n";
 static const char kEquals[] = "=";
 static const char kWhitespace[] = " \t";
 static const char kRBracket[] = "]";
 
 nsresult
 nsINIParser::InitFromFILE(FILE *fd)
 {
-    if (!mSections.Init())
-        return NS_ERROR_OUT_OF_MEMORY;
+    mSections.Init();
 
     /* get file size */
     if (fseek(fd, 0, SEEK_END) != 0)
         return NS_ERROR_FAILURE;
 
     long flen = ftell(fd);
     if (flen == 0)
         return NS_ERROR_FAILURE;
--- a/xpcom/tests/TestHashtables.cpp
+++ b/xpcom/tests/TestHashtables.cpp
@@ -402,20 +402,17 @@ nsIEnum2(nsISupports* aKey, PRUint32& aD
 using namespace TestHashtables;
 
 int
 main(void) {
   // check an nsTHashtable
   nsTHashtable<EntityToUnicodeEntry> EntityToUnicode;
 
   printf("Initializing nsTHashtable...");
-  if (!EntityToUnicode.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (1);
-  }
+  EntityToUnicode.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Partially filling nsTHashtable:\n");
   testTHashtable(EntityToUnicode, 5);
 
   printf("Enumerate-removing...\n");
   PRUint32 count = EntityToUnicode.EnumerateEntries(nsTEnumStop, nsnull);
   if (count != 5) {
@@ -449,31 +446,25 @@ main(void) {
 
   //
   // now check a data-hashtable
   //
 
   nsDataHashtable<nsUint32HashKey,const char*> UniToEntity;
 
   printf("Initializing nsDataHashtable...");
-  if (!UniToEntity.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (10);
-  }
+  UniToEntity.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   PRUint32 i;
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
-    if (!UniToEntity.Put(gEntities[i].mUnicode, gEntities[i].mStr)) {
-      printf("FAILED\n");
-      exit (11);
-    }
+    UniToEntity.Put(gEntities[i].mUnicode, gEntities[i].mStr);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
   const char* str;
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %u...", gEntities[i].mUnicode);
@@ -516,30 +507,24 @@ main(void) {
 
   //
   // now check a thread-safe data-hashtable
   //
 
   nsDataHashtableMT<nsUint32HashKey,const char*> UniToEntityL;
 
   printf("Initializing nsDataHashtableMT...");
-  if (!UniToEntityL.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (10);
-  }
+  UniToEntityL.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
-    if (!UniToEntityL.Put(gEntities[i].mUnicode, gEntities[i].mStr)) {
-      printf("FAILED\n");
-      exit (11);
-    }
+    UniToEntityL.Put(gEntities[i].mUnicode, gEntities[i].mStr);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %u...", gEntities[i].mUnicode);
     if (!UniToEntityL.Get(gEntities[i].mUnicode, &str)) {
@@ -581,33 +566,26 @@ main(void) {
 
   //
   // now check a class-hashtable
   //
 
   nsClassHashtable<nsCStringHashKey,TestUniChar> EntToUniClass;
 
   printf("Initializing nsClassHashtable...");
-  if (!EntToUniClass.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (16);
-  }
+  EntToUniClass.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
     TestUniChar* temp = new TestUniChar(gEntities[i].mUnicode);
 
-    if (!EntToUniClass.Put(nsDependentCString(gEntities[i].mStr), temp)) {
-      printf("FAILED\n");
-      delete temp;
-      exit (17);
-    }
+    EntToUniClass.Put(nsDependentCString(gEntities[i].mStr), temp);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
   TestUniChar* myChar;
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %s...", gEntities[i].mStr);
@@ -650,33 +628,26 @@ main(void) {
 
   //
   // now check a thread-safe class-hashtable
   //
 
   nsClassHashtableMT<nsCStringHashKey,TestUniChar> EntToUniClassL;
 
   printf("Initializing nsClassHashtableMT...");
-  if (!EntToUniClassL.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (16);
-  }
+  EntToUniClassL.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
     TestUniChar* temp = new TestUniChar(gEntities[i].mUnicode);
 
-    if (!EntToUniClassL.Put(nsDependentCString(gEntities[i].mStr), temp)) {
-      printf("FAILED\n");
-      delete temp;
-      exit (17);
-    }
+    EntToUniClassL.Put(nsDependentCString(gEntities[i].mStr), temp);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %s...", gEntities[i].mStr);
     if (!EntToUniClassL.Get(nsDependentCString(gEntities[i].mStr), &myChar)) {
@@ -718,39 +689,33 @@ main(void) {
 
   //
   // now check a data-hashtable with an interface key
   //
 
   nsDataHashtable<nsISupportsHashKey,PRUint32> EntToUniClass2;
 
   printf("Initializing nsDataHashtable with interface key...");
-  if (!EntToUniClass2.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (22);
-  }
+  EntToUniClass2.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   nsCOMArray<IFoo> fooArray;
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
     nsCOMPtr<IFoo> foo;
     CreateIFoo(getter_AddRefs(foo));
     foo->SetString(nsDependentCString(gEntities[i].mStr));
     
     
     fooArray.InsertObjectAt(foo, i);
 
-    if (!EntToUniClass2.Put(foo, gEntities[i].mUnicode)) {
-      printf("FAILED\n");
-      exit (23);
-    }
+    EntToUniClass2.Put(foo, gEntities[i].mUnicode);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
   PRUint32 myChar2;
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %s...", gEntities[i].mStr);
@@ -794,34 +759,28 @@ main(void) {
 
   //
   // now check an interface-hashtable with an PRUint32 key
   //
 
   nsInterfaceHashtable<nsUint32HashKey,IFoo> UniToEntClass2;
 
   printf("Initializing nsInterfaceHashtable...");
-  if (!UniToEntClass2.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (28);
-  }
+  UniToEntClass2.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
     nsCOMPtr<IFoo> foo;
     CreateIFoo(getter_AddRefs(foo));
     foo->SetString(nsDependentCString(gEntities[i].mStr));
     
-    if (!UniToEntClass2.Put(gEntities[i].mUnicode, foo)) {
-      printf("FAILED\n");
-      exit (29);
-    }
+    UniToEntClass2.Put(gEntities[i].mUnicode, foo);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %s...", gEntities[i].mStr);
     
@@ -868,34 +827,28 @@ main(void) {
 
   //
   // now check a thread-safe interface hashtable
   //
 
   nsInterfaceHashtableMT<nsUint32HashKey,IFoo> UniToEntClass2L;
 
   printf("Initializing nsInterfaceHashtableMT...");
-  if (!UniToEntClass2L.Init(ENTITY_COUNT)) {
-    printf("FAILED\n");
-    exit (28);
-  }
+  UniToEntClass2L.Init(ENTITY_COUNT);
   printf("OK\n");
 
   printf("Filling hash with %u entries.\n", ENTITY_COUNT);
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Putting entry %u...", gEntities[i].mUnicode);
     nsCOMPtr<IFoo> foo;
     CreateIFoo(getter_AddRefs(foo));
     foo->SetString(nsDependentCString(gEntities[i].mStr));
     
-    if (!UniToEntClass2L.Put(gEntities[i].mUnicode, foo)) {
-      printf("FAILED\n");
-      exit (29);
-    }
+    UniToEntClass2L.Put(gEntities[i].mUnicode, foo);
     printf("OK...\n");
   }
 
   printf("Testing Get:\n");
 
   for (i = 0; i < ENTITY_COUNT; ++i) {
     printf("  Getting entry %s...", gEntities[i].mStr);
     
--- a/xpcom/threads/nsEnvironment.cpp
+++ b/xpcom/threads/nsEnvironment.cpp
@@ -140,22 +140,18 @@ EnsureEnvHash()
 {
     if (gEnvHash)
         return true;
 
     gEnvHash = new EnvHashType;
     if (!gEnvHash)
         return false;
 
-    if(gEnvHash->Init())
-        return true;
-
-    delete gEnvHash;
-    gEnvHash = nsnull;
-    return false;
+    gEnvHash->Init();
+    return true;
 }
 
 NS_IMETHODIMP
 nsEnvironment::Set(const nsAString& aName, const nsAString& aValue)
 {
     nsCAutoString nativeName;
     nsCAutoString nativeVal;
 
--- a/xpcom/threads/nsThreadManager.cpp
+++ b/xpcom/threads/nsThreadManager.cpp
@@ -84,18 +84,17 @@ NS_IMPL_CLASSINFO(nsThreadManager, NULL,
 NS_IMPL_QUERY_INTERFACE1_CI(nsThreadManager, nsIThreadManager)
 NS_IMPL_CI_INTERFACE_GETTER1(nsThreadManager, nsIThreadManager)
 
 //-----------------------------------------------------------------------------
 
 nsresult
 nsThreadManager::Init()
 {
-  if (!mThreadsByPRThread.Init())
-    return NS_ERROR_OUT_OF_MEMORY;
+  mThreadsByPRThread.Init();
 
   if (PR_NewThreadPrivateIndex(&mCurThreadIndex, ReleaseObject) == PR_FAILURE)
     return NS_ERROR_FAILURE;
 
   mLock = new Mutex("nsThreadManager.mLock");
 
   // Setup "main" thread
   mMainThread = new nsThread(nsThread::MAIN_THREAD, 0);