diff options
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/builtin/Array.js | 8 | ||||
-rw-r--r-- | js/src/builtin/Intl.cpp | 602 | ||||
-rw-r--r-- | js/src/builtin/Intl.h | 4 | ||||
-rw-r--r-- | js/src/builtin/String.js | 6 | ||||
-rw-r--r-- | js/src/builtin/TestingFunctions.cpp | 4 | ||||
-rw-r--r-- | js/src/builtin/TypedArray.js | 8 | ||||
-rw-r--r-- | js/src/gdb/moz.build | 2 | ||||
-rw-r--r-- | js/src/jsapi-tests/moz.build | 2 | ||||
-rw-r--r-- | js/src/jsapi.h | 2 | ||||
-rwxr-xr-x | js/src/jsdate.cpp | 77 | ||||
-rw-r--r-- | js/src/jsnum.cpp | 206 | ||||
-rw-r--r-- | js/src/jsnum.h | 8 | ||||
-rw-r--r-- | js/src/jsprototypes.h | 4 | ||||
-rw-r--r-- | js/src/jsstr.cpp | 43 | ||||
-rw-r--r-- | js/src/jsstr.h | 5 | ||||
-rw-r--r-- | js/src/moz.build | 23 | ||||
-rw-r--r-- | js/src/shell/js.cpp | 4 | ||||
-rw-r--r-- | js/src/shell/moz.build | 2 | ||||
-rw-r--r-- | js/src/vm/DateTime.cpp | 6 | ||||
-rw-r--r-- | js/src/vm/GlobalObject.cpp | 4 | ||||
-rw-r--r-- | js/src/vm/Initialization.cpp | 10 | ||||
-rw-r--r-- | js/src/vm/Runtime.cpp | 12 | ||||
-rw-r--r-- | js/src/vm/Runtime.h | 7 | ||||
-rw-r--r-- | js/src/vm/SelfHosting.cpp | 4 |
24 files changed, 22 insertions, 1031 deletions
diff --git a/js/src/builtin/Array.js b/js/src/builtin/Array.js index 45f90a7b8..360dd2af1 100644 --- a/js/src/builtin/Array.js +++ b/js/src/builtin/Array.js @@ -900,11 +900,7 @@ function ArrayToLocaleString(locales, options) { if (firstElement === undefined || firstElement === null) { R = ""; } else { -#if EXPOSE_INTL_API R = ToString(callContentFunction(firstElement.toLocaleString, firstElement, locales, options)); -#else - R = ToString(callContentFunction(firstElement.toLocaleString, firstElement)); -#endif } // Step 3 (reordered). @@ -919,11 +915,7 @@ function ArrayToLocaleString(locales, options) { // Steps 9.a, 9.c-e. R += separator; if (!(nextElement === undefined || nextElement === null)) { -#if EXPOSE_INTL_API R += ToString(callContentFunction(nextElement.toLocaleString, nextElement, locales, options)); -#else - R += ToString(callContentFunction(nextElement.toLocaleString, nextElement)); -#endif } } diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp index cd808cb10..71f7b58d4 100644 --- a/js/src/builtin/Intl.cpp +++ b/js/src/builtin/Intl.cpp @@ -23,7 +23,6 @@ #include "jsobj.h" #include "builtin/IntlTimeZoneData.h" -#if ENABLE_INTL_API #include "unicode/ucal.h" #include "unicode/ucol.h" #include "unicode/udat.h" @@ -32,7 +31,6 @@ #include "unicode/unum.h" #include "unicode/unumsys.h" #include "unicode/ustring.h" -#endif #include "vm/DateTime.h" #include "vm/GlobalObject.h" #include "vm/Interpreter.h" @@ -60,603 +58,6 @@ using mozilla::PodCopy; * http://userguide.icu-project.org/design#TOC-Error-Handling */ - -/******************** ICU stubs ********************/ - -#if !ENABLE_INTL_API - -/* - * When the Internationalization API isn't enabled, we also shouldn't link - * against ICU. However, we still want to compile this code in order to prevent - * bit rot. The following stub implementations for ICU functions make this - * possible. The functions using them should never be called, so they assert - * and return error codes. Signatures adapted from ICU header files locid.h, - * numsys.h, ucal.h, ucol.h, udat.h, udatpg.h, uenum.h, unum.h; see the ICU - * directory for license. - */ - -typedef bool UBool; -typedef char16_t UChar; -typedef double UDate; - -enum UErrorCode { - U_ZERO_ERROR, - U_BUFFER_OVERFLOW_ERROR, -}; - -static inline UBool -U_FAILURE(UErrorCode code) -{ - MOZ_CRASH("U_FAILURE: Intl API disabled"); -} - -inline const UChar* -Char16ToUChar(const char16_t* chars) -{ - MOZ_CRASH("Char16ToUChar: Intl API disabled"); -} - -inline UChar* -Char16ToUChar(char16_t* chars) -{ - MOZ_CRASH("Char16ToUChar: Intl API disabled"); -} - -inline char16_t* -UCharToChar16(UChar* chars) -{ - MOZ_CRASH("UCharToChar16: Intl API disabled"); -} - -inline const char16_t* -UCharToChar16(const UChar* chars) -{ - MOZ_CRASH("UCharToChar16: Intl API disabled"); -} - -static int32_t -u_strlen(const UChar* s) -{ - MOZ_CRASH("u_strlen: Intl API disabled"); -} - -struct UEnumeration; - -static int32_t -uenum_count(UEnumeration* en, UErrorCode* status) -{ - MOZ_CRASH("uenum_count: Intl API disabled"); -} - -static const char* -uenum_next(UEnumeration* en, int32_t* resultLength, UErrorCode* status) -{ - MOZ_CRASH("uenum_next: Intl API disabled"); -} - -static void -uenum_close(UEnumeration* en) -{ - MOZ_CRASH("uenum_close: Intl API disabled"); -} - -struct UCollator; - -enum UColAttribute { - UCOL_ALTERNATE_HANDLING, - UCOL_CASE_FIRST, - UCOL_CASE_LEVEL, - UCOL_NORMALIZATION_MODE, - UCOL_STRENGTH, - UCOL_NUMERIC_COLLATION, -}; - -enum UColAttributeValue { - UCOL_DEFAULT = -1, - UCOL_PRIMARY = 0, - UCOL_SECONDARY = 1, - UCOL_TERTIARY = 2, - UCOL_OFF = 16, - UCOL_ON = 17, - UCOL_SHIFTED = 20, - UCOL_LOWER_FIRST = 24, - UCOL_UPPER_FIRST = 25, -}; - -enum UCollationResult { - UCOL_EQUAL = 0, - UCOL_GREATER = 1, - UCOL_LESS = -1 -}; - -static int32_t -ucol_countAvailable() -{ - MOZ_CRASH("ucol_countAvailable: Intl API disabled"); -} - -static const char* -ucol_getAvailable(int32_t localeIndex) -{ - MOZ_CRASH("ucol_getAvailable: Intl API disabled"); -} - -static UCollator* -ucol_open(const char* loc, UErrorCode* status) -{ - MOZ_CRASH("ucol_open: Intl API disabled"); -} - -static void -ucol_setAttribute(UCollator* coll, UColAttribute attr, UColAttributeValue value, UErrorCode* status) -{ - MOZ_CRASH("ucol_setAttribute: Intl API disabled"); -} - -static UCollationResult -ucol_strcoll(const UCollator* coll, const UChar* source, int32_t sourceLength, - const UChar* target, int32_t targetLength) -{ - MOZ_CRASH("ucol_strcoll: Intl API disabled"); -} - -static void -ucol_close(UCollator* coll) -{ - MOZ_CRASH("ucol_close: Intl API disabled"); -} - -static UEnumeration* -ucol_getKeywordValuesForLocale(const char* key, const char* locale, UBool commonlyUsed, - UErrorCode* status) -{ - MOZ_CRASH("ucol_getKeywordValuesForLocale: Intl API disabled"); -} - -struct UParseError; -struct UFieldPosition; -struct UFieldPositionIterator; -typedef void* UNumberFormat; - -enum UNumberFormatStyle { - UNUM_DECIMAL = 1, - UNUM_CURRENCY, - UNUM_PERCENT, - UNUM_CURRENCY_ISO, - UNUM_CURRENCY_PLURAL, -}; - -enum UNumberFormatRoundingMode { - UNUM_ROUND_HALFUP, -}; - -enum UNumberFormatAttribute { - UNUM_GROUPING_USED, - UNUM_MIN_INTEGER_DIGITS, - UNUM_MAX_FRACTION_DIGITS, - UNUM_MIN_FRACTION_DIGITS, - UNUM_ROUNDING_MODE, - UNUM_SIGNIFICANT_DIGITS_USED, - UNUM_MIN_SIGNIFICANT_DIGITS, - UNUM_MAX_SIGNIFICANT_DIGITS, -}; - -enum UNumberFormatTextAttribute { - UNUM_CURRENCY_CODE, -}; - -static int32_t -unum_countAvailable() -{ - MOZ_CRASH("unum_countAvailable: Intl API disabled"); -} - -static const char* -unum_getAvailable(int32_t localeIndex) -{ - MOZ_CRASH("unum_getAvailable: Intl API disabled"); -} - -static UNumberFormat* -unum_open(UNumberFormatStyle style, const UChar* pattern, int32_t patternLength, - const char* locale, UParseError* parseErr, UErrorCode* status) -{ - MOZ_CRASH("unum_open: Intl API disabled"); -} - -static void -unum_setAttribute(UNumberFormat* fmt, UNumberFormatAttribute attr, int32_t newValue) -{ - MOZ_CRASH("unum_setAttribute: Intl API disabled"); -} - -static int32_t -unum_formatDouble(const UNumberFormat* fmt, double number, UChar* result, - int32_t resultLength, UFieldPosition* pos, UErrorCode* status) -{ - MOZ_CRASH("unum_formatDouble: Intl API disabled"); -} - -static void -unum_close(UNumberFormat* fmt) -{ - MOZ_CRASH("unum_close: Intl API disabled"); -} - -static void -unum_setTextAttribute(UNumberFormat* fmt, UNumberFormatTextAttribute tag, const UChar* newValue, - int32_t newValueLength, UErrorCode* status) -{ - MOZ_CRASH("unum_setTextAttribute: Intl API disabled"); -} - -typedef void* UNumberingSystem; - -static UNumberingSystem* -unumsys_open(const char* locale, UErrorCode* status) -{ - MOZ_CRASH("unumsys_open: Intl API disabled"); -} - -static const char* -unumsys_getName(const UNumberingSystem* unumsys) -{ - MOZ_CRASH("unumsys_getName: Intl API disabled"); -} - -static void -unumsys_close(UNumberingSystem* unumsys) -{ - MOZ_CRASH("unumsys_close: Intl API disabled"); -} - -typedef void* UCalendar; - -enum UCalendarType { - UCAL_TRADITIONAL, - UCAL_DEFAULT = UCAL_TRADITIONAL, - UCAL_GREGORIAN -}; - -enum UCalendarAttribute { - UCAL_FIRST_DAY_OF_WEEK, - UCAL_MINIMAL_DAYS_IN_FIRST_WEEK -}; - -enum UCalendarDaysOfWeek { - UCAL_SUNDAY, - UCAL_MONDAY, - UCAL_TUESDAY, - UCAL_WEDNESDAY, - UCAL_THURSDAY, - UCAL_FRIDAY, - UCAL_SATURDAY -}; - -enum UCalendarWeekdayType { - UCAL_WEEKDAY, - UCAL_WEEKEND, - UCAL_WEEKEND_ONSET, - UCAL_WEEKEND_CEASE -}; - -enum UCalendarDateFields { - UCAL_ERA, - UCAL_YEAR, - UCAL_MONTH, - UCAL_WEEK_OF_YEAR, - UCAL_WEEK_OF_MONTH, - UCAL_DATE, - UCAL_DAY_OF_YEAR, - UCAL_DAY_OF_WEEK, - UCAL_DAY_OF_WEEK_IN_MONTH, - UCAL_AM_PM, - UCAL_HOUR, - UCAL_HOUR_OF_DAY, - UCAL_MINUTE, - UCAL_SECOND, - UCAL_MILLISECOND, - UCAL_ZONE_OFFSET, - UCAL_DST_OFFSET, - UCAL_YEAR_WOY, - UCAL_DOW_LOCAL, - UCAL_EXTENDED_YEAR, - UCAL_JULIAN_DAY, - UCAL_MILLISECONDS_IN_DAY, - UCAL_IS_LEAP_MONTH, - UCAL_FIELD_COUNT, - UCAL_DAY_OF_MONTH = UCAL_DATE -}; - -enum UCalendarMonths { - UCAL_JANUARY, - UCAL_FEBRUARY, - UCAL_MARCH, - UCAL_APRIL, - UCAL_MAY, - UCAL_JUNE, - UCAL_JULY, - UCAL_AUGUST, - UCAL_SEPTEMBER, - UCAL_OCTOBER, - UCAL_NOVEMBER, - UCAL_DECEMBER, - UCAL_UNDECIMBER -}; - -enum UCalendarAMPMs { - UCAL_AM, - UCAL_PM -}; - -static UCalendar* -ucal_open(const UChar* zoneID, int32_t len, const char* locale, - UCalendarType type, UErrorCode* status) -{ - MOZ_CRASH("ucal_open: Intl API disabled"); -} - -static const char* -ucal_getType(const UCalendar* cal, UErrorCode* status) -{ - MOZ_CRASH("ucal_getType: Intl API disabled"); -} - -static UEnumeration* -ucal_getKeywordValuesForLocale(const char* key, const char* locale, - UBool commonlyUsed, UErrorCode* status) -{ - MOZ_CRASH("ucal_getKeywordValuesForLocale: Intl API disabled"); -} - -static void -ucal_close(UCalendar* cal) -{ - MOZ_CRASH("ucal_close: Intl API disabled"); -} - -static UCalendarWeekdayType -ucal_getDayOfWeekType(const UCalendar *cal, UCalendarDaysOfWeek dayOfWeek, UErrorCode* status) -{ - MOZ_CRASH("ucal_getDayOfWeekType: Intl API disabled"); -} - -static int32_t -ucal_getAttribute(const UCalendar* cal, - UCalendarAttribute attr) -{ - MOZ_CRASH("ucal_getAttribute: Intl API disabled"); -} - -static int32_t -ucal_get(const UCalendar *cal, UCalendarDateFields field, UErrorCode *status) -{ - MOZ_CRASH("ucal_get: Intl API disabled"); -} - -static UEnumeration* -ucal_openTimeZones(UErrorCode* status) -{ - MOZ_CRASH("ucal_openTimeZones: Intl API disabled"); -} - -static int32_t -ucal_getCanonicalTimeZoneID(const UChar* id, int32_t len, UChar* result, int32_t resultCapacity, - UBool* isSystemID, UErrorCode* status) -{ - MOZ_CRASH("ucal_getCanonicalTimeZoneID: Intl API disabled"); -} - -static int32_t -ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* status) -{ - MOZ_CRASH("ucal_getDefaultTimeZone: Intl API disabled"); -} - -enum UDateTimePatternField { - UDATPG_YEAR_FIELD, - UDATPG_MONTH_FIELD, - UDATPG_WEEK_OF_YEAR_FIELD, - UDATPG_DAY_FIELD, -}; - -typedef void* UDateTimePatternGenerator; - -static UDateTimePatternGenerator* -udatpg_open(const char* locale, UErrorCode* pErrorCode) -{ - MOZ_CRASH("udatpg_open: Intl API disabled"); -} - -static int32_t -udatpg_getBestPattern(UDateTimePatternGenerator* dtpg, const UChar* skeleton, - int32_t length, UChar* bestPattern, int32_t capacity, - UErrorCode* pErrorCode) -{ - MOZ_CRASH("udatpg_getBestPattern: Intl API disabled"); -} - -static const UChar * -udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg, - UDateTimePatternField field, - int32_t *pLength) -{ - MOZ_CRASH("udatpg_getAppendItemName: Intl API disabled"); -} - -static void -udatpg_close(UDateTimePatternGenerator* dtpg) -{ - MOZ_CRASH("udatpg_close: Intl API disabled"); -} - -typedef void* UCalendar; -typedef void* UDateFormat; - -enum UDateFormatField { - UDAT_ERA_FIELD = 0, - UDAT_YEAR_FIELD = 1, - UDAT_MONTH_FIELD = 2, - UDAT_DATE_FIELD = 3, - UDAT_HOUR_OF_DAY1_FIELD = 4, - UDAT_HOUR_OF_DAY0_FIELD = 5, - UDAT_MINUTE_FIELD = 6, - UDAT_SECOND_FIELD = 7, - UDAT_FRACTIONAL_SECOND_FIELD = 8, - UDAT_DAY_OF_WEEK_FIELD = 9, - UDAT_DAY_OF_YEAR_FIELD = 10, - UDAT_DAY_OF_WEEK_IN_MONTH_FIELD = 11, - UDAT_WEEK_OF_YEAR_FIELD = 12, - UDAT_WEEK_OF_MONTH_FIELD = 13, - UDAT_AM_PM_FIELD = 14, - UDAT_HOUR1_FIELD = 15, - UDAT_HOUR0_FIELD = 16, - UDAT_TIMEZONE_FIELD = 17, - UDAT_YEAR_WOY_FIELD = 18, - UDAT_DOW_LOCAL_FIELD = 19, - UDAT_EXTENDED_YEAR_FIELD = 20, - UDAT_JULIAN_DAY_FIELD = 21, - UDAT_MILLISECONDS_IN_DAY_FIELD = 22, - UDAT_TIMEZONE_RFC_FIELD = 23, - UDAT_TIMEZONE_GENERIC_FIELD = 24, - UDAT_STANDALONE_DAY_FIELD = 25, - UDAT_STANDALONE_MONTH_FIELD = 26, - UDAT_QUARTER_FIELD = 27, - UDAT_STANDALONE_QUARTER_FIELD = 28, - UDAT_TIMEZONE_SPECIAL_FIELD = 29, - UDAT_YEAR_NAME_FIELD = 30, - UDAT_TIMEZONE_LOCALIZED_GMT_OFFSET_FIELD = 31, - UDAT_TIMEZONE_ISO_FIELD = 32, - UDAT_TIMEZONE_ISO_LOCAL_FIELD = 33, - UDAT_RELATED_YEAR_FIELD = 34, - UDAT_AM_PM_MIDNIGHT_NOON_FIELD = 35, - UDAT_FLEXIBLE_DAY_PERIOD_FIELD = 36, - UDAT_TIME_SEPARATOR_FIELD = 37, - UDAT_FIELD_COUNT = 38 -}; - -enum UDateFormatStyle { - UDAT_FULL, - UDAT_LONG, - UDAT_MEDIUM, - UDAT_SHORT, - UDAT_DEFAULT = UDAT_MEDIUM, - UDAT_PATTERN = -2, - UDAT_IGNORE = UDAT_PATTERN -}; - -enum UDateFormatSymbolType { - UDAT_ERAS, - UDAT_MONTHS, - UDAT_SHORT_MONTHS, - UDAT_WEEKDAYS, - UDAT_SHORT_WEEKDAYS, - UDAT_AM_PMS, - UDAT_LOCALIZED_CHARS, - UDAT_ERA_NAMES, - UDAT_NARROW_MONTHS, - UDAT_NARROW_WEEKDAYS, - UDAT_STANDALONE_MONTHS, - UDAT_STANDALONE_SHORT_MONTHS, - UDAT_STANDALONE_NARROW_MONTHS, - UDAT_STANDALONE_WEEKDAYS, - UDAT_STANDALONE_SHORT_WEEKDAYS, - UDAT_STANDALONE_NARROW_WEEKDAYS, - UDAT_QUARTERS, - UDAT_SHORT_QUARTERS, - UDAT_STANDALONE_QUARTERS, - UDAT_STANDALONE_SHORT_QUARTERS, - UDAT_SHORTER_WEEKDAYS, - UDAT_STANDALONE_SHORTER_WEEKDAYS, - UDAT_CYCLIC_YEARS_WIDE, - UDAT_CYCLIC_YEARS_ABBREVIATED, - UDAT_CYCLIC_YEARS_NARROW, - UDAT_ZODIAC_NAMES_WIDE, - UDAT_ZODIAC_NAMES_ABBREVIATED, - UDAT_ZODIAC_NAMES_NARROW -}; - -static int32_t -udat_countAvailable() -{ - MOZ_CRASH("udat_countAvailable: Intl API disabled"); -} - -static const char* -udat_getAvailable(int32_t localeIndex) -{ - MOZ_CRASH("udat_getAvailable: Intl API disabled"); -} - -static UDateFormat* -udat_open(UDateFormatStyle timeStyle, UDateFormatStyle dateStyle, const char* locale, - const UChar* tzID, int32_t tzIDLength, const UChar* pattern, - int32_t patternLength, UErrorCode* status) -{ - MOZ_CRASH("udat_open: Intl API disabled"); -} - -static const UCalendar* -udat_getCalendar(const UDateFormat* fmt) -{ - MOZ_CRASH("udat_getCalendar: Intl API disabled"); -} - -static void -ucal_setGregorianChange(UCalendar* cal, UDate date, UErrorCode* pErrorCode) -{ - MOZ_CRASH("ucal_setGregorianChange: Intl API disabled"); -} - -static int32_t -udat_format(const UDateFormat* format, UDate dateToFormat, UChar* result, - int32_t resultLength, UFieldPosition* position, UErrorCode* status) -{ - MOZ_CRASH("udat_format: Intl API disabled"); -} - -static int32_t -udat_formatForFields(const UDateFormat* format, UDate dateToFormat, - UChar* result, int32_t resultLength, UFieldPositionIterator* fpositer, - UErrorCode* status) -{ - MOZ_CRASH("udat_formatForFields: Intl API disabled"); -} - -static UFieldPositionIterator* -ufieldpositer_open(UErrorCode* status) -{ - MOZ_CRASH("ufieldpositer_open: Intl API disabled"); -} - -static void -ufieldpositer_close(UFieldPositionIterator* fpositer) -{ - MOZ_CRASH("ufieldpositer_close: Intl API disabled"); -} - -static int32_t -ufieldpositer_next(UFieldPositionIterator* fpositer, int32_t* beginIndex, int32_t* endIndex) -{ - MOZ_CRASH("ufieldpositer_next: Intl API disabled"); -} - -static void -udat_close(UDateFormat* format) -{ - MOZ_CRASH("udat_close: Intl API disabled"); -} - -static int32_t -udat_getSymbols(const UDateFormat *fmt, UDateFormatSymbolType type, int32_t symbolIndex, - UChar *result, int32_t resultLength, UErrorCode *status) -{ - MOZ_CRASH("udat_getSymbols: Intl API disabled"); -} - -#endif - - /******************** Common to Intl constructors ********************/ static bool @@ -706,7 +107,6 @@ intl_availableLocales(JSContext* cx, CountAvailable countAvailable, if (!locales) return false; -#if ENABLE_INTL_API uint32_t count = countAvailable(); RootedValue t(cx, BooleanValue(true)); for (uint32_t i = 0; i < count; i++) { @@ -726,7 +126,7 @@ intl_availableLocales(JSContext* cx, CountAvailable countAvailable, return false; } } -#endif + result.setObject(*locales); return true; } diff --git a/js/src/builtin/Intl.h b/js/src/builtin/Intl.h index b2197060d..9a1e44913 100644 --- a/js/src/builtin/Intl.h +++ b/js/src/builtin/Intl.h @@ -16,9 +16,7 @@ #include "js/GCAPI.h" #include "js/GCHashTable.h" -#if ENABLE_INTL_API #include "unicode/utypes.h" -#endif /* * The Intl module specified by standard ECMA-402, @@ -429,7 +427,6 @@ intl_GetCalendarInfo(JSContext* cx, unsigned argc, Value* vp); extern MOZ_MUST_USE bool intl_ComputeDisplayNames(JSContext* cx, unsigned argc, Value* vp); -#if ENABLE_INTL_API /** * Cast char16_t* strings to UChar* strings used by ICU. */ @@ -456,7 +453,6 @@ UCharToChar16(const UChar* chars) { return reinterpret_cast<const char16_t*>(chars); } -#endif // ENABLE_INTL_API } // namespace js diff --git a/js/src/builtin/String.js b/js/src/builtin/String.js index 4202d0de6..6d1d335a0 100644 --- a/js/src/builtin/String.js +++ b/js/src/builtin/String.js @@ -659,11 +659,7 @@ function String_static_localeCompare(str1, str2) { ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, "String.localeCompare"); var locales = arguments.length > 2 ? arguments[2] : undefined; var options = arguments.length > 3 ? arguments[3] : undefined; -#if EXPOSE_INTL_API return callFunction(String_localeCompare, str1, str2, locales, options); -#else - return callFunction(std_String_localeCompare, str1, str2, locales, options); -#endif } // ES6 draft 2014-04-27 B.2.3.3 @@ -855,14 +851,12 @@ function String_static_toLocaleUpperCase(string) { return callFunction(std_String_toLocaleUpperCase, string); } -#if EXPOSE_INTL_API function String_static_normalize(string) { if (arguments.length < 1) ThrowTypeError(JSMSG_MISSING_FUN_ARG, 0, 'String.normalize'); var form = arguments.length > 1 ? arguments[1] : undefined; return callFunction(std_String_normalize, string, form); } -#endif function String_static_concat(string, arg1) { if (arguments.length < 1) diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index a14f9ba69..00637a7a5 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -236,11 +236,7 @@ GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp) if (!JS_SetProperty(cx, info, "binary-data", value)) return false; -#ifdef EXPOSE_INTL_API value = BooleanValue(true); -#else - value = BooleanValue(false); -#endif if (!JS_SetProperty(cx, info, "intl-api", value)) return false; diff --git a/js/src/builtin/TypedArray.js b/js/src/builtin/TypedArray.js index a2205dc92..a1934051d 100644 --- a/js/src/builtin/TypedArray.js +++ b/js/src/builtin/TypedArray.js @@ -1232,11 +1232,7 @@ function TypedArrayToLocaleString(locales = undefined, options = undefined) { // Steps 6-7. // Omit the 'if' clause in step 6, since typed arrays can't have undefined // or null elements. -#if EXPOSE_INTL_API var R = ToString(callContentFunction(firstElement.toLocaleString, firstElement, locales, options)); -#else - var R = ToString(callContentFunction(firstElement.toLocaleString, firstElement)); -#endif // Step 3 (reordered). // We don't (yet?) implement locale-dependent separators. @@ -1258,11 +1254,7 @@ function TypedArrayToLocaleString(locales = undefined, options = undefined) { // the error message. So despite bug 1079853, we can skip step 9.c. // Step 9.d. -#if EXPOSE_INTL_API R = ToString(callContentFunction(nextElement.toLocaleString, nextElement, locales, options)); -#else - R = ToString(callContentFunction(nextElement.toLocaleString, nextElement)); -#endif // Step 9.e. R = S + R; diff --git a/js/src/gdb/moz.build b/js/src/gdb/moz.build index 681f9807c..faa69eb7b 100644 --- a/js/src/gdb/moz.build +++ b/js/src/gdb/moz.build @@ -34,7 +34,7 @@ USE_LIBS += [ 'static:js', ] -if CONFIG['ENABLE_INTL_API'] and CONFIG['MOZ_ICU_DATA_ARCHIVE']: +if CONFIG['MOZ_ICU_DATA_ARCHIVE']: # The ICU libraries linked into libmozjs will not include the ICU data, # so link it directly. USE_LIBS += ['icudata'] diff --git a/js/src/jsapi-tests/moz.build b/js/src/jsapi-tests/moz.build index f7a6080aa..277a145b0 100644 --- a/js/src/jsapi-tests/moz.build +++ b/js/src/jsapi-tests/moz.build @@ -135,7 +135,7 @@ LOCAL_INCLUDES += [ '..', ] -if CONFIG['ENABLE_INTL_API'] and CONFIG['MOZ_ICU_DATA_ARCHIVE']: +if CONFIG['MOZ_ICU_DATA_ARCHIVE']: # The ICU libraries linked into libmozjs will not include the ICU data, # so link it directly. USE_LIBS += ['icudata'] diff --git a/js/src/jsapi.h b/js/src/jsapi.h index 989abe47c..c1195cc00 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -5222,7 +5222,7 @@ JS_ResetDefaultLocale(JSContext* cx); struct JSLocaleCallbacks { JSLocaleToUpperCase localeToUpperCase; JSLocaleToLowerCase localeToLowerCase; - JSLocaleCompare localeCompare; // not used #if EXPOSE_INTL_API + JSLocaleCompare localeCompare; // not used JSLocaleToUnicode localeToUnicode; }; diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 00a8abf84..52294a5df 100755 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -2743,77 +2743,6 @@ ToLocaleFormatHelper(JSContext* cx, HandleObject obj, const char* format, Mutabl return true; } -#if !EXPOSE_INTL_API -/* ES5 15.9.5.5. */ -MOZ_ALWAYS_INLINE bool -date_toLocaleString_impl(JSContext* cx, const CallArgs& args) -{ - /* - * Use '%#c' for windows, because '%c' is backward-compatible and non-y2k - * with msvc; '%#c' requests that a full year be used in the result string. - */ - static const char format[] = -#if defined(_WIN32) && !defined(__MWERKS__) - "%#c" -#else - "%c" -#endif - ; - - Rooted<DateObject*> dateObj(cx, &args.thisv().toObject().as<DateObject>()); - return ToLocaleFormatHelper(cx, dateObj, format, args.rval()); -} - -static bool -date_toLocaleString(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - return CallNonGenericMethod<IsDate, date_toLocaleString_impl>(cx, args); -} - -/* ES5 15.9.5.6. */ -MOZ_ALWAYS_INLINE bool -date_toLocaleDateString_impl(JSContext* cx, const CallArgs& args) -{ - /* - * Use '%#x' for windows, because '%x' is backward-compatible and non-y2k - * with msvc; '%#x' requests that a full year be used in the result string. - */ - static const char format[] = -#if defined(_WIN32) && !defined(__MWERKS__) - "%#x" -#else - "%x" -#endif - ; - - Rooted<DateObject*> dateObj(cx, &args.thisv().toObject().as<DateObject>()); - return ToLocaleFormatHelper(cx, dateObj, format, args.rval()); -} - -static bool -date_toLocaleDateString(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - return CallNonGenericMethod<IsDate, date_toLocaleDateString_impl>(cx, args); -} - -/* ES5 15.9.5.7. */ -MOZ_ALWAYS_INLINE bool -date_toLocaleTimeString_impl(JSContext* cx, const CallArgs& args) -{ - Rooted<DateObject*> dateObj(cx, &args.thisv().toObject().as<DateObject>()); - return ToLocaleFormatHelper(cx, dateObj, "%X", args.rval()); -} - -static bool -date_toLocaleTimeString(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - return CallNonGenericMethod<IsDate, date_toLocaleTimeString_impl>(cx, args); -} -#endif /* !EXPOSE_INTL_API */ - MOZ_ALWAYS_INLINE bool date_toLocaleFormat_impl(JSContext* cx, const CallArgs& args) { @@ -3037,15 +2966,9 @@ static const JSFunctionSpec date_methods[] = { JS_FN("setUTCMilliseconds", date_setUTCMilliseconds, 1,0), JS_FN("toUTCString", date_toGMTString, 0,0), JS_FN("toLocaleFormat", date_toLocaleFormat, 0,0), -#if EXPOSE_INTL_API JS_SELF_HOSTED_FN(js_toLocaleString_str, "Date_toLocaleString", 0,0), JS_SELF_HOSTED_FN("toLocaleDateString", "Date_toLocaleDateString", 0,0), JS_SELF_HOSTED_FN("toLocaleTimeString", "Date_toLocaleTimeString", 0,0), -#else - JS_FN(js_toLocaleString_str, date_toLocaleString, 0,0), - JS_FN("toLocaleDateString", date_toLocaleDateString, 0,0), - JS_FN("toLocaleTimeString", date_toLocaleTimeString, 0,0), -#endif JS_FN("toDateString", date_toDateString, 0,0), JS_FN("toTimeString", date_toTimeString, 0,0), JS_FN("toISOString", date_toISOString, 0,0), diff --git a/js/src/jsnum.cpp b/js/src/jsnum.cpp index 8885737f7..28ed15159 100644 --- a/js/src/jsnum.cpp +++ b/js/src/jsnum.cpp @@ -724,141 +724,6 @@ js::num_toString(JSContext* cx, unsigned argc, Value* vp) return CallNonGenericMethod<IsNumber, num_toString_impl>(cx, args); } -#if !EXPOSE_INTL_API -MOZ_ALWAYS_INLINE bool -num_toLocaleString_impl(JSContext* cx, const CallArgs& args) -{ - MOZ_ASSERT(IsNumber(args.thisv())); - - double d = Extract(args.thisv()); - - RootedString str(cx, NumberToStringWithBase<CanGC>(cx, d, 10)); - if (!str) { - JS_ReportOutOfMemory(cx); - return false; - } - - /* - * Create the string, move back to bytes to make string twiddling - * a bit easier and so we can insert platform charset seperators. - */ - JSAutoByteString numBytes(cx, str); - if (!numBytes) - return false; - const char* num = numBytes.ptr(); - if (!num) - return false; - - /* - * Find the first non-integer value, whether it be a letter as in - * 'Infinity', a decimal point, or an 'e' from exponential notation. - */ - const char* nint = num; - if (*nint == '-') - nint++; - while (*nint >= '0' && *nint <= '9') - nint++; - int digits = nint - num; - const char* end = num + digits; - if (!digits) { - args.rval().setString(str); - return true; - } - - JSRuntime* rt = cx->runtime(); - size_t thousandsLength = strlen(rt->thousandsSeparator); - size_t decimalLength = strlen(rt->decimalSeparator); - - /* Figure out how long resulting string will be. */ - int buflen = strlen(num); - if (*nint == '.') - buflen += decimalLength - 1; /* -1 to account for existing '.' */ - - const char* numGrouping; - const char* tmpGroup; - numGrouping = tmpGroup = rt->numGrouping; - int remainder = digits; - if (*num == '-') - remainder--; - - while (*tmpGroup != CHAR_MAX && *tmpGroup != '\0') { - if (*tmpGroup >= remainder) - break; - buflen += thousandsLength; - remainder -= *tmpGroup; - tmpGroup++; - } - - int nrepeat; - if (*tmpGroup == '\0' && *numGrouping != '\0') { - nrepeat = (remainder - 1) / tmpGroup[-1]; - buflen += thousandsLength * nrepeat; - remainder -= nrepeat * tmpGroup[-1]; - } else { - nrepeat = 0; - } - tmpGroup--; - - char* buf = cx->pod_malloc<char>(buflen + 1); - if (!buf) - return false; - - char* tmpDest = buf; - const char* tmpSrc = num; - - while (*tmpSrc == '-' || remainder--) { - MOZ_ASSERT(tmpDest - buf < buflen); - *tmpDest++ = *tmpSrc++; - } - while (tmpSrc < end) { - MOZ_ASSERT(tmpDest - buf + ptrdiff_t(thousandsLength) <= buflen); - strcpy(tmpDest, rt->thousandsSeparator); - tmpDest += thousandsLength; - MOZ_ASSERT(tmpDest - buf + *tmpGroup <= buflen); - js_memcpy(tmpDest, tmpSrc, *tmpGroup); - tmpDest += *tmpGroup; - tmpSrc += *tmpGroup; - if (--nrepeat < 0) - tmpGroup--; - } - - if (*nint == '.') { - MOZ_ASSERT(tmpDest - buf + ptrdiff_t(decimalLength) <= buflen); - strcpy(tmpDest, rt->decimalSeparator); - tmpDest += decimalLength; - MOZ_ASSERT(tmpDest - buf + ptrdiff_t(strlen(nint + 1)) <= buflen); - strcpy(tmpDest, nint + 1); - } else { - MOZ_ASSERT(tmpDest - buf + ptrdiff_t(strlen(nint)) <= buflen); - strcpy(tmpDest, nint); - } - - if (cx->runtime()->localeCallbacks && cx->runtime()->localeCallbacks->localeToUnicode) { - Rooted<Value> v(cx, StringValue(str)); - bool ok = !!cx->runtime()->localeCallbacks->localeToUnicode(cx, buf, &v); - if (ok) - args.rval().set(v); - js_free(buf); - return ok; - } - - str = NewStringCopyN<CanGC>(cx, buf, buflen); - js_free(buf); - if (!str) - return false; - - args.rval().setString(str); - return true; -} - -static bool -num_toLocaleString(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - return CallNonGenericMethod<IsNumber, num_toLocaleString_impl>(cx, args); -} -#endif /* !EXPOSE_INTL_API */ - MOZ_ALWAYS_INLINE bool num_valueOf_impl(JSContext* cx, const CallArgs& args) { @@ -1075,11 +940,7 @@ static const JSFunctionSpec number_methods[] = { JS_FN(js_toSource_str, num_toSource, 0, 0), #endif JS_FN(js_toString_str, num_toString, 1, 0), -#if EXPOSE_INTL_API JS_SELF_HOSTED_FN(js_toLocaleString_str, "Number_toLocaleString", 0,0), -#else - JS_FN(js_toLocaleString_str, num_toLocaleString, 0,0), -#endif JS_FN(js_valueOf_str, num_valueOf, 0, 0), JS_FN("toFixed", num_toFixed, 1, 0), JS_FN("toExponential", num_toExponential, 1, 0), @@ -1130,76 +991,11 @@ js::FIX_FPU() #endif } -bool +void js::InitRuntimeNumberState(JSRuntime* rt) { FIX_FPU(); - - // XXX If EXPOSE_INTL_API becomes true all the time at some point, - // js::InitRuntimeNumberState is no longer fallible, and we should - // change its return type. -#if !EXPOSE_INTL_API - /* Copy locale-specific separators into the runtime strings. */ - const char* thousandsSeparator; - const char* decimalPoint; - const char* grouping; -#ifdef HAVE_LOCALECONV - struct lconv* locale = localeconv(); - thousandsSeparator = locale->thousands_sep; - decimalPoint = locale->decimal_point; - grouping = locale->grouping; -#else - thousandsSeparator = getenv("LOCALE_THOUSANDS_SEP"); - decimalPoint = getenv("LOCALE_DECIMAL_POINT"); - grouping = getenv("LOCALE_GROUPING"); -#endif - if (!thousandsSeparator) - thousandsSeparator = "'"; - if (!decimalPoint) - decimalPoint = "."; - if (!grouping) - grouping = "\3\0"; - - /* - * We use single malloc to get the memory for all separator and grouping - * strings. - */ - size_t thousandsSeparatorSize = strlen(thousandsSeparator) + 1; - size_t decimalPointSize = strlen(decimalPoint) + 1; - size_t groupingSize = strlen(grouping) + 1; - - char* storage = js_pod_malloc<char>(thousandsSeparatorSize + - decimalPointSize + - groupingSize); - if (!storage) - return false; - - js_memcpy(storage, thousandsSeparator, thousandsSeparatorSize); - rt->thousandsSeparator = storage; - storage += thousandsSeparatorSize; - - js_memcpy(storage, decimalPoint, decimalPointSize); - rt->decimalSeparator = storage; - storage += decimalPointSize; - - js_memcpy(storage, grouping, groupingSize); - rt->numGrouping = grouping; -#endif /* !EXPOSE_INTL_API */ - return true; -} - -#if !EXPOSE_INTL_API -void -js::FinishRuntimeNumberState(JSRuntime* rt) -{ - /* - * The free also releases the memory for decimalSeparator and numGrouping - * strings. - */ - char* storage = const_cast<char*>(rt->thousandsSeparator); - js_free(storage); } -#endif JSObject* js::InitNumberClass(JSContext* cx, HandleObject obj) diff --git a/js/src/jsnum.h b/js/src/jsnum.h index 62b3d617f..8dff45f69 100644 --- a/js/src/jsnum.h +++ b/js/src/jsnum.h @@ -34,13 +34,7 @@ namespace js { class StringBuffer; -extern MOZ_MUST_USE bool -InitRuntimeNumberState(JSRuntime* rt); - -#if !EXPOSE_INTL_API -extern void -FinishRuntimeNumberState(JSRuntime* rt); -#endif +void InitRuntimeNumberState(JSRuntime* rt); /* Initialize the Number class, returning its prototype object. */ extern JSObject* diff --git a/js/src/jsprototypes.h b/js/src/jsprototypes.h index f409dce95..dc7cdb85a 100644 --- a/js/src/jsprototypes.h +++ b/js/src/jsprototypes.h @@ -37,11 +37,7 @@ #define TYPED_ARRAY_CLASP(type) (&TypedArrayObject::classes[Scalar::type]) #define ERROR_CLASP(type) (&ErrorObject::classes[type]) -#ifdef EXPOSE_INTL_API #define IF_INTL(real,imaginary) real -#else -#define IF_INTL(real,imaginary) imaginary -#endif #ifdef ENABLE_BINARYDATA #define IF_BDATA(real,imaginary) real diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 7adeed620..01b407626 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -36,9 +36,7 @@ #include "jit/InlinableNatives.h" #include "js/Conversions.h" #include "js/UniquePtr.h" -#if ENABLE_INTL_API #include "unicode/unorm.h" -#endif #include "vm/GlobalObject.h" #include "vm/Interpreter.h" #include "vm/Opcodes.h" @@ -899,38 +897,6 @@ js::str_toLocaleUpperCase(JSContext* cx, unsigned argc, Value* vp) return ToUpperCaseHelper(cx, args); } -#if !EXPOSE_INTL_API -bool -js::str_localeCompare(JSContext* cx, unsigned argc, Value* vp) -{ - CallArgs args = CallArgsFromVp(argc, vp); - RootedString str(cx, ToStringForStringFunction(cx, args.thisv())); - if (!str) - return false; - - RootedString thatStr(cx, ToString<CanGC>(cx, args.get(0))); - if (!thatStr) - return false; - - if (cx->runtime()->localeCallbacks && cx->runtime()->localeCallbacks->localeCompare) { - RootedValue result(cx); - if (!cx->runtime()->localeCallbacks->localeCompare(cx, str, thatStr, &result)) - return false; - - args.rval().set(result); - return true; - } - - int32_t result; - if (!CompareStrings(cx, str, thatStr, &result)) - return false; - - args.rval().setInt32(result); - return true; -} -#endif - -#if EXPOSE_INTL_API /* ES6 20140210 draft 21.1.3.12. */ bool js::str_normalize(JSContext* cx, unsigned argc, Value* vp) @@ -1007,7 +973,6 @@ js::str_normalize(JSContext* cx, unsigned argc, Value* vp) args.rval().setString(ns); return true; } -#endif bool js::str_charAt(JSContext* cx, unsigned argc, Value* vp) @@ -2599,15 +2564,9 @@ static const JSFunctionSpec string_methods[] = { JS_FN("trimRight", str_trimRight, 0,0), JS_FN("toLocaleLowerCase", str_toLocaleLowerCase, 0,0), JS_FN("toLocaleUpperCase", str_toLocaleUpperCase, 0,0), -#if EXPOSE_INTL_API JS_SELF_HOSTED_FN("localeCompare", "String_localeCompare", 1,0), -#else - JS_FN("localeCompare", str_localeCompare, 1,0), -#endif JS_SELF_HOSTED_FN("repeat", "String_repeat", 1,0), -#if EXPOSE_INTL_API JS_FN("normalize", str_normalize, 0,0), -#endif /* Perl-ish methods (search is actually Python-esque). */ JS_SELF_HOSTED_FN("match", "String_match", 1,0), @@ -2918,9 +2877,7 @@ static const JSFunctionSpec string_static_methods[] = { JS_SELF_HOSTED_FN("trimRight", "String_static_trimRight", 1,0), JS_SELF_HOSTED_FN("toLocaleLowerCase","String_static_toLocaleLowerCase",1,0), JS_SELF_HOSTED_FN("toLocaleUpperCase","String_static_toLocaleUpperCase",1,0), -#if EXPOSE_INTL_API JS_SELF_HOSTED_FN("normalize", "String_static_normalize", 1,0), -#endif JS_SELF_HOSTED_FN("concat", "String_static_concat", 2,0), JS_SELF_HOSTED_FN("localeCompare", "String_static_localeCompare", 2,0), diff --git a/js/src/jsstr.h b/js/src/jsstr.h index 7e9621d4a..118118839 100644 --- a/js/src/jsstr.h +++ b/js/src/jsstr.h @@ -378,13 +378,8 @@ str_toLocaleLowerCase(JSContext* cx, unsigned argc, Value* vp); extern bool str_toLocaleUpperCase(JSContext* cx, unsigned argc, Value* vp); -#if !EXPOSE_INTL_API -extern bool -str_localeCompare(JSContext* cx, unsigned argc, Value* vp); -#else extern bool str_normalize(JSContext* cx, unsigned argc, Value* vp); -#endif extern bool str_concat(JSContext* cx, unsigned argc, Value* vp); diff --git a/js/src/moz.build b/js/src/moz.build index 2d4e83db3..a3283b5d6 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -645,18 +645,17 @@ else: FORCE_STATIC_LIB = True STATIC_LIBRARY_NAME = 'js_static' -if CONFIG['ENABLE_INTL_API']: - if not CONFIG['MOZ_ICU_DATA_ARCHIVE']: - USE_LIBS += [ - 'icu', - ] - else: - # Linking 'icu' will pull in the stubdata library, - # which the shell doesn't want, so link the other bits. - USE_LIBS += [ - 'icui18n', - 'icuuc', - ] +if not CONFIG['MOZ_ICU_DATA_ARCHIVE']: + USE_LIBS += [ + 'icu', + ] +else: + # Linking 'icu' will pull in the stubdata library, + # which the shell doesn't want, so link the other bits. + USE_LIBS += [ + 'icui18n', + 'icuuc', + ] USE_LIBS += [ 'nspr', diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 8d69ca942..8d144417a 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -893,7 +893,6 @@ SetPromiseRejectionTrackerCallback(JSContext* cx, unsigned argc, Value* vp) return true; } -#ifdef ENABLE_INTL_API static bool AddIntlExtras(JSContext* cx, unsigned argc, Value* vp) { @@ -916,7 +915,6 @@ AddIntlExtras(JSContext* cx, unsigned argc, Value* vp) args.rval().setUndefined(); return true; } -#endif // ENABLE_INTL_API static bool EvalAndPrint(JSContext* cx, const char* bytes, size_t length, @@ -6140,7 +6138,6 @@ static const JSFunctionSpecWithHelp shell_functions[] = { "Sets the callback to be invoked whenever a Promise rejection is unhandled\n" "or a previously-unhandled rejection becomes handled."), -#ifdef ENABLE_INTL_API JS_FN_HELP("addIntlExtras", AddIntlExtras, 1, 0, "addIntlExtras(obj)", "Adds various not-yet-standardized Intl functions as properties on the\n" @@ -6148,7 +6145,6 @@ static const JSFunctionSpecWithHelp shell_functions[] = { "functions and their behavior are experimental: don't depend upon them\n" "unless you're willing to update your code if these experimental APIs change\n" "underneath you."), -#endif // ENABLE_INTL_API JS_FS_HELP_END }; diff --git a/js/src/shell/moz.build b/js/src/shell/moz.build index 72ea8145c..e18bad238 100644 --- a/js/src/shell/moz.build +++ b/js/src/shell/moz.build @@ -36,7 +36,7 @@ LOCAL_INCLUDES += [ OS_LIBS += CONFIG['EDITLINE_LIBS'] OS_LIBS += CONFIG['MOZ_ZLIB_LIBS'] -if CONFIG['ENABLE_INTL_API'] and CONFIG['MOZ_ICU_DATA_ARCHIVE']: +if CONFIG['MOZ_ICU_DATA_ARCHIVE']: # The ICU libraries linked into libmozjs will not include the ICU data, # so link it directly. USE_LIBS += ['icudata'] diff --git a/js/src/vm/DateTime.cpp b/js/src/vm/DateTime.cpp index e35ad4285..ba3145af2 100644 --- a/js/src/vm/DateTime.cpp +++ b/js/src/vm/DateTime.cpp @@ -13,9 +13,7 @@ #include "jsutil.h" #include "js/Date.h" -#if ENABLE_INTL_API #include "unicode/timezone.h" -#endif using mozilla::Atomic; using mozilla::ReleaseAcquire; @@ -333,7 +331,7 @@ JS::ResetTimeZone() { js::DateTimeInfo::updateTimeZoneAdjustment(); -#if ENABLE_INTL_API && defined(ICU_TZ_HAS_RECREATE_DEFAULT) +#if defined(ICU_TZ_HAS_RECREATE_DEFAULT) TZInfo.acquire(); TZInfo.status = IcuTimeZoneInfo::NeedsUpdate; TZInfo.release(); @@ -343,7 +341,7 @@ JS::ResetTimeZone() void js::ResyncICUDefaultTimeZone() { -#if ENABLE_INTL_API && defined(ICU_TZ_HAS_RECREATE_DEFAULT) +#if defined(ICU_TZ_HAS_RECREATE_DEFAULT) TZInfo.acquire(); if (TZInfo.status == IcuTimeZoneInfo::NeedsUpdate) { icu::TimeZone::recreateDefault(); diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp index 280548cd6..c90b6b85f 100644 --- a/js/src/vm/GlobalObject.cpp +++ b/js/src/vm/GlobalObject.cpp @@ -17,9 +17,7 @@ #include "builtin/AtomicsObject.h" #include "builtin/Eval.h" -#if EXPOSE_INTL_API -# include "builtin/Intl.h" -#endif +#include "builtin/Intl.h" #include "builtin/MapObject.h" #include "builtin/ModuleObject.h" #include "builtin/Object.h" diff --git a/js/src/vm/Initialization.cpp b/js/src/vm/Initialization.cpp index 05cc087cc..39acdf9a8 100644 --- a/js/src/vm/Initialization.cpp +++ b/js/src/vm/Initialization.cpp @@ -20,10 +20,8 @@ #include "jit/ExecutableAllocator.h" #include "jit/Ion.h" #include "js/Utility.h" -#if ENABLE_INTL_API #include "unicode/uclean.h" #include "unicode/utypes.h" -#endif // ENABLE_INTL_API #include "vm/DateTime.h" #include "vm/HelperThreads.h" #include "vm/Runtime.h" @@ -113,12 +111,10 @@ JS::detail::InitWithFailureDiagnostic(bool isDebugBuild) js::DateTimeInfo::init(); -#if EXPOSE_INTL_API UErrorCode err = U_ZERO_ERROR; u_init(&err); if (U_FAILURE(err)) return "u_init() failed"; -#endif // EXPOSE_INTL_API RETURN_IF_FAIL(js::CreateHelperThreadsState()); RETURN_IF_FAIL(FutexRuntime::initialize()); @@ -171,9 +167,7 @@ JS_ShutDown(void) // to do it only when PRMJ_Now is eventually called. PRMJ_NowShutdown(); -#if EXPOSE_INTL_API u_cleanup(); -#endif // EXPOSE_INTL_API if (!JSRuntime::hasLiveRuntimes()) js::jit::ReleaseProcessExecutableMemory(); @@ -188,11 +182,7 @@ JS_SetICUMemoryFunctions(JS_ICUAllocFn allocFn, JS_ICUReallocFn reallocFn, JS_IC "must call JS_SetICUMemoryFunctions before any other JSAPI " "operation (including JS_Init)"); -#if EXPOSE_INTL_API UErrorCode status = U_ZERO_ERROR; u_setMemoryFunctions(/* context = */ nullptr, allocFn, reallocFn, freeFn, &status); return U_SUCCESS(status); -#else - return true; -#endif } diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 0d6a3922c..174e23594 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -213,11 +213,6 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime) warningReporter(nullptr), buildIdOp(nullptr), propertyRemovals(0), -#if !EXPOSE_INTL_API - thousandsSeparator(0), - decimalSeparator(0), - numGrouping(0), -#endif keepAtoms_(0), trustedPrincipals_(nullptr), beingDestroyed_(false), @@ -330,8 +325,7 @@ JSRuntime::init(uint32_t maxbytes, uint32_t maxNurseryBytes) /* The garbage collector depends on everything before this point being initialized. */ gcInitialized = true; - if (!InitRuntimeNumberState(this)) - return false; + InitRuntimeNumberState(this); JS::ResetTimeZone(); @@ -425,10 +419,6 @@ JSRuntime::destroyRuntime() */ FreeScriptData(this, lock); -#if !EXPOSE_INTL_API - FinishRuntimeNumberState(this); -#endif - gc.finish(); atomsCompartment_ = nullptr; diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index 734543c4e..735adadf2 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -978,13 +978,6 @@ struct JSRuntime : public JS::shadow::Runtime, */ uint32_t propertyRemovals; -#if !EXPOSE_INTL_API - /* Number localization, used by jsnum.cpp. */ - const char* thousandsSeparator; - const char* decimalSeparator; - const char* numGrouping; -#endif - private: mozilla::Maybe<js::SharedImmutableStringsCache> sharedImmutableStrings_; diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 9a8ec7679..653807ce8 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -2205,11 +2205,7 @@ static const JSFunctionSpec intrinsic_functions[] = { JS_FN("std_String_trimRight", str_trimRight, 0,0), JS_FN("std_String_toLocaleLowerCase", str_toLocaleLowerCase, 0,0), JS_FN("std_String_toLocaleUpperCase", str_toLocaleUpperCase, 0,0), -#if !EXPOSE_INTL_API - JS_FN("std_String_localeCompare", str_localeCompare, 1,0), -#else JS_FN("std_String_normalize", str_normalize, 0,0), -#endif JS_FN("std_String_concat", str_concat, 1,0), JS_FN("std_TypedArray_buffer", js::TypedArray_bufferGetter, 1,0), |