mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 933681 - Introduce an API to map from names to JSProtoKeys. r=jorendorff
This commit is contained in:
parent
03430ca901
commit
ceb4adeb25
@ -1409,6 +1409,23 @@ JS_IdentifyClassPrototype(JSContext *cx, JSObject *obj)
|
||||
return js_IdentifyClassPrototype(obj);
|
||||
}
|
||||
|
||||
extern JS_PUBLIC_API(JSProtoKey)
|
||||
JS_IdToProtoKey(JSContext *cx, JS::HandleId id)
|
||||
{
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
|
||||
if (!JSID_IS_ATOM(id))
|
||||
return JSProto_Null;
|
||||
RootedString idstr(cx, JSID_TO_STRING(id));
|
||||
const JSStdName *stdnm = LookupStdName(cx->runtime(), idstr, standard_class_names);
|
||||
if (!stdnm)
|
||||
return JSProto_Null;
|
||||
|
||||
MOZ_ASSERT(MOZ_ARRAY_LENGTH(standard_class_names) == JSProto_LIMIT + 1);
|
||||
return static_cast<JSProtoKey>(stdnm - standard_class_names);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSObject *)
|
||||
JS_GetObjectPrototype(JSContext *cx, JSObject *forObj)
|
||||
{
|
||||
|
@ -1769,6 +1769,9 @@ JS_GetClassPrototype(JSContext *cx, JSProtoKey key, JSObject **objp);
|
||||
extern JS_PUBLIC_API(JSProtoKey)
|
||||
JS_IdentifyClassPrototype(JSContext *cx, JSObject *obj);
|
||||
|
||||
extern JS_PUBLIC_API(JSProtoKey)
|
||||
JS_IdToProtoKey(JSContext *cx, JS::HandleId id);
|
||||
|
||||
/*
|
||||
* Returns the original value of |Function.prototype| from the global object in
|
||||
* which |forObj| was created.
|
||||
|
Loading…
Reference in New Issue
Block a user