Bug 884410 - Handlify JS_SetPrototype. r=terrence
authorTom Schuster <evilpies@gmail.com>
Wed, 31 Jul 2013 12:20:33 -0400
changeset 153080 a2f13bbf14572e25af14758d508fcfe8dfbd3ae9
parent 153079 f67fd341dd2ed3dac0e99fc06212e21840a5e135
child 153081 7f01c4bb30e68e2fbcad096f809e55c05c2fd635
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs884410
milestone25.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 884410 - Handlify JS_SetPrototype. r=terrence
dom/workers/WorkerScope.cpp
js/src/jsapi.cpp
js/src/jsapi.h
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -974,24 +974,24 @@ CreateDedicatedWorkerGlobalScope(JSConte
   //          -> Object
 
   JS::Rooted<JSObject*> eventTargetProto(aCx,
     EventTargetBinding_workers::GetProtoObject(aCx, global));
   if (!eventTargetProto) {
     return NULL;
   }
 
-  JSObject* scopeProto =
-    WorkerGlobalScope::InitClass(aCx, global, eventTargetProto);
+  JS::Rooted<JSObject*> scopeProto(aCx,
+    WorkerGlobalScope::InitClass(aCx, global, eventTargetProto));
   if (!scopeProto) {
     return NULL;
   }
 
-  JSObject* dedicatedScopeProto =
-    DedicatedWorkerGlobalScope::InitClass(aCx, global, scopeProto);
+  JS::Rooted<JSObject*> dedicatedScopeProto(aCx,
+    DedicatedWorkerGlobalScope::InitClass(aCx, global, scopeProto));
   if (!dedicatedScopeProto) {
     return NULL;
   }
 
   if (!JS_SetPrototype(aCx, global, dedicatedScopeProto)) {
     return NULL;
   }
 
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -2818,20 +2818,18 @@ JS_GetInstancePrivate(JSContext *cx, JSO
 
 JS_PUBLIC_API(JSBool)
 JS_GetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> protop)
 {
     return JSObject::getProto(cx, obj, protop);
 }
 
 JS_PUBLIC_API(JSBool)
-JS_SetPrototype(JSContext *cx, JSObject *objArg, JSObject *protoArg)
-{
-    RootedObject obj(cx, objArg);
-    RootedObject proto(cx, protoArg);
+JS_SetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<JSObject*> proto)
+{
     AssertHeapIsIdle(cx);
     CHECK_REQUEST(cx);
     assertSameCompartment(cx, obj, proto);
 
     return SetClassAndProto(cx, obj, obj->getClass(), proto, JS_FALSE);
 }
 
 JS_PUBLIC_API(JSObject *)
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -3179,17 +3179,17 @@ JS_SetPrivate(JSObject *obj, void *data)
 extern JS_PUBLIC_API(void *)
 JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,
                       jsval *argv);
 
 extern JS_PUBLIC_API(JSBool)
 JS_GetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> protop);
 
 extern JS_PUBLIC_API(JSBool)
-JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto);
+JS_SetPrototype(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle<JSObject*> proto);
 
 extern JS_PUBLIC_API(JSObject *)
 JS_GetParent(JSObject *obj);
 
 extern JS_PUBLIC_API(JSBool)
 JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent);
 
 extern JS_PUBLIC_API(JSObject *)