mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Bug 1287677 - Add mozIntl.getDisplayNames API
This commit is contained in:
parent
cac5c5adc7
commit
5381ebe25c
9 changed files with 718 additions and 0 deletions
|
|
@ -48,6 +48,32 @@ MozIntl::AddGetCalendarInfo(JS::Handle<JS::Value> val, JSContext* cx)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
MozIntl::AddGetDisplayNames(JS::Handle<JS::Value> val, JSContext* cx)
|
||||
{
|
||||
if (!val.isObject()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> realIntlObj(cx, js::CheckedUnwrap(&val.toObject()));
|
||||
if (!realIntlObj) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
JSAutoCompartment ac(cx, realIntlObj);
|
||||
|
||||
static const JSFunctionSpec funcs[] = {
|
||||
JS_SELF_HOSTED_FN("getDisplayNames", "Intl_getDisplayNames", 2, 0),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
if (!JS_DefineFunctions(cx, realIntlObj, funcs)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(MozIntl)
|
||||
NS_DEFINE_NAMED_CID(MOZ_MOZINTL_CID);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue