Bug 997285 part 1. Add JS_GetErrorPrototype to JSAPI. r=jorendorff

This commit is contained in:
Boris Zbarsky 2014-05-05 16:01:57 -04:00
parent 7507eb3dea
commit 89c2ab2765
2 changed files with 15 additions and 0 deletions

View File

@ -1384,6 +1384,14 @@ JS_GetArrayPrototype(JSContext *cx, HandleObject forObj)
return GlobalObject::getOrCreateArrayPrototype(cx, global);
}
JS_PUBLIC_API(JSObject *)
JS_GetErrorPrototype(JSContext *cx)
{
CHECK_REQUEST(cx);
Rooted<GlobalObject*> global(cx, cx->global());
return GlobalObject::getOrCreateCustomErrorPrototype(cx, global, JSEXN_ERR);
}
JS_PUBLIC_API(JSObject *)
JS_GetGlobalForObject(JSContext *cx, JSObject *obj)
{

View File

@ -1826,6 +1826,13 @@ JS_GetObjectPrototype(JSContext *cx, JS::HandleObject forObj);
extern JS_PUBLIC_API(JSObject *)
JS_GetArrayPrototype(JSContext *cx, JS::HandleObject forObj);
/*
* Returns the original value of |Error.prototype| from the global
* object of the current compartment of cx.
*/
extern JS_PUBLIC_API(JSObject *)
JS_GetErrorPrototype(JSContext *cx);
extern JS_PUBLIC_API(JSObject *)
JS_GetGlobalForObject(JSContext *cx, JSObject *obj);