Bug 562424: Switch IPDL interfaces to infallible TArray. r=bent a=blocking
authorChris Jones <jones.chris.g@gmail.com>
Mon, 08 Nov 2010 20:49:00 -0600
changeset 57141 15765a60e203b99d2ecc39e0f1f7ee8bf1f02c93
parent 57140 f915a22def59a09afd87941311fdbd69c27de8ff
child 57142 776282c941786de94209630981e60d8b9a4f1842
push idunknown
push userunknown
push dateunknown
reviewersbent, blocking
bugs562424
milestone2.0b8pre
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 562424: Switch IPDL interfaces to infallible TArray. r=bent a=blocking
chrome/src/nsChromeRegistryChrome.cpp
content/base/src/nsFrameMessageManager.cpp
content/base/src/nsFrameMessageManager.h
content/base/src/nsInProcessTabChildGlobal.cpp
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
dom/ipc/TabChild.cpp
dom/ipc/TabChild.h
dom/ipc/TabParent.cpp
dom/ipc/TabParent.h
dom/plugins/PluginInstanceChild.cpp
dom/plugins/PluginModuleChild.cpp
dom/plugins/PluginModuleChild.h
dom/plugins/PluginModuleParent.cpp
dom/plugins/PluginModuleParent.h
dom/plugins/PluginScriptableObjectChild.cpp
dom/plugins/PluginScriptableObjectChild.h
dom/plugins/PluginScriptableObjectParent.cpp
dom/plugins/PluginScriptableObjectParent.h
dom/plugins/PluginScriptableObjectUtils.h
extensions/cookie/nsPermissionManager.cpp
gfx/layers/basic/BasicLayers.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/ShadowLayers.h
gfx/layers/ipc/ShadowLayersParent.cpp
gfx/layers/ipc/ShadowLayersParent.h
ipc/glue/IPCMessageUtils.h
ipc/ipdl/ipdl/lower.py
ipc/ipdl/test/cxx/TestDataStructures.cpp
ipc/ipdl/test/cxx/TestDataStructures.h
ipc/ipdl/test/cxx/TestJSON.cpp
ipc/ipdl/test/cxx/TestMultiMgrs.h
ipc/ipdl/test/cxx/TestShutdown.cpp
ipc/testshell/TestShellParent.cpp
js/ipc/ObjectWrapperChild.cpp
js/ipc/ObjectWrapperChild.h
js/ipc/ObjectWrapperParent.cpp
js/jetpack/JetpackActorCommon.cpp
js/jetpack/JetpackActorCommon.h
js/jetpack/JetpackChild.cpp
js/jetpack/JetpackChild.h
js/jetpack/JetpackParent.cpp
js/jetpack/JetpackParent.h
modules/libpref/public/nsIPrefService.idl
modules/libpref/src/nsPrefService.cpp
netwerk/protocol/res/nsResProtocolHandler.cpp
netwerk/protocol/res/nsResProtocolHandler.h
widget/src/xpwidgets/nsFilePickerProxy.cpp
widget/src/xpwidgets/nsFilePickerProxy.h
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -452,28 +452,28 @@ EnumerateOverride(nsIURI* aURIKey,
     chromeURI, overrideURI
   };
   overrides->AppendElement(override);
   return (PLDHashOperator)PL_DHASH_NEXT;
 }
 
 struct EnumerationArgs
 {
-  nsTArray<ChromePackage>& packages;
+  InfallibleTArray<ChromePackage>& packages;
   const nsCString& selectedLocale;
   const nsCString& selectedSkin;
 };
 
 void
 nsChromeRegistryChrome::SendRegisteredChrome(
     mozilla::dom::PContentParent* aParent)
 {
-  nsTArray<ChromePackage> packages;
-  nsTArray<ResourceMapping> resources;
-  nsTArray<OverrideMapping> overrides;
+  InfallibleTArray<ChromePackage> packages;
+  InfallibleTArray<ResourceMapping> resources;
+  InfallibleTArray<OverrideMapping> overrides;
 
   EnumerationArgs args = {
     packages, mSelectedLocale, mSelectedSkin
   };
   PL_DHashTableEnumerate(&mPackagesHash, CollectPackages, &args);
 
   nsCOMPtr<nsIIOService> io (do_GetIOService());
   NS_ENSURE_TRUE(io, );
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -229,17 +229,17 @@ nsFrameMessageManager::SendSyncMessage()
   NS_ASSERTION(!IsWindowLevel(), "Should not call SendSyncMessage in chrome");
   NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
   if (mSyncCallback) {
     NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
     nsString messageName;
     nsString json;
     nsresult rv = GetParamsForMessage(messageName, json);
     NS_ENSURE_SUCCESS(rv, rv);
-    nsTArray<nsString> retval;
+    InfallibleTArray<nsString> retval;
     if (mSyncCallback(mCallbackData, messageName, json, &retval)) {
       nsAXPCNativeCallContext* ncc = nsnull;
       rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
       NS_ENSURE_SUCCESS(rv, rv);
       NS_ENSURE_STATE(ncc);
 
       JSContext* ctx = nsnull;
       rv = ncc->GetJSContext(&ctx);
@@ -321,17 +321,17 @@ nsFrameMessageManager::GetDocShell(nsIDo
   return NS_OK;
 }
 
 nsresult
 nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
                                       const nsAString& aMessage,
                                       PRBool aSync, const nsAString& aJSON,
                                       JSObject* aObjectsArray,
-                                      nsTArray<nsString>* aJSONRetVal,
+                                      InfallibleTArray<nsString>* aJSONRetVal,
                                       JSContext* aContext)
 {
   JSContext* ctx = mContext ? mContext : aContext;
   if (!ctx) {
     nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&ctx);
   }
   if (mListeners.Length()) {
     nsCOMPtr<nsIAtom> name = do_GetAtom(aMessage);
@@ -737,17 +737,17 @@ bool SendAsyncMessageToChildProcess(void
     return cp->SendAsyncMessage(nsString(aMessage), nsString(aJSON));
   }
   return true;
 }
 
 bool SendSyncMessageToParentProcess(void* aCallbackData,
                                     const nsAString& aMessage,
                                     const nsAString& aJSON,
-                                    nsTArray<nsString>* aJSONRetVal)
+                                    InfallibleTArray<nsString>* aJSONRetVal)
 {
   mozilla::dom::ContentChild* cc =
     mozilla::dom::ContentChild::GetSingleton();
   if (cc) {
     return
       cc->SendSyncMessage(nsString(aMessage), nsString(aJSON), aJSONRetVal);
   }
   return true;
--- a/content/base/src/nsFrameMessageManager.h
+++ b/content/base/src/nsFrameMessageManager.h
@@ -61,17 +61,17 @@ struct nsMessageListenerInfo
   nsCOMPtr<nsIFrameMessageListener> mListener;
   nsCOMPtr<nsIAtom> mMessage;
 };
 
 typedef bool (*nsLoadScriptCallback)(void* aCallbackData, const nsAString& aURL);
 typedef bool (*nsSyncMessageCallback)(void* aCallbackData,
                                       const nsAString& aMessage,
                                       const nsAString& aJSON,
-                                      nsTArray<nsString>* aJSONRetVal);
+                                      InfallibleTArray<nsString>* aJSONRetVal);
 typedef bool (*nsAsyncMessageCallback)(void* aCallbackData,
                                        const nsAString& aMessage,
                                        const nsAString& aJSON);
 
 class nsFrameMessageManager : public nsIContentFrameMessageManager,
                               public nsIChromeFrameMessageManager
 {
 public:
@@ -124,17 +124,17 @@ public:
   NS_DECL_NSIFRAMEMESSAGEMANAGER
   NS_DECL_NSISYNCMESSAGESENDER
   NS_DECL_NSICONTENTFRAMEMESSAGEMANAGER
   NS_DECL_NSICHROMEFRAMEMESSAGEMANAGER
 
   nsresult ReceiveMessage(nsISupports* aTarget, const nsAString& aMessage,
                           PRBool aSync, const nsAString& aJSON,
                           JSObject* aObjectsArray,
-                          nsTArray<nsString>* aJSONRetVal,
+                          InfallibleTArray<nsString>* aJSONRetVal,
                           JSContext* aContext = nsnull);
   void AddChildManager(nsFrameMessageManager* aManager,
                        PRBool aLoadScripts = PR_TRUE);
   void RemoveChildManager(nsFrameMessageManager* aManager)
   {
     mChildManagers.RemoveObject(aManager);
   }
 
--- a/content/base/src/nsInProcessTabChildGlobal.cpp
+++ b/content/base/src/nsInProcessTabChildGlobal.cpp
@@ -49,17 +49,17 @@
 #include "nsScriptLoader.h"
 #include "nsIJSContextStack.h"
 #include "nsFrameLoader.h"
 #include "nsIPrivateDOMEvent.h"
 
 bool SendSyncMessageToParent(void* aCallbackData,
                              const nsAString& aMessage,
                              const nsAString& aJSON,
-                             nsTArray<nsString>* aJSONRetVal)
+                             InfallibleTArray<nsString>* aJSONRetVal)
 {
   nsInProcessTabChildGlobal* tabChild =
     static_cast<nsInProcessTabChildGlobal*>(aCallbackData);
   nsCOMPtr<nsIContent> owner = tabChild->mOwner;
   nsTArray<nsCOMPtr<nsIRunnable> > asyncMessages;
   asyncMessages.SwapElements(tabChild->mASyncMessages);
   PRUint32 len = asyncMessages.Length();
   for (PRUint32 i = 0; i < len; ++i) {
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -316,19 +316,19 @@ bool
 ContentChild::DeallocPExternalHelperApp(PExternalHelperAppChild* aService)
 {
     ExternalHelperAppChild *child = static_cast<ExternalHelperAppChild*>(aService);
     child->Release();
     return true;
 }
 
 bool
-ContentChild::RecvRegisterChrome(const nsTArray<ChromePackage>& packages,
-                                 const nsTArray<ResourceMapping>& resources,
-                                 const nsTArray<OverrideMapping>& overrides)
+ContentChild::RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
+                                 const InfallibleTArray<ResourceMapping>& resources,
+                                 const InfallibleTArray<OverrideMapping>& overrides)
 {
     nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
     nsChromeRegistryContent* chromeRegistry =
         static_cast<nsChromeRegistryContent*>(registrySvc.get());
     chromeRegistry->RegisterRemoteChrome(packages, resources, overrides);
     return true;
 }
 
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -89,19 +89,19 @@ public:
     virtual PExternalHelperAppChild *AllocPExternalHelperApp(
             const IPC::URI& uri,
             const nsCString& aMimeContentType,
             const nsCString& aContentDisposition,
             const bool& aForceSave,
             const PRInt64& aContentLength);
     virtual bool DeallocPExternalHelperApp(PExternalHelperAppChild *aService);
 
-    virtual bool RecvRegisterChrome(const nsTArray<ChromePackage>& packages,
-                                    const nsTArray<ResourceMapping>& resources,
-                                    const nsTArray<OverrideMapping>& overrides);
+    virtual bool RecvRegisterChrome(const InfallibleTArray<ChromePackage>& packages,
+                                    const InfallibleTArray<ResourceMapping>& resources,
+                                    const InfallibleTArray<OverrideMapping>& overrides);
 
     virtual bool RecvSetOffline(const PRBool& offline);
 
     virtual bool RecvNotifyVisited(const IPC::URI& aURI);
     // auto remove when alertfinished is received.
     nsresult AddRemoteAlertObserver(const nsString& aData, nsIObserver* aObserver);
 
     virtual bool RecvPreferenceUpdate(const PrefTuple& aPref);
@@ -125,17 +125,17 @@ private:
     virtual void ProcessingError(Result what);
 
     /**
      * Exit *now*.  Do not shut down XPCOM, do not pass Go, do not run
      * static destructors, do not collect $200.
      */
     NS_NORETURN void QuickExit();
 
-    nsTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
+    InfallibleTArray<nsAutoPtr<AlertObserver> > mAlertObservers;
     nsRefPtr<ConsoleListener> mConsoleListener;
 
     static ContentChild* sSingleton;
 
     DISALLOW_EVIL_CONSTRUCTORS(ContentChild);
 };
 
 } // namespace dom
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -194,17 +194,17 @@ ContentParent::~ContentParent()
 
 bool
 ContentParent::IsAlive()
 {
     return mIsAlive;
 }
 
 bool
-ContentParent::RecvReadPrefsArray(nsTArray<PrefTuple> *prefs)
+ContentParent::RecvReadPrefsArray(InfallibleTArray<PrefTuple> *prefs)
 {
     EnsurePrefService();
     mPrefService->MirrorPreferences(prefs);
     return true;
 }
 
 void
 ContentParent::EnsurePrefService()
@@ -213,17 +213,17 @@ ContentParent::EnsurePrefService()
     if (!mPrefService) {
         mPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
         NS_ASSERTION(NS_SUCCEEDED(rv), 
                      "We lost prefService in the Chrome process !");
     }
 }
 
 bool
-ContentParent::RecvReadPermissions(nsTArray<IPC::Permission>* aPermissions)
+ContentParent::RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions)
 {
 #ifdef MOZ_PERMISSIONS
     nsRefPtr<nsPermissionManager> permissionManager =
         nsPermissionManager::GetSingleton();
     NS_ABORT_IF_FALSE(permissionManager,
                  "We have no permissionManager in the Chrome process !");
 
     nsCOMPtr<nsISimpleEnumerator> enumerator;
@@ -456,19 +456,19 @@ ContentParent::RecvSetURITitle(const IPC
 }
 
 bool
 ContentParent::RecvShowFilePicker(const PRInt16& mode,
                                   const PRInt16& selectedType,
                                   const nsString& title,
                                   const nsString& defaultFile,
                                   const nsString& defaultExtension,
-                                  const nsTArray<nsString>& filters,
-                                  const nsTArray<nsString>& filterNames,
-                                  nsTArray<nsString>* files,
+                                  const InfallibleTArray<nsString>& filters,
+                                  const InfallibleTArray<nsString>& filterNames,
+                                  InfallibleTArray<nsString>* files,
                                   PRInt16* retValue,
                                   nsresult* result)
 {
     nsCOMPtr<nsIFilePicker> filePicker = do_CreateInstance("@mozilla.org/filepicker;1");
     if (!filePicker) {
         *result = NS_ERROR_NOT_AVAILABLE;
         return true;
     }
@@ -596,17 +596,17 @@ ContentParent::RecvShowAlertNotification
                                          aCookie, this, aName);
     }
 
     return true;
 }
 
 bool
 ContentParent::RecvSyncMessage(const nsString& aMsg, const nsString& aJSON,
-                               nsTArray<nsString>* aRetvals)
+                               InfallibleTArray<nsString>* aRetvals)
 {
   nsRefPtr<nsFrameMessageManager> ppm = nsFrameMessageManager::sParentProcessManager;
   if (ppm) {
     ppm->ReceiveMessage(static_cast<nsIContentFrameMessageManager*>(ppm.get()),
                         aMsg,PR_TRUE, aJSON, nsnull, aRetvals);
   }
   return true;
 }
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -123,50 +123,50 @@ private:
     virtual PExternalHelperAppParent* AllocPExternalHelperApp(
             const IPC::URI& uri,
             const nsCString& aMimeContentType,
             const nsCString& aContentDisposition,
             const bool& aForceSave,
             const PRInt64& aContentLength);
     virtual bool DeallocPExternalHelperApp(PExternalHelperAppParent* aService);
 
-    virtual bool RecvReadPrefsArray(nsTArray<PrefTuple> *retValue);
+    virtual bool RecvReadPrefsArray(InfallibleTArray<PrefTuple> *retValue);
 
     void EnsurePrefService();
 
-    virtual bool RecvReadPermissions(nsTArray<IPC::Permission>* aPermissions);
+    virtual bool RecvReadPermissions(InfallibleTArray<IPC::Permission>* aPermissions);
 
     virtual bool RecvStartVisitedQuery(const IPC::URI& uri);
 
     virtual bool RecvVisitURI(const IPC::URI& uri,
                               const IPC::URI& referrer,
                               const PRUint32& flags);
 
     virtual bool RecvSetURITitle(const IPC::URI& uri,
                                  const nsString& title);
     
     virtual bool RecvShowFilePicker(const PRInt16& mode,
                                     const PRInt16& selectedType,
                                     const nsString& title,
                                     const nsString& defaultFile,
                                     const nsString& defaultExtension,
-                                    const nsTArray<nsString>& filters,
-                                    const nsTArray<nsString>& filterNames,
-                                    nsTArray<nsString>* files,
+                                    const InfallibleTArray<nsString>& filters,
+                                    const InfallibleTArray<nsString>& filterNames,
+                                    InfallibleTArray<nsString>* files,
                                     PRInt16* retValue,
                                     nsresult* result);
  
     virtual bool RecvShowAlertNotification(const nsString& aImageUrl, const nsString& aTitle,
                                            const nsString& aText, const PRBool& aTextClickable,
                                            const nsString& aCookie, const nsString& aName);
 
     virtual bool RecvLoadURIExternal(const IPC::URI& uri);
 
     virtual bool RecvSyncMessage(const nsString& aMsg, const nsString& aJSON,
-                                 nsTArray<nsString>* aRetvals);
+                                 InfallibleTArray<nsString>* aRetvals);
     virtual bool RecvAsyncMessage(const nsString& aMsg, const nsString& aJSON);
 
     virtual bool RecvAddGeolocationListener();
     virtual bool RecvRemoveGeolocationListener();
     virtual bool RecvAddAccelerometerListener();
     virtual bool RecvRemoveAccelerometerListener();
 
     virtual bool RecvConsoleMessage(const nsString& aMessage);
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -44,17 +44,16 @@ include protocol PExternalHelperApp;
 include "mozilla/chrome/RegistryMessageUtils.h";
 include "mozilla/net/NeckoMessageUtils.h";
 
 include "nsGeoPositionIPCSerialiser.h";
 include "PPrefTuple.h";
 
 using GeoPosition;
 using PrefTuple;
-using nsTArray<PrefTuple>;
 
 using ChromePackage;
 using ResourceMapping;
 using OverrideMapping;
 using IPC::URI;
 using IPC::Permission;
 
 namespace mozilla {
@@ -103,17 +102,17 @@ parent:
     sync ShowFilePicker(PRInt16 mode, PRInt16 selectedType, 
                         nsString title, nsString defaultFile, nsString defaultExtension,
                         nsString[] filters, nsString[] filterNames)
         returns (nsString[] files, PRInt16 retValue, nsresult result);
 
     async LoadURIExternal(URI uri);
 
     // PrefService message
-    sync ReadPrefsArray() returns (nsTArray<PrefTuple> retValue);
+    sync ReadPrefsArray() returns (PrefTuple[] retValue);
 
     sync SyncMessage(nsString aMessage, nsString aJSON)
       returns (nsString[] retval);
 
     ShowAlertNotification(nsString imageUrl, 
                           nsString title, 
                           nsString text, 
                           PRBool textClickable,
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -106,18 +106,18 @@ ContentListener::HandleEvent(nsIDOMEvent
   NS_ENSURE_STATE(remoteEvent.mEvent);
   mTabChild->SendEvent(remoteEvent);
   return NS_OK;
 }
 
 class ContentDialogChild : public PContentDialogChild
 {
 public:
-  virtual bool Recv__delete__(const nsTArray<int>& aIntParams,
-                              const nsTArray<nsString>& aStringParams);
+  virtual bool Recv__delete__(const InfallibleTArray<int>& aIntParams,
+                              const InfallibleTArray<nsString>& aStringParams);
 };
 
 
 TabChild::TabChild(PRUint32 aChromeFlags)
   : mRemoteFrame(nsnull)
   , mTabChildGlobal(nsnull)
   , mChromeFlags(aChromeFlags)
 {
@@ -368,48 +368,48 @@ NS_IMETHODIMP
 TabChild::OpenDialog(PRUint32 aType, const nsACString& aName,
                      const nsACString& aFeatures,
                      nsIDialogParamBlock* aArguments,
                      nsIDOMElement* aFrameElement)
 {
   if (!gActiveDialogs.IsInitialized()) {
     NS_ENSURE_STATE(gActiveDialogs.Init());
   }
-  nsTArray<PRInt32> intParams;
-  nsTArray<nsString> stringParams;
+  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));
   nsIThread *thread = NS_GetCurrentThread();
   while (gActiveDialogs.GetWeak(dialog)) {
     if (!NS_ProcessNextEvent(thread)) {
       break;
     }
   }
   return NS_OK;
 }
 
 bool
-ContentDialogChild::Recv__delete__(const nsTArray<int>& aIntParams,
-                                   const nsTArray<nsString>& aStringParams)
+ContentDialogChild::Recv__delete__(const InfallibleTArray<int>& aIntParams,
+                                   const InfallibleTArray<nsString>& aStringParams)
 {
   nsCOMPtr<nsIDialogParamBlock> params;
   if (gActiveDialogs.Get(this, getter_AddRefs(params))) {
     TabChild::ArraysToParams(aIntParams, aStringParams, params);
     gActiveDialogs.Remove(this);
   }
   return true;
 }
 
 void
 TabChild::ParamsToArrays(nsIDialogParamBlock* aParams,
-                         nsTArray<int>& aIntParams,
-                         nsTArray<nsString>& aStringParams)
+                         InfallibleTArray<int>& aIntParams,
+                         InfallibleTArray<nsString>& aStringParams)
 {
   if (aParams) {
     for (PRInt32 i = 0; i < 8; ++i) {
       PRInt32 val = 0;
       aParams->GetInt(i, &val);
       aIntParams.AppendElement(val);
     }
     PRInt32 j = 0;
@@ -417,18 +417,18 @@ TabChild::ParamsToArrays(nsIDialogParamB
     while (NS_SUCCEEDED(aParams->GetString(j, getter_Copies(strVal)))) {
       aStringParams.AppendElement(strVal);
       ++j;
     }
   }
 }
 
 void
-TabChild::ArraysToParams(const nsTArray<int>& aIntParams,
-                         const nsTArray<nsString>& aStringParams,
+TabChild::ArraysToParams(const InfallibleTArray<int>& aIntParams,
+                         const InfallibleTArray<nsString>& aStringParams,
                          nsIDialogParamBlock* aParams)
 {
   if (aParams) {
     for (PRInt32 i = 0; PRUint32(i) < aIntParams.Length(); ++i) {
       aParams->SetInt(i, aIntParams[i]);
     }
     for (PRInt32 j = 0; PRUint32(j) < aStringParams.Length(); ++j) {
       aParams->SetString(j, aStringParams[j].get());
@@ -674,18 +674,18 @@ TabChild::RecvPDocumentRendererConstruct
 
     return PDocumentRendererChild::Send__delete__(actor, renderSize, data);
 }
 
 PContentDialogChild*
 TabChild::AllocPContentDialog(const PRUint32&,
                               const nsCString&,
                               const nsCString&,
-                              const nsTArray<int>&,
-                              const nsTArray<nsString>&)
+                              const InfallibleTArray<int>&,
+                              const InfallibleTArray<nsString>&)
 {
   return new ContentDialogChild();
 }
 
 bool
 TabChild::DeallocPContentDialog(PContentDialogChild* aDialog)
 {
   delete aDialog;
@@ -945,17 +945,17 @@ TabChild::InitWidget(const nsIntSize& si
     mRemoteFrame = remoteFrame;
     return true;
 }
 
 static bool
 SendSyncMessageToParent(void* aCallbackData,
                         const nsAString& aMessage,
                         const nsAString& aJSON,
-                        nsTArray<nsString>* aJSONRetVal)
+                        InfallibleTArray<nsString>* aJSONRetVal)
 {
   return static_cast<TabChild*>(aCallbackData)->
     SendSyncMessage(nsString(aMessage), nsString(aJSON),
                     aJSONRetVal);
 }
 
 static bool
 SendAsyncMessageToParent(void* aCallbackData,
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -210,24 +210,24 @@ public:
                                                   const nsString& bgcolor,
                                                   const PRUint32& renderFlags,
                                                   const bool& flushLayout,
                                                   const nsIntSize& renderSize);
 
     virtual PContentDialogChild* AllocPContentDialog(const PRUint32&,
                                                      const nsCString&,
                                                      const nsCString&,
-                                                     const nsTArray<int>&,
-                                                     const nsTArray<nsString>&);
+                                                     const InfallibleTArray<int>&,
+                                                     const InfallibleTArray<nsString>&);
     virtual bool DeallocPContentDialog(PContentDialogChild* aDialog);
     static void ParamsToArrays(nsIDialogParamBlock* aParams,
-                               nsTArray<int>& aIntParams,
-                               nsTArray<nsString>& aStringParams);
-    static void ArraysToParams(const nsTArray<int>& aIntParams,
-                               const nsTArray<nsString>& aStringParams,
+                               InfallibleTArray<int>& aIntParams,
+                               InfallibleTArray<nsString>& aStringParams);
+    static void ArraysToParams(const InfallibleTArray<int>& aIntParams,
+                               const InfallibleTArray<nsString>& aStringParams,
                                nsIDialogParamBlock* aParams);
 
     virtual PContentPermissionRequestChild* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
     virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestChild* actor);
 
     virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdate(const URI& manifestURI,
             const URI& documentURI,
             const nsCString& clientID,
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -268,17 +268,17 @@ TabParent::SendKeyEvent(const nsAString&
 {
   unused << PBrowserParent::SendKeyEvent(nsString(aType), aKeyCode, aCharCode,
                                          aModifiers, aPreventDefault);
 }
 
 bool
 TabParent::RecvSyncMessage(const nsString& aMessage,
                            const nsString& aJSON,
-                           nsTArray<nsString>* aJSONRetVal)
+                           InfallibleTArray<nsString>* aJSONRetVal)
 {
   return ReceiveMessage(aMessage, PR_TRUE, aJSON, aJSONRetVal);
 }
 
 bool
 TabParent::RecvAsyncMessage(const nsString& aMessage,
                             const nsString& aJSON)
 {
@@ -531,17 +531,17 @@ TabParent::RecvSetIMEOpenState(const PRB
     widget->SetIMEOpenState(aValue);
   return true;
 }
 
 bool
 TabParent::ReceiveMessage(const nsString& aMessage,
                           PRBool aSync,
                           const nsString& aJSON,
-                          nsTArray<nsString>* aJSONRetVal)
+                          InfallibleTArray<nsString>* aJSONRetVal)
 {
   nsRefPtr<nsFrameLoader> frameLoader = GetFrameLoader();
   if (frameLoader && frameLoader->GetFrameMessageManager()) {
     nsFrameMessageManager* manager = frameLoader->GetFrameMessageManager();
     JSContext* ctx = manager->GetJSContext();
     JSAutoRequest ar(ctx);
     PRUint32 len = 0; //TODO: obtain a real value in bug 572685
     // Because we want JS messages to have always the same properties,
@@ -584,18 +584,18 @@ TabParent::GetAuthPrompt(PRUint32 aPromp
   return wwatch->GetPrompt(window, iid,
                            reinterpret_cast<void**>(aResult));
 }
 
 PContentDialogParent*
 TabParent::AllocPContentDialog(const PRUint32& aType,
                                const nsCString& aName,
                                const nsCString& aFeatures,
-                               const nsTArray<int>& aIntParams,
-                               const nsTArray<nsString>& aStringParams)
+                               const InfallibleTArray<int>& aIntParams,
+                               const InfallibleTArray<nsString>& aStringParams)
 {
   ContentDialogParent* parent = new ContentDialogParent();
   nsCOMPtr<nsIDialogParamBlock> params =
     do_CreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID);
   TabChild::ArraysToParams(aIntParams, aStringParams, params);
   mDelayedDialogs.AppendElement(new DelayedDialogData(parent, aType, aName,
                                                       aFeatures, params));
   nsRefPtr<nsIRunnable> ev =
@@ -640,18 +640,18 @@ TabParent::HandleDelayedDialogs()
                        data->mFeatures.get(), arguments, getter_AddRefs(dialog));
       } else {
         NS_WARNING("unknown dialog types aren't automatically supported in E10s yet!");
       }
     }
 
     delete data;
     if (dialog) {
-      nsTArray<PRInt32> intParams;
-      nsTArray<nsString> stringParams;
+      InfallibleTArray<PRInt32> intParams;
+      InfallibleTArray<nsString> stringParams;
       TabChild::ParamsToArrays(params, intParams, stringParams);
       unused << PContentDialogParent::Send__delete__(dialog,
                                                      intParams, stringParams);
     }
   }
   if (ShouldDelayDialogs() && mDelayedDialogs.Length()) {
     nsContentUtils::DispatchTrustedEvent(frame->GetOwnerDoc(), frame,
                                          NS_LITERAL_STRING("MozDelayedModalDialog"),
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -83,17 +83,17 @@ public:
     }
  
     virtual bool RecvMoveFocus(const bool& aForward);
     virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
 
     virtual bool AnswerCreateWindow(PBrowserParent** retval);
     virtual bool RecvSyncMessage(const nsString& aMessage,
                                  const nsString& aJSON,
-                                 nsTArray<nsString>* aJSONRetVal);
+                                 InfallibleTArray<nsString>* aJSONRetVal);
     virtual bool RecvAsyncMessage(const nsString& aMessage,
                                   const nsString& aJSON);
     virtual bool RecvNotifyIMEFocus(const PRBool& aFocus,
                                     nsIMEUpdatePreference* aPreference,
                                     PRUint32* aSeqno);
     virtual bool RecvNotifyIMETextChange(const PRUint32& aStart,
                                          const PRUint32& aEnd,
                                          const PRUint32& aNewEnd);
@@ -105,18 +105,18 @@ public:
                                        nsString* aComposition);
     virtual bool RecvGetIMEEnabled(PRUint32* aValue);
     virtual bool RecvSetIMEEnabled(const PRUint32& aValue);
     virtual bool RecvGetIMEOpenState(PRBool* aValue);
     virtual bool RecvSetIMEOpenState(const PRBool& aValue);
     virtual PContentDialogParent* AllocPContentDialog(const PRUint32& aType,
                                                       const nsCString& aName,
                                                       const nsCString& aFeatures,
-                                                      const nsTArray<int>& aIntParams,
-                                                      const nsTArray<nsString>& aStringParams);
+                                                      const InfallibleTArray<int>& aIntParams,
+                                                      const InfallibleTArray<nsString>& aStringParams);
     virtual bool DeallocPContentDialog(PContentDialogParent* aDialog)
     {
       delete aDialog;
       return true;
     }
 
     void LoadURL(nsIURI* aURI);
     // XXX/cjones: it's not clear what we gain by hiding these
@@ -162,17 +162,17 @@ public:
     bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
     bool SendCompositionEvent(nsCompositionEvent& event);
     bool SendTextEvent(nsTextEvent& event);
     bool SendSelectionEvent(nsSelectionEvent& event);
 protected:
     bool ReceiveMessage(const nsString& aMessage,
                         PRBool aSync,
                         const nsString& aJSON,
-                        nsTArray<nsString>* aJSONRetVal = nsnull);
+                        InfallibleTArray<nsString>* aJSONRetVal = nsnull);
 
     void ActorDestroy(ActorDestroyReason why);
 
     nsIDOMElement* mFrameElement;
     nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
 
     struct DelayedDialogData
     {
@@ -184,17 +184,17 @@ protected:
         mParams(aParams) {}
 
       PContentDialogParent* mDialog;
       PRUint32 mType;
       nsCString mName;
       nsCString mFeatures;
       nsCOMPtr<nsIDialogParamBlock> mParams;
     };
-    nsTArray<DelayedDialogData*> mDelayedDialogs;
+    InfallibleTArray<DelayedDialogData*> mDelayedDialogs;
 
     PRBool ShouldDelayDialogs();
     PRBool AllowContentIME();
 
     NS_OVERRIDE
     virtual PRenderFrameParent* AllocPRenderFrame();
     NS_OVERRIDE
     virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame);
--- a/dom/plugins/PluginInstanceChild.cpp
+++ b/dom/plugins/PluginInstanceChild.cpp
@@ -2822,17 +2822,17 @@ PluginInstanceChild::AnswerNPP_Destroy(N
     }
     if (gfxSharedImageSurface::IsSharedImage(mCurrentSurface))
         DeallocShmem(static_cast<gfxSharedImageSurface*>(mCurrentSurface.get())->GetShmem());
     if (gfxSharedImageSurface::IsSharedImage(mBackSurface))
         DeallocShmem(static_cast<gfxSharedImageSurface*>(mBackSurface.get())->GetShmem());
     mCurrentSurface = nsnull;
     mBackSurface = nsnull;
 
-    nsTArray<PBrowserStreamChild*> streams;
+    InfallibleTArray<PBrowserStreamChild*> streams;
     ManagedPBrowserStreamChild(streams);
 
     // First make sure none of these streams become deleted
     for (PRUint32 i = 0; i < streams.Length(); ) {
         if (static_cast<BrowserStreamChild*>(streams[i])->InstanceDying())
             ++i;
         else
             streams.RemoveElementAt(i);
--- a/dom/plugins/PluginModuleChild.cpp
+++ b/dom/plugins/PluginModuleChild.cpp
@@ -1703,18 +1703,18 @@ PluginModuleChild::DeallocPPluginIdentif
 {
     delete aActor;
     return true;
 }
 
 PPluginInstanceChild*
 PluginModuleChild::AllocPPluginInstance(const nsCString& aMimeType,
                                         const uint16_t& aMode,
-                                        const nsTArray<nsCString>& aNames,
-                                        const nsTArray<nsCString>& aValues,
+                                        const InfallibleTArray<nsCString>& aNames,
+                                        const InfallibleTArray<nsCString>& aValues,
                                         NPError* rv)
 {
     PLUGIN_LOG_DEBUG_METHOD;
     AssertPluginThread();
 
     nsAutoPtr<PluginInstanceChild> childInstance(
         new PluginInstanceChild(&mFunctions, aMimeType));
     if (!childInstance->Initialize()) {
@@ -1723,18 +1723,18 @@ PluginModuleChild::AllocPPluginInstance(
     }
     return childInstance.forget();
 }
 
 bool
 PluginModuleChild::AnswerPPluginInstanceConstructor(PPluginInstanceChild* aActor,
                                                     const nsCString& aMimeType,
                                                     const uint16_t& aMode,
-                                                    const nsTArray<nsCString>& aNames,
-                                                    const nsTArray<nsCString>& aValues,
+                                                    const InfallibleTArray<nsCString>& aNames,
+                                                    const InfallibleTArray<nsCString>& aValues,
                                                     NPError* rv)
 {
     PLUGIN_LOG_DEBUG_METHOD;
     AssertPluginThread();
 
     PluginInstanceChild* childInstance =
         reinterpret_cast<PluginInstanceChild*>(aActor);
     NS_ASSERTION(childInstance, "Null actor!");
--- a/dom/plugins/PluginModuleChild.h
+++ b/dom/plugins/PluginModuleChild.h
@@ -115,29 +115,29 @@ protected:
                            const int32_t& aInt);
 
     virtual bool
     DeallocPPluginIdentifier(PPluginIdentifierChild* aActor);
 
     virtual PPluginInstanceChild*
     AllocPPluginInstance(const nsCString& aMimeType,
                          const uint16_t& aMode,
-                         const nsTArray<nsCString>& aNames,
-                         const nsTArray<nsCString>& aValues,
+                         const InfallibleTArray<nsCString>& aNames,
+                         const InfallibleTArray<nsCString>& aValues,
                          NPError* rv);
 
     virtual bool
     DeallocPPluginInstance(PPluginInstanceChild* aActor);
 
     virtual bool
     AnswerPPluginInstanceConstructor(PPluginInstanceChild* aActor,
                                      const nsCString& aMimeType,
                                      const uint16_t& aMode,
-                                     const nsTArray<nsCString>& aNames,
-                                     const nsTArray<nsCString>& aValues,
+                                     const InfallibleTArray<nsCString>& aNames,
+                                     const InfallibleTArray<nsCString>& aValues,
                                      NPError* rv);
     virtual bool
     AnswerNP_Shutdown(NPError *rv);
 
     virtual void
     ActorDestroy(ActorDestroyReason why);
 
 public:
--- a/dom/plugins/PluginModuleParent.cpp
+++ b/dom/plugins/PluginModuleParent.cpp
@@ -356,18 +356,18 @@ PluginModuleParent::DeallocPPluginIdenti
 {
     delete aActor;
     return true;
 }
 
 PPluginInstanceParent*
 PluginModuleParent::AllocPPluginInstance(const nsCString& aMimeType,
                                          const uint16_t& aMode,
-                                         const nsTArray<nsCString>& aNames,
-                                         const nsTArray<nsCString>& aValues,
+                                         const InfallibleTArray<nsCString>& aNames,
+                                         const InfallibleTArray<nsCString>& aValues,
                                          NPError* rv)
 {
     NS_ERROR("Not reachable!");
     return NULL;
 }
 
 bool
 PluginModuleParent::DeallocPPluginInstance(PPluginInstanceParent* aActor)
@@ -779,18 +779,18 @@ PluginModuleParent::NPP_New(NPMIMEType p
     PLUGIN_LOG_DEBUG_METHOD;
 
     if (mShutdown) {
         *error = NPERR_GENERIC_ERROR;
         return NS_ERROR_FAILURE;
     }
 
     // create the instance on the other side
-    nsTArray<nsCString> names;
-    nsTArray<nsCString> values;
+    InfallibleTArray<nsCString> names;
+    InfallibleTArray<nsCString> values;
 
     for (int i = 0; i < argc; ++i) {
         names.AppendElement(NullableString(argn[i]));
         values.AppendElement(NullableString(argv[i]));
     }
 
     PluginInstanceParent* parentInstance =
         new PluginInstanceParent(this, instance,
--- a/dom/plugins/PluginModuleParent.h
+++ b/dom/plugins/PluginModuleParent.h
@@ -93,18 +93,18 @@ protected:
                            const int32_t& aInt);
 
     virtual bool
     DeallocPPluginIdentifier(PPluginIdentifierParent* aActor);
 
     PPluginInstanceParent*
     AllocPPluginInstance(const nsCString& aMimeType,
                          const uint16_t& aMode,
-                         const nsTArray<nsCString>& aNames,
-                         const nsTArray<nsCString>& aValues,
+                         const InfallibleTArray<nsCString>& aNames,
+                         const InfallibleTArray<nsCString>& aValues,
                          NPError* rv);
 
     virtual bool
     DeallocPPluginInstance(PPluginInstanceParent* aActor);
 
 public:
     PluginModuleParent(const char* aFilePath);
     virtual ~PluginModuleParent();
--- a/dom/plugins/PluginScriptableObjectChild.cpp
+++ b/dom/plugins/PluginScriptableObjectChild.cpp
@@ -348,17 +348,17 @@ PluginScriptableObjectChild::ScriptableE
     NS_WARNING("Calling method on an invalidated object!");
     return false;
   }
 
   ProtectedActor<PluginScriptableObjectChild> actor(object->parent);
   NS_ASSERTION(actor, "This shouldn't ever be null!");
   NS_ASSERTION(actor->Type() == Proxy, "Bad type!");
 
-  nsAutoTArray<PPluginIdentifierChild*, 10> identifiers;
+  AutoInfallibleTArray<PPluginIdentifierChild*, 10> identifiers;
   bool success;
   actor->CallEnumerate(&identifiers, &success);
 
   if (!success) {
     return false;
   }
 
   *aCount = identifiers.Length();
@@ -662,17 +662,17 @@ PluginScriptableObjectChild::AnswerHasMe
 
   PluginIdentifierChild* id = static_cast<PluginIdentifierChild*>(aId);
   *aHasMethod = mObject->_class->hasMethod(mObject, id->ToNPIdentifier());
   return true;
 }
 
 bool
 PluginScriptableObjectChild::AnswerInvoke(PPluginIdentifierChild* aId,
-                                          const nsTArray<Variant>& aArgs,
+                                          const InfallibleTArray<Variant>& aArgs,
                                           Variant* aResult,
                                           bool* aSuccess)
 {
   AssertPluginThread();
 
   if (mInvalidated) {
     NS_WARNING("Calling AnswerInvoke with an invalidated object!");
     *aResult = void_t();
@@ -732,17 +732,17 @@ PluginScriptableObjectChild::AnswerInvok
   }
 
   *aSuccess = true;
   *aResult = convertedResult;
   return true;
 }
 
 bool
-PluginScriptableObjectChild::AnswerInvokeDefault(const nsTArray<Variant>& aArgs,
+PluginScriptableObjectChild::AnswerInvokeDefault(const InfallibleTArray<Variant>& aArgs,
                                                  Variant* aResult,
                                                  bool* aSuccess)
 {
   AssertPluginThread();
 
   if (mInvalidated) {
     NS_WARNING("Calling AnswerInvokeDefault with an invalidated object!");
     *aResult = void_t();
@@ -942,17 +942,17 @@ PluginScriptableObjectChild::AnswerRemov
   *aSuccess = mObject->_class->hasProperty(mObject, id) ?
               mObject->_class->removeProperty(mObject, id) :
               true;
 
   return true;
 }
 
 bool
-PluginScriptableObjectChild::AnswerEnumerate(nsTArray<PPluginIdentifierChild*>* aProperties,
+PluginScriptableObjectChild::AnswerEnumerate(InfallibleTArray<PPluginIdentifierChild*>* aProperties,
                                              bool* aSuccess)
 {
   AssertPluginThread();
 
   if (mInvalidated) {
     NS_WARNING("Calling AnswerEnumerate with an invalidated object!");
     *aSuccess = false;
     return true;
@@ -985,17 +985,17 @@ PluginScriptableObjectChild::AnswerEnume
   }
 
   PluginModuleChild::sBrowserFuncs.memfree(ids);
   *aSuccess = true;
   return true;
 }
 
 bool
-PluginScriptableObjectChild::AnswerConstruct(const nsTArray<Variant>& aArgs,
+PluginScriptableObjectChild::AnswerConstruct(const InfallibleTArray<Variant>& aArgs,
                                              Variant* aResult,
                                              bool* aSuccess)
 {
   AssertPluginThread();
 
   if (mInvalidated) {
     NS_WARNING("Calling AnswerConstruct with an invalidated object!");
     *aResult = void_t();
--- a/dom/plugins/PluginScriptableObjectChild.h
+++ b/dom/plugins/PluginScriptableObjectChild.h
@@ -88,22 +88,22 @@ public:
   AnswerInvalidate();
 
   virtual bool
   AnswerHasMethod(PPluginIdentifierChild* aId,
                   bool* aHasMethod);
 
   virtual bool
   AnswerInvoke(PPluginIdentifierChild* aId,
-               const nsTArray<Variant>& aArgs,
+               const InfallibleTArray<Variant>& aArgs,
                Variant* aResult,
                bool* aSuccess);
 
   virtual bool
-  AnswerInvokeDefault(const nsTArray<Variant>& aArgs,
+  AnswerInvokeDefault(const InfallibleTArray<Variant>& aArgs,
                       Variant* aResult,
                       bool* aSuccess);
 
   virtual bool
   AnswerHasProperty(PPluginIdentifierChild* aId,
                     bool* aHasProperty);
 
   virtual bool
@@ -118,21 +118,21 @@ public:
                     const Variant& aValue,
                     bool* aSuccess);
 
   virtual bool
   AnswerRemoveProperty(PPluginIdentifierChild* aId,
                        bool* aSuccess);
 
   virtual bool
-  AnswerEnumerate(nsTArray<PPluginIdentifierChild*>* aProperties,
+  AnswerEnumerate(InfallibleTArray<PPluginIdentifierChild*>* aProperties,
                   bool* aSuccess);
 
   virtual bool
-  AnswerConstruct(const nsTArray<Variant>& aArgs,
+  AnswerConstruct(const InfallibleTArray<Variant>& aArgs,
                   Variant* aResult,
                   bool* aSuccess);
 
   virtual bool
   RecvProtect();
 
   virtual bool
   RecvUnprotect();
--- a/dom/plugins/PluginScriptableObjectParent.cpp
+++ b/dom/plugins/PluginScriptableObjectParent.cpp
@@ -434,17 +434,17 @@ PluginScriptableObjectParent::Scriptable
   NS_ASSERTION(actor->Type() == Proxy, "Bad type!");
 
   const NPNetscapeFuncs* npn = GetNetscapeFuncs(aObject);
   if (!npn) {
     NS_ERROR("No netscape funcs!");
     return false;
   }
 
-  nsAutoTArray<PPluginIdentifierParent*, 10> identifiers;
+  AutoInfallibleTArray<PPluginIdentifierParent*, 10> identifiers;
   bool success;
   if (!actor->CallEnumerate(&identifiers, &success)) {
     NS_WARNING("Failed to send message!");
     return false;
   }
 
   if (!success) {
     return false;
@@ -725,17 +725,17 @@ PluginScriptableObjectParent::AnswerHasM
 
   PluginIdentifierParent* id = static_cast<PluginIdentifierParent*>(aId);
   *aHasMethod = npn->hasmethod(instance->GetNPP(), mObject, id->ToNPIdentifier());
   return true;
 }
 
 bool
 PluginScriptableObjectParent::AnswerInvoke(PPluginIdentifierParent* aId,
-                                           const nsTArray<Variant>& aArgs,
+                                           const InfallibleTArray<Variant>& aArgs,
                                            Variant* aResult,
                                            bool* aSuccess)
 {
   if (!mObject) {
     NS_WARNING("Calling AnswerInvoke with an invalidated object!");
     *aResult = void_t();
     *aSuccess = false;
     return true;
@@ -808,17 +808,17 @@ PluginScriptableObjectParent::AnswerInvo
   }
 
   *aResult = convertedResult;
   *aSuccess = true;
   return true;
 }
 
 bool
-PluginScriptableObjectParent::AnswerInvokeDefault(const nsTArray<Variant>& aArgs,
+PluginScriptableObjectParent::AnswerInvokeDefault(const InfallibleTArray<Variant>& aArgs,
                                                   Variant* aResult,
                                                   bool* aSuccess)
 {
   if (!mObject) {
     NS_WARNING("Calling AnswerInvoke with an invalidated object!");
     *aResult = void_t();
     *aSuccess = false;
     return true;
@@ -1052,17 +1052,17 @@ PluginScriptableObjectParent::AnswerRemo
 
   PluginIdentifierParent* id = static_cast<PluginIdentifierParent*>(aId);
   *aSuccess = npn->removeproperty(instance->GetNPP(), mObject,
                                   id->ToNPIdentifier());
   return true;
 }
 
 bool
-PluginScriptableObjectParent::AnswerEnumerate(nsTArray<PPluginIdentifierParent*>* aProperties,
+PluginScriptableObjectParent::AnswerEnumerate(InfallibleTArray<PPluginIdentifierParent*>* aProperties,
                                               bool* aSuccess)
 {
   if (!mObject) {
     NS_WARNING("Calling AnswerEnumerate with an invalidated object!");
     *aSuccess = false;
     return true;
   }
 
@@ -1101,17 +1101,17 @@ PluginScriptableObjectParent::AnswerEnum
   }
 
   npn->memfree(ids);
   *aSuccess = true;
   return true;
 }
 
 bool
-PluginScriptableObjectParent::AnswerConstruct(const nsTArray<Variant>& aArgs,
+PluginScriptableObjectParent::AnswerConstruct(const InfallibleTArray<Variant>& aArgs,
                                               Variant* aResult,
                                               bool* aSuccess)
 {
   if (!mObject) {
     NS_WARNING("Calling AnswerConstruct with an invalidated object!");
     *aResult = void_t();
     *aSuccess = false;
     return true;
--- a/dom/plugins/PluginScriptableObjectParent.h
+++ b/dom/plugins/PluginScriptableObjectParent.h
@@ -78,22 +78,22 @@ public:
   InitializeLocal(NPObject* aObject);
 
   virtual bool
   AnswerHasMethod(PPluginIdentifierParent* aId,
                   bool* aHasMethod);
 
   virtual bool
   AnswerInvoke(PPluginIdentifierParent* aId,
-               const nsTArray<Variant>& aArgs,
+               const InfallibleTArray<Variant>& aArgs,
                Variant* aResult,
                bool* aSuccess);
 
   virtual bool
-  AnswerInvokeDefault(const nsTArray<Variant>& aArgs,
+  AnswerInvokeDefault(const InfallibleTArray<Variant>& aArgs,
                       Variant* aResult,
                       bool* aSuccess);
 
   virtual bool
   AnswerHasProperty(PPluginIdentifierParent* aId,
                     bool* aHasProperty);
 
   virtual bool
@@ -106,21 +106,21 @@ public:
                     const Variant& aValue,
                     bool* aSuccess);
 
   virtual bool
   AnswerRemoveProperty(PPluginIdentifierParent* aId,
                        bool* aSuccess);
 
   virtual bool
-  AnswerEnumerate(nsTArray<PPluginIdentifierParent*>* aProperties,
+  AnswerEnumerate(InfallibleTArray<PPluginIdentifierParent*>* aProperties,
                   bool* aSuccess);
 
   virtual bool
-  AnswerConstruct(const nsTArray<Variant>& aArgs,
+  AnswerConstruct(const InfallibleTArray<Variant>& aArgs,
                   Variant* aResult,
                   bool* aSuccess);
 
   virtual bool
   AnswerNPN_Evaluate(const nsCString& aScript,
                      Variant* aResult,
                      bool* aSuccess);
 
--- a/dom/plugins/PluginScriptableObjectUtils.h
+++ b/dom/plugins/PluginScriptableObjectUtils.h
@@ -207,66 +207,83 @@ private:
 };
 
 class ProtectedVariantArray
 {
 public:
   ProtectedVariantArray(const NPVariant* aArgs,
                         PRUint32 aCount,
                         PluginInstanceParent* aInstance)
+    : mUsingShadowArray(false)
   {
     for (PRUint32 index = 0; index < aCount; index++) {
       Variant* remoteVariant = mArray.AppendElement();
       if (!(remoteVariant && 
             ConvertToRemoteVariant(aArgs[index], *remoteVariant, aInstance,
                                    true))) {
         mOk = false;
         return;
       }
     }
     mOk = true;
   }
 
   ProtectedVariantArray(const NPVariant* aArgs,
                         PRUint32 aCount,
                         PluginInstanceChild* aInstance)
+    : mUsingShadowArray(false)
   {
     for (PRUint32 index = 0; index < aCount; index++) {
       Variant* remoteVariant = mArray.AppendElement();
       if (!(remoteVariant && 
             ConvertToRemoteVariant(aArgs[index], *remoteVariant, aInstance,
                                    true))) {
         mOk = false;
         return;
       }
     }
     mOk = true;
   }
 
   ~ProtectedVariantArray()
   {
-    PRUint32 count = mArray.Length();
+    InfallibleTArray<Variant>& vars = EnsureAndGetShadowArray();
+    PRUint32 count = vars.Length();
     for (PRUint32 index = 0; index < count; index++) {
-      ReleaseRemoteVariant(mArray[index]);
+      ReleaseRemoteVariant(vars[index]);
     }
   }
 
-  operator const nsTArray<Variant>&()
+  operator const InfallibleTArray<Variant>&()
   {
-    return mArray;
+    return EnsureAndGetShadowArray();
   }
 
   bool IsOk()
   {
     return mOk;
   }
 
 private:
+  InfallibleTArray<Variant>&
+  EnsureAndGetShadowArray()
+  {
+    if (!mUsingShadowArray) {
+      mShadowArray.SwapElements(mArray);
+      mUsingShadowArray = true;
+    }
+    return mShadowArray;
+  }
+
+  // We convert the variants fallibly, but pass them to Call*()
+  // methods as an infallible array
   nsTArray<Variant> mArray;
+  InfallibleTArray<Variant> mShadowArray;
   bool mOk;
+  bool mUsingShadowArray;
 };
 
 template<class ActorType>
 struct ProtectedActorTraits
 {
   static bool Nullable();
 };
 
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -223,17 +223,17 @@ nsPermissionManager::Init()
 
   if (!mHostTable.Init()) {
     return NS_ERROR_OUT_OF_MEMORY;
   }
 
 #ifdef MOZ_IPC
   if (IsChildProcess()) {
     // Get the permissions from the parent process
-    nsTArray<IPC::Permission> perms;
+    InfallibleTArray<IPC::Permission> perms;
     ChildProcess()->SendReadPermissions(&perms);
 
     for (int i = 0; i < perms.Length(); i++) {
       const IPC::Permission &perm = perms[i];
       AddInternal(perm.host, perm.type, perm.capability, 0, perm.expireType,
                   perm.expireTime, eNotify, eNoDBOperation);
     }
 
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -2399,17 +2399,17 @@ BasicShadowLayerManager::EndTransaction(
                                         void* aCallbackData)
 {
   BasicLayerManager::EndTransaction(aCallback, aCallbackData);
 #ifdef DEBUG
   mPhase = PHASE_FORWARD;
 #endif
 
   // forward this transaction's changeset to our ShadowLayerManager
-  nsAutoTArray<EditReply, 10> replies;
+  AutoInfallibleTArray<EditReply, 10> replies;
   if (HasShadowManager() && ShadowLayerForwarder::EndTransaction(&replies)) {
     for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
       const EditReply& reply = replies[i];
 
       switch (reply.type()) {
       case EditReply::TOpThebesBufferSwap: {
         MOZ_LAYERS_LOG(("[LayersForwarder] ThebesBufferSwap"));
 
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -295,17 +295,17 @@ ShadowLayerForwarder::PaintedCanvas(Shad
                                     gfxSharedImageSurface* aNewFrontSurface)
 {
   mTxn->AddPaint(OpPaintCanvas(NULL, Shadow(aCanvas),
                                nsIntRect(),
                                aNewFrontSurface->GetShmem()));
 }
 
 PRBool
-ShadowLayerForwarder::EndTransaction(nsTArray<EditReply>* aReplies)
+ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
 {
   NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
   NS_ABORT_IF_FALSE(!mTxn->Finished(), "forgot BeginTransaction?");
 
   AutoTxnEnd _(mTxn);
 
   if (mTxn->Empty()) {
     MOZ_LAYERS_LOG(("[LayersForwarder] 0-length cset (?), skipping Update()"));
@@ -340,17 +340,17 @@ ShadowLayerForwarder::EndTransaction(nsT
     common.clipRect() = (common.useClipRect() ?
                          *mutant->GetClipRect() : nsIntRect());
     attrs.specific() = null_t();
     mutant->FillSpecificAttributes(attrs.specific());
 
     mTxn->AddEdit(OpSetLayerAttributes(NULL, Shadow(shadow), attrs));
   }
 
-  nsAutoTArray<Edit, 10> cset;
+  AutoInfallibleTArray<Edit, 10> cset;
   size_t nCsets = mTxn->mCset.size() + mTxn->mPaints.size();
   NS_ABORT_IF_FALSE(nCsets > 0, "should have bailed by now");
 
   cset.SetCapacity(nCsets);
   if (!mTxn->mCset.empty()) {
     cset.AppendElements(&mTxn->mCset.front(), mTxn->mCset.size());
   }
   // Paints after non-paint ops, including attribute changes.  See
--- a/gfx/layers/ipc/ShadowLayers.h
+++ b/gfx/layers/ipc/ShadowLayers.h
@@ -227,17 +227,17 @@ public:
   void PaintedCanvas(ShadowableLayer* aCanvas,
                      gfxSharedImageSurface* aNewFrontSurface);
 
   /**
    * End the current transaction and forward it to ShadowLayerManager.
    * |aReplies| are directions from the ShadowLayerManager to the
    * caller of EndTransaction().
    */
-  PRBool EndTransaction(nsTArray<EditReply>* aReplies);
+  PRBool EndTransaction(InfallibleTArray<EditReply>* aReplies);
 
   /**
    * True if this is forwarding to a ShadowLayerManager.
    */
   PRBool HasShadowManager() const { return !!mShadowManager; }
 
   /**
    * The following Alloc/Open/Destroy interfaces abstract over the
--- a/gfx/layers/ipc/ShadowLayersParent.cpp
+++ b/gfx/layers/ipc/ShadowLayersParent.cpp
@@ -128,18 +128,18 @@ ShadowLayersParent::ShadowLayersParent(S
 }
 
 ShadowLayersParent::~ShadowLayersParent()
 {
   MOZ_COUNT_DTOR(ShadowLayersParent);
 }
 
 bool
-ShadowLayersParent::RecvUpdate(const nsTArray<Edit>& cset,
-                               nsTArray<EditReply>* reply)
+ShadowLayersParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
+                               InfallibleTArray<EditReply>* reply)
 {
   MOZ_LAYERS_LOG(("[ParentSide] recieved txn with %d edits", cset.Length()));
 
   EditReplyVector replyv;
 
   layer_manager()->BeginTransactionWithTarget(NULL);
 
   for (EditArray::index_type i = 0; i < cset.Length(); ++i) {
--- a/gfx/layers/ipc/ShadowLayersParent.h
+++ b/gfx/layers/ipc/ShadowLayersParent.h
@@ -52,18 +52,18 @@ class RenderFrameParent;
 namespace layers {
 
 class Layer;
 class ShadowLayerManager;
 
 class ShadowLayersParent : public PLayersParent
 {
   typedef mozilla::layout::RenderFrameParent RenderFrameParent;
-  typedef nsTArray<Edit> EditArray;
-  typedef nsTArray<EditReply> EditReplyArray;
+  typedef InfallibleTArray<Edit> EditArray;
+  typedef InfallibleTArray<EditReply> EditReplyArray;
 
 public:
   ShadowLayersParent(ShadowLayerManager* aManager);
   ~ShadowLayersParent();
 
   ShadowLayerManager* layer_manager() const { return mLayerManager; }
 
   ContainerLayer* GetRoot() const { return mRoot; }
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -267,20 +267,20 @@ struct ParamTraits<nsCAutoString> : Para
 #endif  // MOZILLA_INTERNAL_API
 
 template <>
 struct ParamTraits<nsString> : ParamTraits<nsAString>
 {
   typedef nsString paramType;
 };
 
-template <typename E>
-struct ParamTraits<nsTArray<E> >
+template <typename E, class A>
+struct ParamTraits<nsTArray<E, A> >
 {
-  typedef nsTArray<E> paramType;
+  typedef nsTArray<E, A> paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     PRUint32 length = aParam.Length();
     WriteParam(aMsg, length);
     for (PRUint32 index = 0; index < length; index++) {
       WriteParam(aMsg, aParam[index]);
     }
@@ -310,16 +310,38 @@ struct ParamTraits<nsTArray<E> >
       if (index) {
         aLog->append(L" ");
       }
       LogParam(aParam[index], aLog);
     }
   }
 };
 
+template<typename E>
+struct ParamTraits<InfallibleTArray<E> > :
+  ParamTraits<nsTArray<E, nsTArrayInfallibleAllocator> >
+{
+  typedef InfallibleTArray<E> paramType;
+
+  // use nsTArray Write() method
+
+  // deserialize the array fallibly, but return an InfallibleTArray
+  static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
+  {
+    nsTArray<E> temp;
+    if (!ReadParam(aMsg, aIter, &temp))
+      return false;
+
+    aResult->SwapElements(temp);
+    return true;
+  }
+
+  // use nsTArray Log() method
+};
+
 template<>
 struct ParamTraits<float>
 {
   typedef float paramType;
 
   static void Write(Message* aMsg, const paramType& aParam)
   {
     aMsg->WriteBytes(&aParam, sizeof(paramType));
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -283,17 +283,17 @@ E.g., |Foo[]| --> |ArrayOfFoo|."""
     # sync with grammar.
     if ipdltype.isIPDL() and ipdltype.isArray():
         return 'ArrayOf'+ ipdltype.basetype.name()
     return ipdltype.name()
 
 
 def _hasVisibleActor(ipdltype):
     """Return true iff a C++ decl of |ipdltype| would have an Actor* type.
-For example: |Actor[]| would turn into |nsTArray<ActorParent*>|, so this
+For example: |Actor[]| would turn into |Array<ActorParent*>|, so this
 function would return true for |Actor[]|."""
     return (ipdltype.isIPDL()
             and (ipdltype.isActor()
                  or (ipdltype.isArray()
                      and _hasVisibleActor(ipdltype.basetype))))
 
 def _abortIfFalse(cond, msg):
     return StmtExpr(ExprCall(
@@ -309,17 +309,17 @@ def _autoptr(T):
 
 def _autoptrGet(expr):
     return ExprCall(ExprSelect(expr, '.', 'get'))
 
 def _autoptrForget(expr):
     return ExprCall(ExprSelect(expr, '.', 'forget'))
 
 def _cxxArrayType(basetype, const=0, ref=0):
-    return Type('nsTArray', T=basetype, const=const, ref=ref)
+    return Type('InfallibleTArray', T=basetype, const=const, ref=ref)
 
 def _callCxxArrayLength(arr):
     return ExprCall(ExprSelect(arr, '.', 'Length'))
 
 def _callCxxArraySetLength(arr, lenexpr, sel='.'):
     return ExprCall(ExprSelect(arr, sel, 'SetLength'),
                     args=[ lenexpr ])
 
--- a/ipc/ipdl/test/cxx/TestDataStructures.cpp
+++ b/ipc/ipdl/test/cxx/TestDataStructures.cpp
@@ -1,27 +1,27 @@
 #include "TestDataStructures.h"
 
 #include "mozilla/unused.h"
 
 #include "IPDLUnitTests.h"      // fail etc.
 
-typedef nsTArray<nsIntRegion> RegionArray;
+typedef InfallibleTArray<nsIntRegion> RegionArray;
 
 namespace mozilla {
 namespace _ipdltest {
 
 static const uint32 nactors = 10;
 
 #define test_assert(_cond, _msg) \
     if (!(_cond)) fail(_msg)
 
 template<typename T>
 static void
-assert_arrays_equal(nsTArray<T> a, nsTArray<T> b)
+assert_arrays_equal(InfallibleTArray<T> a, InfallibleTArray<T> b)
 {
     test_assert(a == b, "arrays equal");
 }
 
 inline static TestDataStructuresSub&
 Cast(PTestDataStructuresSubParent* a)
 {
     return *static_cast<TestDataStructuresSub*>(a);
@@ -66,31 +66,31 @@ TestDataStructuresParent::DeallocPTestDa
     delete actor;
     if (mKids.Length() > 0)
         return true;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest1(
-        const nsTArray<int>& ia,
-        nsTArray<int>* oa)
+        const InfallibleTArray<int>& ia,
+        InfallibleTArray<int>* oa)
 {
     test_assert(5 == ia.Length(), "wrong length");
     for (int i = 0; i < 5; ++i)
         test_assert(i == ia[i], "wrong value");
 
     *oa = ia;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest2(
-        const nsTArray<PTestDataStructuresSubParent*>& i1,
-        nsTArray<PTestDataStructuresSubParent*>* o1)
+        const InfallibleTArray<PTestDataStructuresSubParent*>& i1,
+        InfallibleTArray<PTestDataStructuresSubParent*>* o1)
 {
     test_assert(nactors == i1.Length(), "wrong #actors");
     for (uint32 i = 0; i < i1.Length(); ++i)
         test_assert(i == Cast(i1[i]).mI, "wrong mI value");
     *o1 = i1;
     return true;
 }
 
@@ -105,18 +105,18 @@ bool TestDataStructuresParent::RecvTest3
 
     *o1 = i1;
     *o2 = i2;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest4(
-        const nsTArray<IntDouble>& i1,
-        nsTArray<IntDouble>* o1)
+        const InfallibleTArray<IntDouble>& i1,
+        InfallibleTArray<IntDouble>* o1)
 {
     test_assert(4 == i1.Length(), "wrong length");
     test_assert(1 == i1[0].get_int(), "wrong value");
     test_assert(2.0 == i1[1].get_double(), "wrong value");
     test_assert(3 == i1[2].get_int(), "wrong value");
     test_assert(4.0 == i1[3].get_double(), "wrong value");    
 
     *o1 = i1;
@@ -129,51 +129,51 @@ bool TestDataStructuresParent::RecvTest5
         const IntDoubleArrays& i2,
         const IntDoubleArrays& i3,
         IntDoubleArrays* o1,
         IntDoubleArrays* o2,
         IntDoubleArrays* o3)
 {
     test_assert(42 == i1.get_int(), "wrong value");
 
-    const nsTArray<int>& i2a = i2.get_ArrayOfint();
+    const InfallibleTArray<int>& i2a = i2.get_ArrayOfint();
     test_assert(3 == i2a.Length(), "wrong length");
     test_assert(1 == i2a[0], "wrong value");
     test_assert(2 == i2a[1], "wrong value");
     test_assert(3 == i2a[2], "wrong value");
 
-    const nsTArray<double>& i3a = i3.get_ArrayOfdouble();
+    const InfallibleTArray<double>& i3a = i3.get_ArrayOfdouble();
     test_assert(3 == i3a.Length(), "wrong length");
     test_assert(1.0 == i3a[0], "wrong value");
     test_assert(2.0 == i3a[1], "wrong value");
     test_assert(3.0 == i3a[2], "wrong value");
 
     *o1 = i1;
     *o2 = i2a;
     *o3 = i3a;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest6(
-        const nsTArray<IntDoubleArrays>& i1,
-        nsTArray<IntDoubleArrays>* o1)
+        const InfallibleTArray<IntDoubleArrays>& i1,
+        InfallibleTArray<IntDoubleArrays>* o1)
 {
     test_assert(3 == i1.Length(), "wrong length");
 
     IntDoubleArrays id1(i1[0]);
     test_assert(42 == id1.get_int(), "wrong value");
 
-    nsTArray<int> i2a = i1[1].get_ArrayOfint();
+    InfallibleTArray<int> i2a = i1[1].get_ArrayOfint();
     test_assert(3 == i2a.Length(), "wrong length");
     test_assert(1 == i2a[0], "wrong value");
     test_assert(2 == i2a[1], "wrong value");
     test_assert(3 == i2a[2], "wrong value");
 
-    nsTArray<double> i3a = i1[2].get_ArrayOfdouble();
+    InfallibleTArray<double> i3a = i1[2].get_ArrayOfdouble();
     test_assert(3 == i3a.Length(), "wrong length");
     test_assert(1.0 == i3a[0], "wrong value");
     test_assert(2.0 == i3a[1], "wrong value");
     test_assert(3.0 == i3a[2], "wrong value");
 
     o1->AppendElement(id1);
     o1->AppendElement(IntDoubleArrays(i2a));
     o1->AppendElement(IntDoubleArrays(i3a));
@@ -186,39 +186,39 @@ bool TestDataStructuresParent::RecvTest7
         const Actors& i2,
         const Actors& i3,
         Actors* o1,
         Actors* o2,
         Actors* o3)
 {
     test_assert(42 == i1.get_int(), "wrong value");
 
-    nsTArray<int> i2a(i2.get_ArrayOfint());
+    InfallibleTArray<int> i2a(i2.get_ArrayOfint());
     test_assert(3 == i2a.Length(), "wrong length");
     test_assert(1 == i2a[0], "wrong value");
     test_assert(2 == i2a[1], "wrong value");
     test_assert(3 == i2a[2], "wrong value");
 
     assert_arrays_equal(mKids, i3.get_ArrayOfPTestDataStructuresSubParent());
 
     *o1 = 42;
     *o2 = i2a;
     *o3 = mKids;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest8(
-        const nsTArray<Actors>& i1,
-        nsTArray<Actors>* o1)
+        const InfallibleTArray<Actors>& i1,
+        InfallibleTArray<Actors>* o1)
 {
     test_assert(3 == i1.Length(), "wrong length");
     test_assert(42 == i1[0].get_int(), "wrong value");
 
-    const nsTArray<int>& i2a = i1[1].get_ArrayOfint();
+    const InfallibleTArray<int>& i2a = i1[1].get_ArrayOfint();
     test_assert(3 == i2a.Length(), "wrong length");
     test_assert(1 == i2a[0], "wrong value");
     test_assert(2 == i2a[1], "wrong value");
     test_assert(3 == i2a[2], "wrong value");
 
     assert_arrays_equal(mKids, i1[2].get_ArrayOfPTestDataStructuresSubParent());
 
     *o1 = i1;
@@ -233,51 +233,51 @@ bool TestDataStructuresParent::RecvTest9
         const Unions& i4,
         Unions* o1,
         Unions* o2,
         Unions* o3,
         Unions* o4)
 {
     test_assert(42 == i1.get_int(), "wrong value");
 
-    const nsTArray<int>& i2a = i2.get_ArrayOfint();
+    const InfallibleTArray<int>& i2a = i2.get_ArrayOfint();
     test_assert(3 == i2a.Length(), "wrong length");
     test_assert(1 == i2a[0], "wrong value");
     test_assert(2 == i2a[1], "wrong value");
     test_assert(3 == i2a[2], "wrong value");
 
     assert_arrays_equal(mKids, i3.get_ArrayOfPTestDataStructuresSubParent());
 
-    const nsTArray<PTestDataStructuresSubParent*>& i4a = 
+    const InfallibleTArray<PTestDataStructuresSubParent*>& i4a = 
         i4.get_ArrayOfActors()[0].get_ArrayOfPTestDataStructuresSubParent();
     assert_arrays_equal(mKids, i4a);
 
     *o1 = i1;
     *o2 = i2;
     *o3 = i3;
     *o4 = i4;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest10(
-        const nsTArray<Unions>& i1,
-        nsTArray<Unions>* o1)
+        const InfallibleTArray<Unions>& i1,
+        InfallibleTArray<Unions>* o1)
 {
     test_assert(42 == i1[0].get_int(), "wrong value");
 
-    const nsTArray<int>& i2a = i1[1].get_ArrayOfint();
+    const InfallibleTArray<int>& i2a = i1[1].get_ArrayOfint();
     test_assert(3 == i2a.Length(), "wrong length");
     test_assert(1 == i2a[0], "wrong value");
     test_assert(2 == i2a[1], "wrong value");
     test_assert(3 == i2a[2], "wrong value");
 
     assert_arrays_equal(mKids, i1[2].get_ArrayOfPTestDataStructuresSubParent());
 
-    const nsTArray<PTestDataStructuresSubParent*>& i4a = 
+    const InfallibleTArray<PTestDataStructuresSubParent*>& i4a = 
         i1[3].get_ArrayOfActors()[0].get_ArrayOfPTestDataStructuresSubParent();
     assert_arrays_equal(mKids, i4a);
 
     *o1 = i1;
 
     return true;
 }
 
@@ -290,22 +290,22 @@ bool TestDataStructuresParent::RecvTest1
     *o = i;
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest12(
             const SIntDoubleArrays& i,
             SIntDoubleArrays* o)
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);
     ai.AppendElement(2);
     ai.AppendElement(3);
 
-    nsTArray<double> ad;
+    InfallibleTArray<double> ad;
     ad.AppendElement(.5);
     ad.AppendElement(1.0);
     ad.AppendElement(2.0);
 
     test_assert(42 == i.i(), "wrong value");
     assert_arrays_equal(ai, i.ai());
     assert_arrays_equal(ad, i.ad());
 
@@ -313,33 +313,33 @@ bool TestDataStructuresParent::RecvTest1
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest13(
             const SActors& i,
             SActors* o)
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
     test_assert(42 == i.i(), "wrong value");
     assert_arrays_equal(ai, i.ai());
     assert_arrays_equal(mKids, i.apParent());
 
     *o = i;
 
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest14(
             const Structs& i,
             Structs* o)
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
     test_assert(42 == i.i(), "wrong value");
     assert_arrays_equal(ai, i.ai());
     assert_arrays_equal(mKids, i.apParent());
 
     const SActors& ia = i.aa()[0];
     test_assert(42 == ia.i(), "wrong value");
@@ -358,17 +358,17 @@ bool TestDataStructuresParent::RecvTest1
             const WithStructs& i4,
             const WithStructs& i5,
             WithStructs* o1,
             WithStructs* o2,
             WithStructs* o3,
             WithStructs* o4,
             WithStructs* o5)
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
     test_assert(i1 == int(42), "wrong value");
     assert_arrays_equal(i2.get_ArrayOfint(), ai);
     assert_arrays_equal(i3.get_ArrayOfPTestDataStructuresSubParent(), mKids);
 
     const SActors& ia = i4.get_ArrayOfSActors()[0];
     test_assert(42 == ia.i(), "wrong value");
@@ -395,38 +395,38 @@ bool TestDataStructuresParent::RecvTest1
 }
 
 bool TestDataStructuresParent::RecvTest16(
             const WithUnions& i,
             WithUnions* o)
 {
     test_assert(i.i() == 42, "wrong value");
 
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
     assert_arrays_equal(ai, i.ai());
 
     assert_arrays_equal(i.apParent(), mKids);
 
     assert_arrays_equal(mKids, i.aa()[0].get_ArrayOfPTestDataStructuresSubParent());
 
-    const nsTArray<Unions>& iau = i.au();
+    const InfallibleTArray<Unions>& iau = i.au();
     test_assert(iau[0] == 42, "wrong value");
     assert_arrays_equal(ai, iau[1].get_ArrayOfint());
     assert_arrays_equal(mKids, iau[2].get_ArrayOfPTestDataStructuresSubParent());
     assert_arrays_equal(mKids,
                         iau[3].get_ArrayOfActors()[0]
                         .get_ArrayOfPTestDataStructuresSubParent());
 
     *o = i;
 
     return true;
 }
 
-bool TestDataStructuresParent::RecvTest17(const nsTArray<Op>& sa)
+bool TestDataStructuresParent::RecvTest17(const InfallibleTArray<Op>& sa)
 {
     test_assert(sa.Length() == 1 && Op::TSetAttrs == sa[0].type(),
                 "wrong value");
     return true;
 }
 
 bool TestDataStructuresParent::RecvTest18(const RegionArray& ra)
 {
@@ -485,34 +485,34 @@ TestDataStructuresChild::RecvStart()
     Close();
 
     return true;
 }
 
 void
 TestDataStructuresChild::Test1()
 {
-    nsTArray<int> ia;
+    InfallibleTArray<int> ia;
 
     for (int i = 0; i < 5; ++i)
         ia.AppendElement(i);
 
-    nsTArray<int> oa;
+    InfallibleTArray<int> oa;
     if (!SendTest1(ia, &oa))
         fail("can't send Test1");
 
     assert_arrays_equal(ia, oa);
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test2()
 {
-    nsTArray<PTestDataStructuresSubChild*> oa;
+    InfallibleTArray<PTestDataStructuresSubChild*> oa;
     if (!SendTest2(mKids, &oa))
         fail("can't send Test2");
     assert_arrays_equal(mKids, oa);
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
@@ -530,23 +530,23 @@ TestDataStructuresChild::Test3()
     test_assert(i2d == o2.get_double(), "wrong value");
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test4()
 {
-    nsTArray<IntDouble> i1;
+    InfallibleTArray<IntDouble> i1;
     i1.AppendElement(IntDouble(int(1)));
     i1.AppendElement(IntDouble(2.0));
     i1.AppendElement(IntDouble(int(3)));
     i1.AppendElement(IntDouble(4.0));
 
-    nsTArray<IntDouble> o1;
+    InfallibleTArray<IntDouble> o1;
     if (!SendTest4(i1, &o1))
         fail("can't send Test4");
 
     // TODO Union::operator==()
     test_assert(i1.Length() == o1.Length(), "wrong length");
     test_assert(1 == o1[0].get_int(), "wrong value");
     test_assert(2.0 == o1[1].get_double(), "wrong value");
     test_assert(3 == o1[2].get_int(), "wrong value");
@@ -554,19 +554,19 @@ TestDataStructuresChild::Test4()
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test5()
 {
     IntDoubleArrays i1(int(42));
-    nsTArray<int> i2;
+    InfallibleTArray<int> i2;
     i2.AppendElement(1); i2.AppendElement(2); i2.AppendElement(3);
-    nsTArray<double> i3;
+    InfallibleTArray<double> i3;
     i3.AppendElement(1.0); i3.AppendElement(2.0); i3.AppendElement(3.0);
 
     IntDoubleArrays o1, o2, o3;
     if (!SendTest5(i1, IntDoubleArrays(i2), IntDoubleArrays(i3),
                    &o1, &o2, &o3))
         fail("can't send Test5");
 
     test_assert(42 == o1.get_int(), "wrong value");
@@ -575,47 +575,47 @@ TestDataStructuresChild::Test5()
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test6()
 {
     IntDoubleArrays id1(int(42));
-    nsTArray<int> id2;
+    InfallibleTArray<int> id2;
     id2.AppendElement(1); id2.AppendElement(2); id2.AppendElement(3);
-    nsTArray<double> id3;
+    InfallibleTArray<double> id3;
     id3.AppendElement(1.0); id3.AppendElement(2.0); id3.AppendElement(3.0);
 
-    nsTArray<IntDoubleArrays> i1;
+    InfallibleTArray<IntDoubleArrays> i1;
     i1.AppendElement(id1);
     i1.AppendElement(IntDoubleArrays(id2));
     i1.AppendElement(IntDoubleArrays(id3));
 
-    nsTArray<IntDoubleArrays> o1;
+    InfallibleTArray<IntDoubleArrays> o1;
     if (!SendTest6(i1, &o1))
         fail("can't send Test6");
 
     test_assert(3 == o1.Length(), "wrong length");
     IntDoubleArrays od1(o1[0]);
-    nsTArray<int> od2 = o1[1].get_ArrayOfint();
-    nsTArray<double> od3 = o1[2].get_ArrayOfdouble();
+    InfallibleTArray<int> od2 = o1[1].get_ArrayOfint();
+    InfallibleTArray<double> od3 = o1[2].get_ArrayOfdouble();
 
     test_assert(42 == od1.get_int(), "wrong value");
     assert_arrays_equal(id2, od2);
     assert_arrays_equal(id3, od3);
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test7()
 {
     Actors i1(42);
-    nsTArray<int> i2a;
+    InfallibleTArray<int> i2a;
     i2a.AppendElement(1);  i2a.AppendElement(2);  i2a.AppendElement(3);
 
     Actors o1, o2, o3;
     if (!SendTest7(i1, Actors(i2a), Actors(mKids), &o1, &o2, &o3))
         fail("can't send Test7");
 
     test_assert(42 == o1.get_int(), "wrong value");
     assert_arrays_equal(i2a, o2.get_ArrayOfint());
@@ -623,47 +623,47 @@ TestDataStructuresChild::Test7()
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test8()
 {
     Actors i1e(42);
-    nsTArray<int> i2a;
+    InfallibleTArray<int> i2a;
     i2a.AppendElement(1);  i2a.AppendElement(2);  i2a.AppendElement(3);
 
-    nsTArray<Actors> i1;
+    InfallibleTArray<Actors> i1;
     i1.AppendElement(i1e);
     i1.AppendElement(i2a);
     i1.AppendElement(mKids);
 
-    nsTArray<Actors> o1;
+    InfallibleTArray<Actors> o1;
     if (!SendTest8(i1, &o1))
         fail("can't send Test8");
 
     test_assert(3 == o1.Length(), "wrong length");
     test_assert(42 == o1[0].get_int(), "wrong value");
     assert_arrays_equal(i2a, o1[1].get_ArrayOfint());
     assert_arrays_equal(mKids, o1[2].get_ArrayOfPTestDataStructuresSubChild());
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test9()
 {
     Unions i1(int(42));
 
-    nsTArray<int> i2a;
+    InfallibleTArray<int> i2a;
     i2a.AppendElement(1);
     i2a.AppendElement(2);
     i2a.AppendElement(3);
 
-    nsTArray<Actors> i4a;
+    InfallibleTArray<Actors> i4a;
     i4a.AppendElement(mKids);
 
     Unions o1, o2, o3, o4;
     if (!SendTest9(i1, Unions(i2a), Unions(mKids), Unions(i4a),
                    &o1, &o2, &o3, &o4))
         fail("can't send Test9");
 
     test_assert(42 == o1.get_int(), "wrong value");
@@ -676,31 +676,31 @@ TestDataStructuresChild::Test9()
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test10()
 {
     Unions i1a(int(42));
 
-    nsTArray<int> i2a;
+    InfallibleTArray<int> i2a;
     i2a.AppendElement(1);
     i2a.AppendElement(2);
     i2a.AppendElement(3);
 
-    nsTArray<Actors> i4a;
+    InfallibleTArray<Actors> i4a;
     i4a.AppendElement(mKids);
 
-    nsTArray<Unions> i1;
+    InfallibleTArray<Unions> i1;
     i1.AppendElement(i1a);
     i1.AppendElement(Unions(i2a));
     i1.AppendElement(Unions(mKids));
     i1.AppendElement(Unions(i4a));
 
-    nsTArray<Unions> o1;
+    InfallibleTArray<Unions> o1;
     if (!SendTest10(i1, &o1))
         fail("can't send Test10");
 
     test_assert(4 == o1.Length(), "wrong length");
     test_assert(42 == o1[0].get_int(), "wrong value");
     assert_arrays_equal(i2a, o1[1].get_ArrayOfint());
     assert_arrays_equal(mKids, o1[2].get_ArrayOfPTestDataStructuresSubChild());
     assert_arrays_equal(
@@ -722,20 +722,20 @@ TestDataStructuresChild::Test11()
     test_assert(1 == o.i() && 2.0 == o.d(), "wrong values");
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test12()
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
-    nsTArray<double> ad;
+    InfallibleTArray<double> ad;
     ad.AppendElement(.5);  ad.AppendElement(1.0);  ad.AppendElement(2.0);
 
     SIntDoubleArrays i(42, ai, ad);
     SIntDoubleArrays o;
 
     if (!SendTest12(i, &o))
         fail("sending Test12");
 
@@ -744,17 +744,17 @@ TestDataStructuresChild::Test12()
     assert_arrays_equal(ad, o.ad());
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test13()
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
     SActors i;
     i.i() = 42;
     i.ai() = ai;
     i.apChild() = mKids;
 
     SActors o;
@@ -766,24 +766,24 @@ TestDataStructuresChild::Test13()
     assert_arrays_equal(mKids, o.apChild());
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test14()
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
     SActors ia;
     ia.i() = 42;
     ia.ai() = ai;
     ia.apChild() = mKids;
-    nsTArray<SActors> aa;  aa.AppendElement(ia);
+    InfallibleTArray<SActors> aa;  aa.AppendElement(ia);
 
     Structs i;
     i.i() = 42;
     i.ai() = ai;
     i.apChild() = mKids;
     i.aa() = aa;
 
     Structs o;
@@ -800,31 +800,31 @@ TestDataStructuresChild::Test14()
     assert_arrays_equal(mKids, os.apChild());
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
 void
 TestDataStructuresChild::Test15()
 {
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
 
     SActors ia;
     ia.i() = 42;
     ia.ai() = ai;
     ia.apChild() = mKids;
-    nsTArray<SActors> iaa;  iaa.AppendElement(ia);
+    InfallibleTArray<SActors> iaa;  iaa.AppendElement(ia);
 
     Structs is;
     is.i() = 42;
     is.ai() = ai;
     is.apChild() = mKids;
     is.aa() = iaa;
-    nsTArray<Structs> isa;  isa.AppendElement(is);
+    InfallibleTArray<Structs> isa;  isa.AppendElement(is);
 
     WithStructs o1, o2, o3, o4, o5;
     if (!SendTest15(WithStructs(42),
                     WithStructs(ai),
                     WithStructs(mKids),
                     WithStructs(iaa),
                     WithStructs(isa),
                     &o1, &o2, &o3, &o4, &o5))
@@ -854,27 +854,27 @@ TestDataStructuresChild::Test15()
 
 void
 TestDataStructuresChild::Test16()
 {
     WithUnions i;
 
     i.i() = 42;
 
-    nsTArray<int> ai;
+    InfallibleTArray<int> ai;
     ai.AppendElement(1);  ai.AppendElement(2);  ai.AppendElement(3);
     i.ai() = ai;
 
     i.apChild() = mKids;
 
-    nsTArray<Actors> iaa;
+    InfallibleTArray<Actors> iaa;
     iaa.AppendElement(mKids);
     i.aa() = iaa;
 
-    nsTArray<Unions> iau;
+    InfallibleTArray<Unions> iau;
     iau.AppendElement(int(42));
     iau.AppendElement(ai);
     iau.AppendElement(mKids);
     iau.AppendElement(iaa);
     i.au() = iau;
 
     WithUnions o;
     if (!SendTest16(i, &o))
@@ -882,17 +882,17 @@ TestDataStructuresChild::Test16()
 
     test_assert(42 == o.i(), "wrong value");
     assert_arrays_equal(o.ai(), ai);
     assert_arrays_equal(o.apChild(), mKids);
 
     const Actors& oaa = o.aa()[0];
     assert_arrays_equal(oaa.get_ArrayOfPTestDataStructuresSubChild(), mKids);
 
-    const nsTArray<Unions>& oau = o.au();
+    const InfallibleTArray<Unions>& oau = o.au();
     test_assert(oau[0] == 42, "wrong value");
     assert_arrays_equal(oau[1].get_ArrayOfint(), ai);
     assert_arrays_equal(oau[2].get_ArrayOfPTestDataStructuresSubChild(),
                         mKids);
     assert_arrays_equal(oau[3].get_ArrayOfActors()[0]
                         .get_ArrayOfPTestDataStructuresSubChild(),
                         mKids);
 
@@ -901,17 +901,17 @@ TestDataStructuresChild::Test16()
 
 void
 TestDataStructuresChild::Test17()
 {
     Attrs attrs;
     attrs.common() = CommonAttrs(true);
     attrs.specific() = BarAttrs(1.0f);
 
-    nsTArray<Op> ops;
+    InfallibleTArray<Op> ops;
     ops.AppendElement(SetAttrs(NULL, mKids[0], attrs));
 
     if (!SendTest17(ops))
         fail("sending Test17");
 
     printf("  passed %s\n", __FUNCTION__);
 }
 
--- a/ipc/ipdl/test/cxx/TestDataStructures.h
+++ b/ipc/ipdl/test/cxx/TestDataStructures.h
@@ -48,79 +48,79 @@ protected:
         return actor;
     }
 
     NS_OVERRIDE
     virtual bool DeallocPTestDataStructuresSub(PTestDataStructuresSubParent* actor);
 
     NS_OVERRIDE
     virtual bool RecvTest1(
-            const nsTArray<int>& i1,
-            nsTArray<int>* o1);
+            const InfallibleTArray<int>& i1,
+            InfallibleTArray<int>* o1);
 
     NS_OVERRIDE
     virtual bool RecvTest2(
-            const nsTArray<PTestDataStructuresSubParent*>& i1,
-            nsTArray<PTestDataStructuresSubParent*>* o1);
+            const InfallibleTArray<PTestDataStructuresSubParent*>& i1,
+            InfallibleTArray<PTestDataStructuresSubParent*>* o1);
 
     NS_OVERRIDE
     virtual bool RecvTest3(
             const IntDouble& i1,
             const IntDouble& i2,
             IntDouble* o1,
             IntDouble* o2);
 
     NS_OVERRIDE
     virtual bool RecvTest4(
-            const nsTArray<IntDouble>& i1,
-            nsTArray<IntDouble>* o1);
+            const InfallibleTArray<IntDouble>& i1,
+            InfallibleTArray<IntDouble>* o1);
 
     NS_OVERRIDE
     virtual bool RecvTest5(
             const IntDoubleArrays& i1,
             const IntDoubleArrays& i2,
             const IntDoubleArrays& i3,
             IntDoubleArrays* o1,
             IntDoubleArrays* o2,
             IntDoubleArrays* o3);
 
     NS_OVERRIDE
     virtual bool RecvTest6(
-            const nsTArray<IntDoubleArrays>& i1,
-            nsTArray<IntDoubleArrays>* o1);
+            const InfallibleTArray<IntDoubleArrays>& i1,
+            InfallibleTArray<IntDoubleArrays>* o1);
 
     NS_OVERRIDE
     virtual bool RecvTest7(
             const Actors& i1,
             const Actors& i2,
             const Actors& i3,
             Actors* o1,
             Actors* o2,
             Actors* o3);
 
     NS_OVERRIDE
     virtual bool RecvTest8(
-            const nsTArray<Actors>& i1,
-            nsTArray<Actors>* o1);
+            const InfallibleTArray<Actors>& i1,
+            InfallibleTArray<Actors>* o1);
 
     NS_OVERRIDE
     virtual bool RecvTest9(
             const Unions& i1,
             const Unions& i2,
             const Unions& i3,
             const Unions& i4,
             Unions* o1,
             Unions* o2,
             Unions* o3,
             Unions* o4);
 
     NS_OVERRIDE
     virtual bool RecvTest10(
-            const nsTArray<Unions>& i1,
-            nsTArray<Unions>* o1);
+            const InfallibleTArray<Unions>& i1,
+            InfallibleTArray<Unions>* o1);
 
     NS_OVERRIDE
     virtual bool RecvTest11(
             const SIntDouble& i,
             SIntDouble* o);
 
     NS_OVERRIDE
     virtual bool RecvTest12(
@@ -151,20 +151,20 @@ protected:
             WithStructs* o5);
 
     NS_OVERRIDE
     virtual bool RecvTest16(
             const WithUnions& i,
             WithUnions* o);
 
     NS_OVERRIDE
-    virtual bool RecvTest17(const nsTArray<Op>& sa);
+    virtual bool RecvTest17(const InfallibleTArray<Op>& sa);
 
     NS_OVERRIDE
-    virtual bool RecvTest18(const nsTArray<nsIntRegion>& ra);
+    virtual bool RecvTest18(const InfallibleTArray<nsIntRegion>& ra);
 
     NS_OVERRIDE
     virtual bool RecvDummy(const ShmemUnion& su, ShmemUnion* rsu)
     {
         *rsu = su;
         return true;
     }
 
@@ -173,17 +173,17 @@ protected:
     {
         if (NormalShutdown != why)
             fail("unexpected destruction!");  
         passed("ok");
         QuitParent();
     }
 
 private:
-    nsTArray<PTestDataStructuresSubParent*> mKids;
+    InfallibleTArray<PTestDataStructuresSubParent*> mKids;
 };
 
 
 class TestDataStructuresChild :
     public PTestDataStructuresChild
 {
 public:
     TestDataStructuresChild();
@@ -231,17 +231,17 @@ private:
     void Test12();
     void Test13();
     void Test14();
     void Test15();
     void Test16();
     void Test17();
     void Test18();
 
-    nsTArray<PTestDataStructuresSubChild*> mKids;
+    InfallibleTArray<PTestDataStructuresSubChild*> mKids;
 };
 
 
 } // namespace _ipdltest
 } // namespace mozilla
 
 
 #endif // ifndef mozilla__ipdltest_TestDataStructures_h
--- a/ipc/ipdl/test/cxx/TestJSON.cpp
+++ b/ipc/ipdl/test/cxx/TestJSON.cpp
@@ -9,20 +9,20 @@ namespace mozilla {
 namespace _ipdltest {
 
 static nsString
 String(const char* const str)
 {
     return NS_ConvertUTF8toUTF16(str);
 }
 
-static nsTArray<JSONVariant>
+static InfallibleTArray<JSONVariant>
 Array123()
 {
-    nsTArray<JSONVariant> a123;
+    InfallibleTArray<JSONVariant> a123;
     a123.AppendElement(1);  a123.AppendElement(2);  a123.AppendElement(3);
 
     test_assert(a123 == a123, "operator== is broken");
 
     return a123;
 }
 
 template<class HandleT>
@@ -40,29 +40,29 @@ MakeTestVariant(HandleT* handle)
     //       "true"      : true,
     //       "1.25"      : 1.25,
     //       "string"    : "string"
     //       "handle"    : handle,
     //       "array"     : [ 1, 2, 3 ]
     //     }
     //   ]
     //
-    nsTArray<JSONVariant> outer;
+    InfallibleTArray<JSONVariant> outer;
 
     outer.AppendElement(void_t());
     outer.AppendElement(null_t());
     outer.AppendElement(true);
     outer.AppendElement(1.25);
     outer.AppendElement(String("test string"));
 
     outer.AppendElement(handle);
 
     outer.AppendElement(Array123());
 
-    nsTArray<KeyValue> obj;
+    InfallibleTArray<KeyValue> obj;
     obj.AppendElement(KeyValue(String("undefined"), void_t()));
     obj.AppendElement(KeyValue(String("null"), null_t()));
     obj.AppendElement(KeyValue(String("true"), true));
     obj.AppendElement(KeyValue(String("1.25"), 1.25));
     obj.AppendElement(KeyValue(String("string"), String("value")));
     obj.AppendElement(KeyValue(String("handle"), handle));
     obj.AppendElement(KeyValue(String("array"), Array123()));
 
--- a/ipc/ipdl/test/cxx/TestMultiMgrs.h
+++ b/ipc/ipdl/test/cxx/TestMultiMgrs.h
@@ -31,21 +31,17 @@ class TestMultiMgrsLeftParent :
     public PTestMultiMgrsLeftParent
 {
 public:
     TestMultiMgrsLeftParent() { }
     virtual ~TestMultiMgrsLeftParent() { }
 
     bool HasChild(TestMultiMgrsBottomParent* c)
     {
-        // XXX this interface really sucks.  maybe a helper
-        // |const Array& ManagedPFoo() const| ?
-        nsTArray<PTestMultiMgrsBottomParent*> a;
-        ManagedPTestMultiMgrsBottomParent(a);
-        return a.Contains(c);
+        return ManagedPTestMultiMgrsBottomParent().Contains(c);
     }
 
 protected:
     NS_OVERRIDE
     virtual PTestMultiMgrsBottomParent* AllocPTestMultiMgrsBottom()
     {
         return new TestMultiMgrsBottomParent();
     }
@@ -62,19 +58,17 @@ class TestMultiMgrsRightParent :
     public PTestMultiMgrsRightParent
 {
 public:
     TestMultiMgrsRightParent() { }
     virtual ~TestMultiMgrsRightParent() { }
 
     bool HasChild(TestMultiMgrsBottomParent* c)
     {
-        nsTArray<PTestMultiMgrsBottomParent*> a;
-        ManagedPTestMultiMgrsBottomParent(a);
-        return a.Contains(c);
+        return ManagedPTestMultiMgrsBottomParent().Contains(c);
     }
 
 protected:
     NS_OVERRIDE
     virtual PTestMultiMgrsBottomParent* AllocPTestMultiMgrsBottom()
     {
         return new TestMultiMgrsBottomParent();
     }
@@ -152,19 +146,17 @@ class TestMultiMgrsLeftChild :
     public PTestMultiMgrsLeftChild
 {
 public:
     TestMultiMgrsLeftChild() { }
     virtual ~TestMultiMgrsLeftChild() { }
 
     bool HasChild(PTestMultiMgrsBottomChild* c)
     {
-        nsTArray<PTestMultiMgrsBottomChild*> a;
-        ManagedPTestMultiMgrsBottomChild(a);
-        return a.Contains(c);
+        return ManagedPTestMultiMgrsBottomChild().Contains(c);
     }
 
 protected:
     NS_OVERRIDE
     virtual bool RecvPTestMultiMgrsBottomConstructor(PTestMultiMgrsBottomChild* actor);
 
     NS_OVERRIDE
     virtual PTestMultiMgrsBottomChild* AllocPTestMultiMgrsBottom()
@@ -184,19 +176,17 @@ class TestMultiMgrsRightChild :
     public PTestMultiMgrsRightChild
 {
 public:
     TestMultiMgrsRightChild() { }
     virtual ~TestMultiMgrsRightChild() { }
 
     bool HasChild(PTestMultiMgrsBottomChild* c)
     {
-        nsTArray<PTestMultiMgrsBottomChild*> a;
-        ManagedPTestMultiMgrsBottomChild(a);
-        return a.Contains(c);
+        return ManagedPTestMultiMgrsBottomChild().Contains(c);
     }
 
 protected:
     NS_OVERRIDE
     virtual bool RecvPTestMultiMgrsBottomConstructor(PTestMultiMgrsBottomChild* actor);
 
     NS_OVERRIDE
     virtual PTestMultiMgrsBottomChild* AllocPTestMultiMgrsBottom()
--- a/ipc/ipdl/test/cxx/TestShutdown.cpp
+++ b/ipc/ipdl/test/cxx/TestShutdown.cpp
@@ -21,19 +21,17 @@ TestShutdownParent::ActorDestroy(ActorDe
     passed("ok");
 
     QuitParent();
 }
 
 void
 TestShutdownSubParent::ActorDestroy(ActorDestroyReason why)
 {
-    nsTArray<PTestShutdownSubParent*> broArr; // grumble grumble
-    Manager()->ManagedPTestShutdownSubParent(broArr);
-    if (broArr.Length() == 0)
+    if (Manager()->ManagedPTestShutdownSubParent().Length() == 0)
         fail("manager should still have managees!");
 
     if (mExpectCrash && AbnormalShutdown != why)
         fail("expected crash!");
     else if (!mExpectCrash && AbnormalShutdown == why)
         fail("wasn't expecting crash!");
 
     if (mExpectCrash && 0 == ManagedPTestShutdownSubsubParent().Length())
--- a/ipc/testshell/TestShellParent.cpp
+++ b/ipc/testshell/TestShellParent.cpp
@@ -84,17 +84,17 @@ TestShellParent::DeallocPContextWrapper(
     delete actor;
     return true;
 }
 
 JSBool
 TestShellParent::GetGlobalJSObject(JSContext* cx, JSObject** globalp)
 {
     // TODO Unify this code with TabParent::GetGlobalJSObject.
-    nsTArray<PContextWrapperParent*> cwps(1);
+    InfallibleTArray<PContextWrapperParent*> cwps(1);
     ManagedPContextWrapperParent(cwps);
     if (cwps.Length() < 1)
         return JS_FALSE;
     NS_ASSERTION(cwps.Length() == 1, "More than one PContextWrapper?");
     ContextWrapperParent* cwp = static_cast<ContextWrapperParent*>(cwps[0]);
     return cwp->GetGlobalJSObject(cx, globalp);
 }
 
--- a/js/ipc/ObjectWrapperChild.cpp
+++ b/js/ipc/ObjectWrapperChild.cpp
@@ -451,22 +451,22 @@ ObjectWrapperChild::AnswerNewEnumerateIn
          proto = JS_GetPrototype(cx, proto))
     {
         AutoIdArray ids(cx, JS_Enumerate(cx, proto));
         for (uint i = 0; i < ids.length(); ++i)
             JS_DefinePropertyById(cx, state, ids[i], JSVAL_VOID,
                                   NULL, NULL, JSPROP_ENUMERATE | JSPROP_SHARED);
     }
 
-    nsTArray<nsString>* strIds;
+    InfallibleTArray<nsString>* strIds;
     {
         AutoIdArray ids(cx, JS_Enumerate(cx, state));
         if (!ids)
             return false;
-        strIds = new nsTArray<nsString>(ids.length());
+        strIds = new InfallibleTArray<nsString>(ids.length());
         for (uint i = 0; i < ids.length(); ++i)
             if (!jsid_to_nsString(cx, ids[i], strIds->AppendElement())) {
                 delete strIds;
                 return false;
             }
     }
     *idp = strIds->Length();
 
@@ -490,18 +490,18 @@ ObjectWrapperChild::AnswerNewEnumerateNe
     
     JSContext* cx = Manager()->GetContext();
     AutoContextPusher acp(cx);
     AutoCheckOperation aco(this, status);
 
     if (!JSObject_from_JSVariant(cx, in_state, &state))
         return false;
 
-    nsTArray<nsString>* strIds =
-        static_cast<nsTArray<nsString>*>(JS_GetPrivate(cx, state));
+    InfallibleTArray<nsString>* strIds =
+        static_cast<InfallibleTArray<nsString>*>(JS_GetPrivate(cx, state));
 
     if (!strIds || !JS_GetReservedSlot(cx, state, sNextIdIndexSlot, &v))
         return false;
 
     jsuint i = JSVAL_TO_INT(v);
     NS_ASSERTION(i >= 0, "Index of next jsid negative?");
     NS_ASSERTION(i <= strIds->Length(), "Index of next jsid too large?");
 
@@ -575,17 +575,17 @@ ObjectWrapperChild::AnswerConvert(const 
 }
 
 namespace {
     // Should be an overestimate of typical JS function arity.
     typedef nsAutoTArray<jsval, 5> AutoJSArgs;
 }
 
 bool
-ObjectWrapperChild::AnswerCall(PObjectWrapperChild* receiver, const nsTArray<JSVariant>& argv,
+ObjectWrapperChild::AnswerCall(PObjectWrapperChild* receiver, const InfallibleTArray<JSVariant>& argv,
                                OperationStatus* status, JSVariant* rval)
 {
     JSContext* cx = Manager()->GetContext();
     AutoContextPusher acp(cx);
     AutoCheckOperation aco(this, status);
 
     JSObject* obj;
     if (!JSObject_from_PObjectWrapperChild(cx, receiver, &obj))
@@ -605,17 +605,17 @@ ObjectWrapperChild::AnswerCall(PObjectWr
     jsval rv;
     *status = JS_CallFunctionValue(cx, obj, OBJECT_TO_JSVAL(mObj),
                                    argv.Length(), jsargs, &rv);
 
     return jsval_to_JSVariant(cx, aco.Ok() ? rv : JSVAL_VOID, rval);
 }
 
 bool
-ObjectWrapperChild::AnswerConstruct(const nsTArray<JSVariant>& argv,
+ObjectWrapperChild::AnswerConstruct(const InfallibleTArray<JSVariant>& argv,
                                     OperationStatus* status, PObjectWrapperChild** rval)
 {
     JSContext* cx = Manager()->GetContext();
     AutoContextPusher acp(cx);
     AutoCheckOperation aco(this, status);
 
     AutoJSArgs args;
     PRUint32 argc = argv.Length();
--- a/js/ipc/ObjectWrapperChild.h
+++ b/js/ipc/ObjectWrapperChild.h
@@ -107,20 +107,20 @@ protected:
     bool RecvNewEnumerateDestroy(const JSVariant& in_state);
 
     bool AnswerNewResolve(const nsString& id, const int& flags,
                           OperationStatus* status, PObjectWrapperChild** obj2);
 
     bool AnswerConvert(const JSType& type,
                        OperationStatus* status, JSVariant* vp);
 
-    bool AnswerCall(PObjectWrapperChild* receiver, const nsTArray<JSVariant>& argv,
+    bool AnswerCall(PObjectWrapperChild* receiver, const InfallibleTArray<JSVariant>& argv,
                     OperationStatus* status, JSVariant* rval);
 
-    bool AnswerConstruct(const nsTArray<JSVariant>& argv,
+    bool AnswerConstruct(const InfallibleTArray<JSVariant>& argv,
                          OperationStatus* status, PObjectWrapperChild** rval);
 
     bool AnswerHasInstance(const JSVariant& v,
                            OperationStatus* status, JSBool* bp);
 };
 
 }}
   
--- a/js/ipc/ObjectWrapperParent.cpp
+++ b/js/ipc/ObjectWrapperParent.cpp
@@ -661,17 +661,17 @@ ObjectWrapperParent::CPOW_Call(JSContext
     if (!receiver) {
         // Substitute child global for parent global object.
         // TODO First make sure we're really replacing the global object?
         ContextWrapperParent* manager =
             static_cast<ContextWrapperParent*>(function->Manager());
         receiver = manager->GetGlobalObjectWrapper();
     }
 
-    nsTArray<JSVariant> in_argv(argc);
+    InfallibleTArray<JSVariant> in_argv(argc);
     jsval* argv = JS_ARGV(cx, vp);
     for (uintN i = 0; i < argc; i++)
         if (!jsval_to_JSVariant(cx, argv[i], in_argv.AppendElement()))
             return JS_FALSE;
 
     JSVariant out_rval;
 
     return (function->Manager()->RequestRunToCompletion() &&
@@ -687,17 +687,17 @@ ObjectWrapperParent::CPOW_Construct(JSCo
     CPOW_LOG(("Calling CPOW_Construct..."));
     
     ObjectWrapperParent* constructor = Unwrap(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)));
     if (!constructor)
         return with_error(cx, JS_FALSE, "Could not unwrap CPOW constructor function");
 
     AutoCheckOperation aco(cx, constructor);
 
-    nsTArray<JSVariant> in_argv(argc);
+    InfallibleTArray<JSVariant> in_argv(argc);
     jsval* argv = JS_ARGV(cx, vp);
     for (uintN i = 0; i < argc; i++)
         if (!jsval_to_JSVariant(cx, argv[i], in_argv.AppendElement()))
             return JS_FALSE;
 
     PObjectWrapperParent* out_powp;
 
     return (constructor->Manager()->RequestRunToCompletion() &&
--- a/js/jetpack/JetpackActorCommon.cpp
+++ b/js/jetpack/JetpackActorCommon.cpp
@@ -195,17 +195,19 @@ JetpackActorCommon::jsval_to_CompVariant
       return false;
     for (jsuint i = 0; i < len; ++i) {
       jsval val;
       Variant* vp = elems.AppendElement();
       if (!JS_GetElement(cx, obj, i, &val) ||
           !jsval_to_Variant(cx, val, vp, seen))
         *vp = void_t();
     }
-    *to = elems;
+    InfallibleTArray<Variant> outElems;
+    outElems.SwapElements(elems);
+    *to = outElems;
     return true;
   }
 
   js::AutoIdArray ida(cx, JS_Enumerate(cx, obj));
   if (!ida)
     return false;
 
   nsTArray<KeyValue> kvs;
@@ -222,17 +224,19 @@ JetpackActorCommon::jsval_to_CompVariant
     // Silently drop properties that can't be converted.
     if (jsval_to_Variant(cx, val, &kv.value(), seen)) {
       kv.key() = nsDependentString((PRUnichar*)JS_GetStringChars(idStr),
                                    JS_GetStringLength(idStr));
       // If AppendElement fails, we lose this property, no big deal.
       kvs.AppendElement(kv);
     }
   }
-  *to = kvs;
+  InfallibleTArray<KeyValue> outKvs;
+  outKvs.SwapElements(kvs);
+  *to = outKvs;
 
   return true;
 }
 
 bool
 JetpackActorCommon::jsval_to_Variant(JSContext* cx, jsval from, Variant* to,
                                      OpaqueSeenType* seen)
 {
@@ -409,18 +413,18 @@ JetpackActorCommon::jsval_from_Variant(J
   default:
     return false;
   }
 }
 
 bool
 JetpackActorCommon::RecvMessage(JSContext* cx,
                                 const nsString& messageName,
-                                const nsTArray<Variant>& data,
-                                nsTArray<Variant>* results)
+                                const InfallibleTArray<Variant>& data,
+                                InfallibleTArray<Variant>* results)
 {
   if (results)
     results->Clear();
 
   RecList* list;
   if (!mReceivers.Get(messageName, &list))
     return true;
   nsAutoTArray<jsval, 4> snapshot;
--- a/js/jetpack/JetpackActorCommon.h
+++ b/js/jetpack/JetpackActorCommon.h
@@ -57,18 +57,18 @@ class Variant;
 
 class JetpackActorCommon
 {
 public:
 
   bool
   RecvMessage(JSContext* cx,
               const nsString& messageName,
-              const nsTArray<Variant>& data,
-              nsTArray<Variant>* results);
+              const InfallibleTArray<Variant>& data,
+              InfallibleTArray<Variant>* results);
 
   nsresult
   RegisterReceiver(JSContext* cx,
                    const nsString& messageName,
                    jsval receiver);
 
   void
   UnregisterReceiver(const nsString& messageName,
--- a/js/jetpack/JetpackChild.cpp
+++ b/js/jetpack/JetpackChild.cpp
@@ -171,17 +171,17 @@ JetpackChild::CleanUp()
 void
 JetpackChild::ActorDestroy(ActorDestroyReason why)
 {
   XRE_ShutdownChildProcess();
 }
 
 bool
 JetpackChild::RecvSendMessage(const nsString& messageName,
-                              const nsTArray<Variant>& data)
+                              const InfallibleTArray<Variant>& data)
 {
   JSAutoRequest request(mCx);
 
   JSObject *global = JS_GetGlobalObject(mCx);
   JSAutoEnterCompartment ac;
   if (!ac.enter(mCx, global))
     return false;
 
@@ -223,17 +223,17 @@ JetpackChild::GetThis(JSContext* cx)
   JetpackChild* self =
     static_cast<JetpackChild*>(JS_GetContextPrivate(cx));
   JS_ASSERT(cx == self->mCx);
   return self;
 }
 
 struct MessageResult {
   nsString msgName;
-  nsTArray<Variant> data;
+  InfallibleTArray<Variant> data;
 };
 
 static JSBool
 MessageCommon(JSContext* cx, uintN argc, jsval* vp,
               MessageResult* result)
 {
   if (argc < 1) {
     JS_ReportError(cx, "Message requires a name, at least");
@@ -286,17 +286,17 @@ JetpackChild::SendMessage(JSContext* cx,
 
 JSBool
 JetpackChild::CallMessage(JSContext* cx, uintN argc, jsval* vp)
 {
   MessageResult smr;
   if (!MessageCommon(cx, argc, vp, &smr))
     return JS_FALSE;
 
-  nsTArray<Variant> results;
+  InfallibleTArray<Variant> results;
   if (!GetThis(cx)->CallCallMessage(smr.msgName, smr.data, &results)) {
     JS_ReportError(cx, "Failed to callMessage");
     return JS_FALSE;
   }
 
   nsAutoTArray<jsval, 4> jsvals;
   jsval* rvals = jsvals.AppendElements(results.Length());
   if (!rvals) {
--- a/js/jetpack/JetpackChild.h
+++ b/js/jetpack/JetpackChild.h
@@ -63,17 +63,17 @@ public:
             IPC::Channel* aChannel);
 
   void CleanUp();
 
 protected:
   NS_OVERRIDE virtual void ActorDestroy(ActorDestroyReason why);
 
   NS_OVERRIDE virtual bool RecvSendMessage(const nsString& messageName,
-                                           const nsTArray<Variant>& data);
+                                           const InfallibleTArray<Variant>& data);
   NS_OVERRIDE virtual bool RecvEvalScript(const nsString& script);
 
   NS_OVERRIDE virtual PHandleChild* AllocPHandle();
   NS_OVERRIDE virtual bool DeallocPHandle(PHandleChild* actor);
 
 private:
   JSRuntime* mRuntime;
   JSContext *mCx;
--- a/js/jetpack/JetpackParent.cpp
+++ b/js/jetpack/JetpackParent.cpp
@@ -95,17 +95,19 @@ JetpackParent::SendMessage(const nsAStri
   JSAutoEnterCompartment ac;
   if (!ac.enter(cx, JS_GetGlobalObject(cx)))
     return false;
 
   for (PRUint32 i = 1; i < argc; ++i)
     if (!jsval_to_Variant(cx, argv[i], data.AppendElement()))
       return NS_ERROR_INVALID_ARG;
 
-  if (!SendSendMessage(nsString(aMessageName), data))
+  InfallibleTArray<Variant> dataForSend;
+  dataForSend.SwapElements(data);
+  if (!SendSendMessage(nsString(aMessageName), dataForSend))
     return NS_ERROR_FAILURE;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 JetpackParent::RegisterReceiver(const nsAString& aMessageName,
                                 const jsval &aReceiver)
@@ -157,32 +159,32 @@ public:
 
 private:
   nsCOMPtr<nsIJSContextStack> mCXStack;
   JSContext* mCX;
 };
 
 bool
 JetpackParent::RecvSendMessage(const nsString& messageName,
-                               const nsTArray<Variant>& data)
+                               const InfallibleTArray<Variant>& data)
 {
   AutoCXPusher cxp(mContext);
   JSAutoRequest request(mContext);
 
   JSAutoEnterCompartment ac;
   if (!ac.enter(mContext, JS_GetGlobalObject(mContext)))
     return false;
 
   return JetpackActorCommon::RecvMessage(mContext, messageName, data, NULL);
 }
 
 bool
 JetpackParent::AnswerCallMessage(const nsString& messageName,
-                                 const nsTArray<Variant>& data,
-                                 nsTArray<Variant>* results)
+                                 const InfallibleTArray<Variant>& data,
+                                 InfallibleTArray<Variant>* results)
 {
   AutoCXPusher cxp(mContext);
   JSAutoRequest request(mContext);
 
   JSAutoEnterCompartment ac;
   if (!ac.enter(mContext, JS_GetGlobalObject(mContext)))
     return false;
 
--- a/js/jetpack/JetpackParent.h
+++ b/js/jetpack/JetpackParent.h
@@ -62,20 +62,20 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIJETPACK
 
   JetpackParent(JSContext* cx);
   ~JetpackParent();
 
 protected:
   NS_OVERRIDE virtual bool RecvSendMessage(const nsString& messageName,
-                                           const nsTArray<Variant>& data);
+                                           const InfallibleTArray<Variant>& data);
   NS_OVERRIDE virtual bool AnswerCallMessage(const nsString& messageName,
-                                             const nsTArray<Variant>& data,
-                                             nsTArray<Variant>* results);
+                                             const InfallibleTArray<Variant>& data,
+                                             InfallibleTArray<Variant>* results);
 
   NS_OVERRIDE virtual PHandleParent* AllocPHandle();
   NS_OVERRIDE virtual bool DeallocPHandle(PHandleParent* actor);
 
 private:
   JetpackProcessParent* mSubprocess;
   JSContext* mContext;
 
--- a/modules/libpref/public/nsIPrefService.idl
+++ b/modules/libpref/public/nsIPrefService.idl
@@ -38,20 +38,20 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 #include "nsIPrefBranch.idl"
 
 %{C++
 struct PrefTuple;
 template<class E, class A> class nsTArray;
-struct nsTArrayDefaultAllocator;
+struct nsTArrayInfallibleAllocator;
 %}
 
-[ptr] native nsPreferencesArrayPtr(nsTArray<PrefTuple, nsTArrayDefaultAllocator>);
+[ptr] native nsPreferencesArrayPtr(nsTArray<PrefTuple, nsTArrayInfallibleAllocator>);
 [ptr] native nsPreferencePtr(PrefTuple);
 [ptr] native nsPreferencePtrConst(const PrefTuple);
 
 interface nsIFile;
 interface nsILocalFile;
 
 /**
  * The nsIPrefService interface is the main entry point into the back end
--- a/modules/libpref/src/nsPrefService.cpp
+++ b/modules/libpref/src/nsPrefService.cpp
@@ -139,17 +139,17 @@ nsresult nsPrefService::Init()
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = pref_InitInitialObjects();
   NS_ENSURE_SUCCESS(rv, rv);
 
 #ifdef MOZ_IPC
   using mozilla::dom::ContentChild;
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
-    nsTArray<PrefTuple> array;
+    InfallibleTArray<PrefTuple> array;
     ContentChild::GetSingleton()->SendReadPrefsArray(&array);
 
     // Store the array
     nsTArray<PrefTuple>::size_type index = array.Length();
     while (index-- > 0) {
       pref_SetPrefTuple(array[index], PR_TRUE);
     }
     return NS_OK;
@@ -345,17 +345,17 @@ NS_IMETHODIMP nsPrefService::MirrorPrefe
   if (!pref)
     return NS_ERROR_NOT_AVAILABLE;
 
   pref_GetTupleFromEntry(pref, aPref);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsPrefService::MirrorPreferences(nsTArray<PrefTuple> *aArray)
+NS_IMETHODIMP nsPrefService::MirrorPreferences(nsTArray<PrefTuple, nsTArrayInfallibleAllocator> *aArray)
 {
   aArray->SetCapacity(PL_DHASH_TABLE_SIZE(&gHashTable));
 
   PL_DHashTableEnumerate(&gHashTable, pref_MirrorPrefs, aArray);
 
   return NS_OK;
 }
 
--- a/netwerk/protocol/res/nsResProtocolHandler.cpp
+++ b/netwerk/protocol/res/nsResProtocolHandler.cpp
@@ -274,17 +274,17 @@ EnumerateSubstitution(const nsACString& 
     ResourceMapping resource = {
         nsDependentCString(aKey), uri
     };
     resources->AppendElement(resource);
     return (PLDHashOperator)PL_DHASH_NEXT;
 }
 
 void
-nsResProtocolHandler::CollectSubstitutions(nsTArray<ResourceMapping>& aResources)
+nsResProtocolHandler::CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources)
 {
     mSubstitutions.EnumerateRead(&EnumerateSubstitution, &aResources);
 }
 #endif
 
 //----------------------------------------------------------------------------
 // nsResProtocolHandler::nsISupports
 //----------------------------------------------------------------------------
--- a/netwerk/protocol/res/nsResProtocolHandler.h
+++ b/netwerk/protocol/res/nsResProtocolHandler.h
@@ -67,17 +67,17 @@ public:
     NS_DECL_NSIRESPROTOCOLHANDLER
 
     nsResProtocolHandler();
     virtual ~nsResProtocolHandler();
 
     nsresult Init();
 
 #ifdef MOZ_IPC    
-    void CollectSubstitutions(nsTArray<ResourceMapping>& aResources);
+    void CollectSubstitutions(InfallibleTArray<ResourceMapping>& aResources);
 #endif
 
 private:
     nsresult Init(nsIFile *aOmniJar);
     nsresult AddSpecialDir(const char* aSpecialDir, const nsACString& aSubstitution);
     nsInterfaceHashtable<nsCStringHashKey,nsIURI> mSubstitutions;
     nsCOMPtr<nsIIOService> mIOService;
 
--- a/widget/src/xpwidgets/nsFilePickerProxy.cpp
+++ b/widget/src/xpwidgets/nsFilePickerProxy.cpp
@@ -167,17 +167,17 @@ nsFilePickerProxy::GetFiles(nsISimpleEnu
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsFilePickerProxy::Show(PRInt16* aReturn)
 {
     mozilla::dom::ContentChild *cc = mozilla::dom::ContentChild::GetSingleton();
     NS_ASSERTION(cc, "Content Protocol is NULL!");
     
-    nsTArray<nsString> filePaths;
+    InfallibleTArray<nsString> filePaths;
     
     nsresult rv;
     cc->SendShowFilePicker(mMode, mSelectedType, mTitle,
                            mDefault, mDefaultExtension,
                            mFilters, mFilterNames,
                            &filePaths, aReturn, &rv);
 
     NS_ENSURE_SUCCESS(rv, rv);
--- a/widget/src/xpwidgets/nsFilePickerProxy.h
+++ b/widget/src/xpwidgets/nsFilePickerProxy.h
@@ -85,13 +85,13 @@ private:
 
     PRInt16   mMode;
     PRInt16   mSelectedType;
     nsString  mFile;
     nsString  mTitle;
     nsString  mDefault;
     nsString  mDefaultExtension;
 
-    nsTArray<nsString> mFilters;
-    nsTArray<nsString> mFilterNames;
+    InfallibleTArray<nsString> mFilters;
+    InfallibleTArray<nsString> mFilterNames;
 };
 
 #endif // NSFILEPICKERPROXY_H