Bug 1225392 part 1. Expose JSAPI for getting %IteratorPrototype%. r=efaust

This commit is contained in:
Boris Zbarsky 2015-11-18 18:26:07 -05:00
parent ebd689a328
commit c0a3244687
2 changed files with 15 additions and 0 deletions

View File

@ -1220,6 +1220,14 @@ JS_GetErrorPrototype(JSContext* cx)
return GlobalObject::getOrCreateCustomErrorPrototype(cx, global, JSEXN_ERR);
}
JS_PUBLIC_API(JSObject*)
JS_GetIteratorPrototype(JSContext* cx)
{
CHECK_REQUEST(cx);
Rooted<GlobalObject*> global(cx, cx->global());
return GlobalObject::getOrCreateIteratorPrototype(cx, global);
}
JS_PUBLIC_API(JSObject*)
JS_GetGlobalForObject(JSContext* cx, JSObject* obj)
{

View File

@ -1503,6 +1503,13 @@ JS_GetArrayPrototype(JSContext* cx, JS::HandleObject forObj);
extern JS_PUBLIC_API(JSObject*)
JS_GetErrorPrototype(JSContext* cx);
/**
* Returns the %IteratorPrototype% object that all built-in iterator prototype
* chains go through for the global object of the current compartment of cx.
*/
extern JS_PUBLIC_API(JSObject*)
JS_GetIteratorPrototype(JSContext* cx);
extern JS_PUBLIC_API(JSObject*)
JS_GetGlobalForObject(JSContext* cx, JSObject* obj);