mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 22:38:41 +09:00
Issue #2259 - Update Intl.* Object-ness to ECMA-402, 4th edition
- turn each Intl object into a NativeObject subclass - create them as PlainObject - ensure correct type is passed in self-hosted code - implement legacy constructor semantics for DateTime&NumberFormat - store internals on object slot instead of JS WeakMap Based-on: m-c 1328386, 1332604
This commit is contained in:
parent
adffcb127a
commit
30157344fe
31 changed files with 633 additions and 663 deletions
|
|
@ -1905,6 +1905,23 @@ intrinsic_RuntimeDefaultLocale(JSContext* cx, unsigned argc, Value* vp)
|
|||
return true;
|
||||
}
|
||||
|
||||
using GetOrCreateIntlConstructor = JSFunction* (*)(JSContext*, Handle<GlobalObject*>);
|
||||
|
||||
template <GetOrCreateIntlConstructor getOrCreateIntlConstructor>
|
||||
static bool
|
||||
intrinsic_GetBuiltinIntlConstructor(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
CallArgs args = CallArgsFromVp(argc, vp);
|
||||
MOZ_ASSERT(args.length() == 0);
|
||||
|
||||
JSFunction* constructor = getOrCreateIntlConstructor(cx, cx->global());
|
||||
if (!constructor)
|
||||
return false;
|
||||
|
||||
args.rval().setObject(*constructor);
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
intrinsic_ConstructFunction(JSContext* cx, unsigned argc, Value* vp)
|
||||
{
|
||||
|
|
@ -2469,6 +2486,28 @@ static const JSFunctionSpec intrinsic_functions[] = {
|
|||
JS_FN("intl_RelativeTimeFormat_availableLocales", intl_RelativeTimeFormat_availableLocales, 0,0),
|
||||
JS_FN("intl_FormatRelativeTime", intl_FormatRelativeTime, 3,0),
|
||||
|
||||
JS_INLINABLE_FN("IsCollator",
|
||||
intrinsic_IsInstanceOfBuiltin<CollatorObject>, 1,0,
|
||||
IntlIsCollator),
|
||||
JS_INLINABLE_FN("IsDateTimeFormat",
|
||||
intrinsic_IsInstanceOfBuiltin<DateTimeFormatObject>, 1,0,
|
||||
IntlIsDateTimeFormat),
|
||||
JS_INLINABLE_FN("IsNumberFormat",
|
||||
intrinsic_IsInstanceOfBuiltin<NumberFormatObject>, 1,0,
|
||||
IntlIsNumberFormat),
|
||||
JS_INLINABLE_FN("IsPluralRules",
|
||||
intrinsic_IsInstanceOfBuiltin<PluralRulesObject>, 1,0,
|
||||
IntlIsPluralRules),
|
||||
JS_INLINABLE_FN("IsRelativeTimeFormat",
|
||||
intrinsic_IsInstanceOfBuiltin<RelativeTimeFormatObject>, 1,0,
|
||||
IntlIsRelativeTimeFormat),
|
||||
JS_FN("GetDateTimeFormatConstructor",
|
||||
intrinsic_GetBuiltinIntlConstructor<GlobalObject::getOrCreateDateTimeFormatConstructor>,
|
||||
0,0),
|
||||
JS_FN("GetNumberFormatConstructor",
|
||||
intrinsic_GetBuiltinIntlConstructor<GlobalObject::getOrCreateNumberFormatConstructor>,
|
||||
0,0),
|
||||
|
||||
JS_INLINABLE_FN("IsRegExpObject",
|
||||
intrinsic_IsInstanceOfBuiltin<RegExpObject>, 1,0,
|
||||
IsRegExpObject),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue