Bug 872043. Add an API for getting the canonical Array.prototype for a global. r=waldo

This commit is contained in:
Boris Zbarsky 2013-05-14 14:17:09 -04:00
parent 365dc4222a
commit 90921b63a0
2 changed files with 15 additions and 0 deletions

View File

@ -2242,6 +2242,14 @@ JS_GetFunctionPrototype(JSContext *cx, JSObject *forObj)
return forObj->global().getOrCreateFunctionPrototype(cx);
}
JS_PUBLIC_API(JSObject *)
JS_GetArrayPrototype(JSContext *cx, JSObject *forObj)
{
CHECK_REQUEST(cx);
assertSameCompartment(cx, forObj);
return forObj->global().getOrCreateArrayPrototype(cx);
}
JS_PUBLIC_API(JSObject *)
JS_GetGlobalForObject(JSContext *cx, JSObject *obj)
{

View File

@ -2159,6 +2159,13 @@ JS_GetFunctionPrototype(JSContext *cx, JSObject *forObj);
extern JS_PUBLIC_API(JSObject *)
JS_GetObjectPrototype(JSContext *cx, JSObject *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);
extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForObject(JSContext *cx, JSObject *obj);