diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 6e7689e901f5..5571fc05e37e 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -4924,6 +4924,12 @@ JS_GetFunctionId(JSFunction *fun) return fun->atom(); } +JS_PUBLIC_API(JSString *) +JS_GetFunctionDisplayId(JSFunction *fun) +{ + return fun->displayAtom(); +} + JS_PUBLIC_API(unsigned) JS_GetFunctionFlags(JSFunction *fun) { diff --git a/js/src/jsapi.h b/js/src/jsapi.h index da7a6689a801..c8ab0f09c61b 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4974,6 +4974,16 @@ JS_GetFunctionObject(JSFunction *fun); extern JS_PUBLIC_API(JSString *) JS_GetFunctionId(JSFunction *fun); +/* + * Return a function's display name. This is the defined name if one was given + * where the function was defined, or it could be an inferred name by the JS + * engine in the case that the function was defined to be anonymous. This can + * still return NULL if a useful display name could not be inferred. The same + * restrictions on rooting as those in JS_GetFunctionId apply. + */ +extern JS_PUBLIC_API(JSString *) +JS_GetFunctionDisplayId(JSFunction *fun); + /* * Return JSFUN_* flags for fun. */