diff --git a/dom/src/threads/nsDOMWorkerTimeout.cpp b/dom/src/threads/nsDOMWorkerTimeout.cpp index bde3ac3d64c..05797396175 100644 --- a/dom/src/threads/nsDOMWorkerTimeout.cpp +++ b/dom/src/threads/nsDOMWorkerTimeout.cpp @@ -126,7 +126,10 @@ nsDOMWorkerTimeout::FunctionCallback::Run(nsDOMWorkerTimeout* aTimeout, JSObject* global = JS_GetGlobalObject(aCx); NS_ENSURE_TRUE(global, NS_ERROR_FAILURE); - nsTArray argv(mCallbackArgsLength); + nsTArray argv; + PRBool success = argv.SetCapacity(mCallbackArgsLength); + NS_ENSURE_TRUE(success, NS_ERROR_OUT_OF_MEMORY); + for (PRUint32 index = 0; index < mCallbackArgsLength; index++) { argv.AppendElement(mCallbackArgs[index]); }