Bug 867341 - Replace AutoObjectRooter with RootedObject. r=smaug
authorSteve Fink <sfink@mozilla.com>
Fri, 26 Apr 2013 21:08:16 -0700
changeset 130702 0875726579b21a321215d363ce44b8437fa96192
parent 130701 f9a5c9ba7d7adf6a282615c49a3571450c54b18e
child 130703 e728bef882df351c8f5e7b2705c98bb4d558a2de
push id1579
push userphilringnalda@gmail.com
push dateSat, 04 May 2013 04:38:04 +0000
treeherderfx-team@a56432a42a41 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs867341
milestone23.0a1
Bug 867341 - Replace AutoObjectRooter with RootedObject. r=smaug
content/media/webspeech/synth/nsSpeechTask.cpp
--- a/content/media/webspeech/synth/nsSpeechTask.cpp
+++ b/content/media/webspeech/synth/nsSpeechTask.cpp
@@ -155,40 +155,32 @@ nsSpeechTask::SendAudio(const JS::Value&
   NS_ENSURE_TRUE(mChannels, NS_ERROR_FAILURE);
 
   if (mIndirectAudio) {
     NS_WARNING("Can't call SendAudio from an indirect audio speech service.");
     return NS_ERROR_FAILURE;
   }
 
   JSAutoRequest ar(aCx);
-  JS::AutoObjectRooter tvr(aCx);
-
-  JSObject* darray = &aData.toObject();
+  JS::Rooted<JSObject*> darray(aCx, &aData.toObject());
   JSAutoCompartment ac(aCx, darray);
 
-  JSObject* tsrc = NULL;
+  JS::Rooted<JSObject*> tsrc(aCx, NULL);
 
   // Allow either Int16Array or plain JS Array
   if (JS_IsInt16Array(darray)) {
     tsrc = darray;
   } else if (JS_IsArrayObject(aCx, darray)) {
-    JSObject* nobj = JS_NewInt16ArrayFromArray(aCx, darray);
+    tsrc = JS_NewInt16ArrayFromArray(aCx, darray);
+  }
 
-    if (!nobj) {
-      return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
-    }
-
-    tsrc = nobj;
-  } else {
+  if (!tsrc) {
     return NS_ERROR_DOM_TYPE_MISMATCH_ERR;
   }
 
-  tvr.setObject(tsrc);
-
   uint32_t dataLength = JS_GetTypedArrayLength(tsrc);
 
   if (dataLength == 0) {
     // XXX: We should end the track too, an undetermined bug does not allow that.
     mStream->Finish();
     return NS_OK;
   }