Commit 4afd39c3 authored by Sathya Gunasekaran's avatar Sathya Gunasekaran Committed by Commit Bot

[intl] Set null proto for internal objects

Makes it safer to access from C++

Bug: v8:5751
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: Ib435382bd5568a62976a32b1ff4ca67c8413ddf2
Reviewed-on: https://chromium-review.googlesource.com/1127081Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54278}
parent a5c456ad
...@@ -129,6 +129,7 @@ function IntlConstruct(receiver, constructor, create, newTarget, args, ...@@ -129,6 +129,7 @@ function IntlConstruct(receiver, constructor, create, newTarget, args,
* Caches available locales for each service. * Caches available locales for each service.
*/ */
var AVAILABLE_LOCALES = { var AVAILABLE_LOCALES = {
__proto__ : null,
'collator': UNDEFINED, 'collator': UNDEFINED,
'numberformat': UNDEFINED, 'numberformat': UNDEFINED,
'dateformat': UNDEFINED, 'dateformat': UNDEFINED,
...@@ -455,7 +456,7 @@ function attemptSingleLookup(availableLocales, requestedLocale) { ...@@ -455,7 +456,7 @@ function attemptSingleLookup(availableLocales, requestedLocale) {
var extensionMatch = %regexp_internal_match( var extensionMatch = %regexp_internal_match(
GetUnicodeExtensionRE(), requestedLocale); GetUnicodeExtensionRE(), requestedLocale);
var extension = IS_NULL(extensionMatch) ? '' : extensionMatch[0]; var extension = IS_NULL(extensionMatch) ? '' : extensionMatch[0];
return {locale: availableLocale, extension: extension}; return {__proto__: null, locale: availableLocale, extension: extension};
} }
return UNDEFINED; return UNDEFINED;
} }
...@@ -490,6 +491,7 @@ function lookupMatcher(service, requestedLocales) { ...@@ -490,6 +491,7 @@ function lookupMatcher(service, requestedLocales) {
// Didn't find a match, return default. // Didn't find a match, return default.
return { return {
__proto__: null,
locale: 'und', locale: 'und',
extension: '' extension: ''
}; };
...@@ -994,8 +996,9 @@ function CreateCollator(locales, options) { ...@@ -994,8 +996,9 @@ function CreateCollator(locales, options) {
* for a collator. * for a collator.
*/ */
var COLLATOR_KEY_MAP = { var COLLATOR_KEY_MAP = {
'kn': {'property': 'numeric', 'type': 'boolean'}, __proto__: null,
'kf': {'property': 'caseFirst', 'type': 'string', 'kn': { __proto__: null, 'property': 'numeric', 'type': 'boolean'},
'kf': { __proto__: null, 'property': 'caseFirst', 'type': 'string',
'values': ['false', 'lower', 'upper']} 'values': ['false', 'lower', 'upper']}
}; };
...@@ -1341,7 +1344,8 @@ function CreateNumberFormat(locales, options) { ...@@ -1341,7 +1344,8 @@ function CreateNumberFormat(locales, options) {
* for a number format. * for a number format.
*/ */
var NUMBER_FORMAT_KEY_MAP = { var NUMBER_FORMAT_KEY_MAP = {
'nu': {'property': UNDEFINED, 'type': 'string'} __proto__: null,
'nu': {__proto__: null, 'property': UNDEFINED, 'type': 'string'}
}; };
var extension = setOptions(options, extensionMap, NUMBER_FORMAT_KEY_MAP, var extension = setOptions(options, extensionMap, NUMBER_FORMAT_KEY_MAP,
...@@ -1706,8 +1710,9 @@ function CreateDateTimeFormat(locales, options) { ...@@ -1706,8 +1710,9 @@ function CreateDateTimeFormat(locales, options) {
* for a date/time format. * for a date/time format.
*/ */
var DATETIME_FORMAT_KEY_MAP = { var DATETIME_FORMAT_KEY_MAP = {
'ca': {'property': UNDEFINED, 'type': 'string'}, __proto__: null,
'nu': {'property': UNDEFINED, 'type': 'string'} 'ca': {__proto__: null, 'property': UNDEFINED, 'type': 'string'},
'nu': {__proto__: null, 'property': UNDEFINED, 'type': 'string'}
}; };
var extension = setOptions(options, extensionMap, DATETIME_FORMAT_KEY_MAP, var extension = setOptions(options, extensionMap, DATETIME_FORMAT_KEY_MAP,
...@@ -1735,7 +1740,8 @@ function CreateDateTimeFormat(locales, options) { ...@@ -1735,7 +1740,8 @@ function CreateDateTimeFormat(locales, options) {
}); });
var dateFormat = %CreateDateTimeFormat( var dateFormat = %CreateDateTimeFormat(
requestedLocale, {skeleton: ldmlString, timeZone: tz}, resolved); requestedLocale,
{__proto__: null, skeleton: ldmlString, timeZone: tz}, resolved);
if (resolved.timeZone === "Etc/Unknown") { if (resolved.timeZone === "Etc/Unknown") {
throw %make_range_error(kUnsupportedTimeZone, tz); throw %make_range_error(kUnsupportedTimeZone, tz);
...@@ -1782,6 +1788,7 @@ DEFINE_METHOD( ...@@ -1782,6 +1788,7 @@ DEFINE_METHOD(
* http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xml * http://www.unicode.org/repos/cldr/tags/latest/common/bcp47/calendar.xml
*/ */
var ICU_CALENDAR_MAP = { var ICU_CALENDAR_MAP = {
__proto__: null,
'gregorian': 'gregory', 'gregorian': 'gregory',
'ethiopic-amete-alem': 'ethioaa' 'ethiopic-amete-alem': 'ethioaa'
}; };
...@@ -2035,6 +2042,7 @@ AddBoundMethod(GlobalIntlv8BreakIterator, 'breakType', breakType, 0, ...@@ -2035,6 +2042,7 @@ AddBoundMethod(GlobalIntlv8BreakIterator, 'breakType', breakType, 0,
// Save references to Intl objects and methods we use, for added security. // Save references to Intl objects and methods we use, for added security.
var savedObjects = { var savedObjects = {
__proto__: null,
'collator': GlobalIntlCollator, 'collator': GlobalIntlCollator,
'numberformat': GlobalIntlNumberFormat, 'numberformat': GlobalIntlNumberFormat,
'dateformatall': GlobalIntlDateTimeFormat, 'dateformatall': GlobalIntlDateTimeFormat,
...@@ -2046,6 +2054,7 @@ var savedObjects = { ...@@ -2046,6 +2054,7 @@ var savedObjects = {
// Default (created with undefined locales and options parameters) collator, // Default (created with undefined locales and options parameters) collator,
// number and date format instances. They'll be created as needed. // number and date format instances. They'll be created as needed.
var defaultObjects = { var defaultObjects = {
__proto__: null,
'collator': UNDEFINED, 'collator': UNDEFINED,
'numberformat': UNDEFINED, 'numberformat': UNDEFINED,
'dateformatall': UNDEFINED, 'dateformatall': UNDEFINED,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment