Bug 867341 - Replace AutoObjectRooter with RootedObject. r=smaug
authorSteve Fink <sfink@mozilla.com>
Fri, 26 Apr 2013 21:08:16 -0700
changeset 130681 0875726579b21a321215d363ce44b8437fa96192
parent 130680 f9a5c9ba7d7adf6a282615c49a3571450c54b18e
child 130682 e728bef882df351c8f5e7b2705c98bb4d558a2de
push id27488
push usersfink@mozilla.com
push dateThu, 02 May 2013 23:23:57 +0000
treeherdermozilla-inbound@e2dc6cdc1c02 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs867341
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 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;
   }