Bug 959787 - Handlify several JSAPI interfaces that can GC, Part 7; r=sfink

This commit is contained in:
Terrence Cole 2014-01-21 17:03:20 -08:00
parent 91ca6a1d69
commit 07cf57140e
6 changed files with 13 additions and 16 deletions

View File

@ -1318,10 +1318,8 @@ using namespace js;
using namespace js::ctypes;
JS_PUBLIC_API(bool)
JS_InitCTypesClass(JSContext* cx, JSObject *globalArg)
JS_InitCTypesClass(JSContext* cx, HandleObject global)
{
RootedObject global(cx, globalArg);
// attach ctypes property to global object
RootedObject ctypes(cx, JS_NewObject(cx, &sCTypesGlobalClass, NullPtr(), NullPtr()));
if (!ctypes)

View File

@ -1383,7 +1383,7 @@ JS_IdentifyClassPrototype(JSContext *cx, JSObject *obj)
}
extern JS_PUBLIC_API(JSProtoKey)
JS_IdToProtoKey(JSContext *cx, JS::HandleId id)
JS_IdToProtoKey(JSContext *cx, HandleId id)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
@ -1400,7 +1400,7 @@ JS_IdToProtoKey(JSContext *cx, JS::HandleId id)
}
JS_PUBLIC_API(JSObject *)
JS_GetObjectPrototype(JSContext *cx, JSObject *forObj)
JS_GetObjectPrototype(JSContext *cx, HandleObject forObj)
{
CHECK_REQUEST(cx);
assertSameCompartment(cx, forObj);
@ -1408,7 +1408,7 @@ JS_GetObjectPrototype(JSContext *cx, JSObject *forObj)
}
JS_PUBLIC_API(JSObject *)
JS_GetFunctionPrototype(JSContext *cx, JSObject *forObj)
JS_GetFunctionPrototype(JSContext *cx, HandleObject forObj)
{
CHECK_REQUEST(cx);
assertSameCompartment(cx, forObj);
@ -1416,7 +1416,7 @@ JS_GetFunctionPrototype(JSContext *cx, JSObject *forObj)
}
JS_PUBLIC_API(JSObject *)
JS_GetArrayPrototype(JSContext *cx, JSObject *forObj)
JS_GetArrayPrototype(JSContext *cx, HandleObject forObj)
{
CHECK_REQUEST(cx);
assertSameCompartment(cx, forObj);

View File

@ -1792,21 +1792,21 @@ JS_IdToProtoKey(JSContext *cx, JS::HandleId id);
* which |forObj| was created.
*/
extern JS_PUBLIC_API(JSObject *)
JS_GetFunctionPrototype(JSContext *cx, JSObject *forObj);
JS_GetFunctionPrototype(JSContext *cx, JS::HandleObject forObj);
/*
* Returns the original value of |Object.prototype| from the global object in
* which |forObj| was created.
*/
extern JS_PUBLIC_API(JSObject *)
JS_GetObjectPrototype(JSContext *cx, JSObject *forObj);
JS_GetObjectPrototype(JSContext *cx, JS::HandleObject forObj);
/*
* Returns the original value of |Array.prototype| from the global object in
* which |forObj| was created.
*/
extern JS_PUBLIC_API(JSObject *)
JS_GetArrayPrototype(JSContext *cx, JSObject *forObj);
JS_GetArrayPrototype(JSContext *cx, JS::HandleObject forObj);
extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForObject(JSContext *cx, JSObject *obj);
@ -1844,7 +1844,7 @@ JS_GetScriptedGlobal(JSContext *cx);
* Initialize the 'Reflect' object on a global object.
*/
extern JS_PUBLIC_API(JSObject *)
JS_InitReflect(JSContext *cx, JSObject *global);
JS_InitReflect(JSContext *cx, JS::HandleObject global);
#ifdef JS_HAS_CTYPES
/*
@ -1852,7 +1852,7 @@ JS_InitReflect(JSContext *cx, JSObject *global);
* object will be sealed.
*/
extern JS_PUBLIC_API(bool)
JS_InitCTypesClass(JSContext *cx, JSObject *global);
JS_InitCTypesClass(JSContext *cx, JS::HandleObject global);
/*
* Convert a unicode string 'source' of length 'slen' to the platform native

View File

@ -3301,14 +3301,13 @@ reflect_parse(JSContext *cx, uint32_t argc, jsval *vp)
}
JS_PUBLIC_API(JSObject *)
JS_InitReflect(JSContext *cx, JSObject *objArg)
JS_InitReflect(JSContext *cx, HandleObject obj)
{
static const JSFunctionSpec static_methods[] = {
JS_FN("parse", reflect_parse, 1, 0),
JS_FS_END
};
RootedObject obj(cx, objArg);
RootedObject proto(cx, obj->as<GlobalObject>().getOrCreateObjectPrototype(cx));
if (!proto)
return nullptr;

View File

@ -1571,8 +1571,8 @@ XPCWrappedNative::InitTearOffJSObject(XPCWrappedNativeTearOff* to)
{
AutoJSContext cx;
RootedObject proto(cx, JS_GetObjectPrototype(cx, mFlatJSObject));
RootedObject parent(cx, mFlatJSObject);
RootedObject proto(cx, JS_GetObjectPrototype(cx, parent));
JSObject* obj = JS_NewObject(cx, Jsvalify(&XPC_WN_Tearoff_JSClass),
proto, parent);
if (!obj)

View File

@ -44,7 +44,7 @@ Module::Call(nsIXPConnectWrappedNative* wrapper,
const JS::CallArgs& args,
bool* _retval)
{
JSObject* global = JS::CurrentGlobalOrNull(cx);
JS::Rooted<JSObject*> global(cx, JS::CurrentGlobalOrNull(cx));
if (!global)
return NS_ERROR_NOT_AVAILABLE;