Index: src/i18n.js |
diff --git a/src/i18n.js b/src/i18n.js |
index edfb065c9c998afd12ec059c04b30532289592bb..3e771116dc7839700e09c1073f9bf2fb573dda6d 100644 |
--- a/src/i18n.js |
+++ b/src/i18n.js |
@@ -281,7 +281,7 @@ function addBoundMethod(obj, methodName, implementation, length) { |
%FunctionRemovePrototype(getter); |
%SetNativeFlag(getter); |
- $Object.defineProperty(obj.prototype, methodName, { |
+ ObjectDefineProperty(obj.prototype, methodName, { |
get: getter, |
enumerable: false, |
configurable: true |
@@ -616,15 +616,14 @@ function setOptions(inOptions, extensionMap, keyValues, getOption, outOptions) { |
*/ |
function freezeArray(array) { |
array.forEach(function(element, index) { |
- $Object.defineProperty(array, index, {value: element, |
+ ObjectDefineProperty(array, index, {value: element, |
configurable: false, |
writable: false, |
enumerable: true}); |
}); |
- $Object.defineProperty(array, 'length', {value: array.length, |
- writable: false}); |
- |
+ ObjectDefineProperty(array, 'length', {value: array.length, |
+ writable: false}); |
return array; |
} |
@@ -685,8 +684,8 @@ function getAvailableLocalesOf(service) { |
* Configurable is false by default. |
*/ |
function defineWEProperty(object, property, value) { |
- $Object.defineProperty(object, property, |
- {value: value, writable: true, enumerable: true}); |
+ ObjectDefineProperty(object, property, |
+ {value: value, writable: true, enumerable: true}); |
} |
@@ -705,11 +704,11 @@ function addWEPropertyIfDefined(object, property, value) { |
* Defines a property and sets writable, enumerable and configurable to true. |
*/ |
function defineWECProperty(object, property, value) { |
- $Object.defineProperty(object, property, |
- {value: value, |
- writable: true, |
- enumerable: true, |
- configurable: true}); |
+ ObjectDefineProperty(object, property, |
+ {value: value, |
+ writable: true, |
+ enumerable: true, |
+ configurable: true}); |
} |
@@ -948,8 +947,8 @@ function initializeCollator(collator, locales, options) { |
// We define all properties C++ code may produce, to prevent security |
// problems. If malicious user decides to redefine Object.prototype.locale |
// we can't just use plain x.locale = 'us' or in C++ Set("locale", "us"). |
- // Object.defineProperties will either succeed defining or throw an error. |
- var resolved = $Object.defineProperties({}, { |
+ // ObjectDefineProperties will either succeed defining or throw an error. |
+ var resolved = ObjectDefineProperties({}, { |
caseFirst: {writable: true}, |
collation: {value: internalOptions.collation, writable: true}, |
ignorePunctuation: {writable: true}, |
@@ -967,7 +966,7 @@ function initializeCollator(collator, locales, options) { |
// Writable, configurable and enumerable are set to false by default. |
%MarkAsInitializedIntlObjectOfType(collator, 'collator', internalCollator); |
- $Object.defineProperty(collator, 'resolved', {value: resolved}); |
+ ObjectDefineProperty(collator, 'resolved', {value: resolved}); |
return collator; |
} |
@@ -1164,7 +1163,7 @@ function initializeNumberFormat(numberFormat, locales, options) { |
getOption, internalOptions); |
var requestedLocale = locale.locale + extension; |
- var resolved = $Object.defineProperties({}, { |
+ var resolved = ObjectDefineProperties({}, { |
currency: {writable: true}, |
currencyDisplay: {writable: true}, |
locale: {writable: true}, |
@@ -1189,12 +1188,12 @@ function initializeNumberFormat(numberFormat, locales, options) { |
// We can't get information about number or currency style from ICU, so we |
// assume user request was fulfilled. |
if (internalOptions.style === 'currency') { |
- $Object.defineProperty(resolved, 'currencyDisplay', {value: currencyDisplay, |
- writable: true}); |
+ ObjectDefineProperty(resolved, 'currencyDisplay', {value: currencyDisplay, |
+ writable: true}); |
} |
%MarkAsInitializedIntlObjectOfType(numberFormat, 'numberformat', formatter); |
- $Object.defineProperty(numberFormat, 'resolved', {value: resolved}); |
+ ObjectDefineProperty(numberFormat, 'resolved', {value: resolved}); |
return numberFormat; |
} |
@@ -1466,13 +1465,11 @@ function appendToDateTimeObject(options, option, match, pairs) { |
*/ |
function toDateTimeOptions(options, required, defaults) { |
if (options === undefined) { |
- options = null; |
+ options = {}; |
} else { |
- options = toObject(options); |
+ options = TO_OBJECT_INLINE(options); |
} |
- options = $Object.apply(this, [options]); |
- |
var needsDefault = true; |
if ((required === 'date' || required === 'any') && |
(options.weekday !== undefined || options.year !== undefined || |
@@ -1487,30 +1484,30 @@ function toDateTimeOptions(options, required, defaults) { |
} |
if (needsDefault && (defaults === 'date' || defaults === 'all')) { |
- $Object.defineProperty(options, 'year', {value: 'numeric', |
- writable: true, |
- enumerable: true, |
- configurable: true}); |
- $Object.defineProperty(options, 'month', {value: 'numeric', |
- writable: true, |
- enumerable: true, |
- configurable: true}); |
- $Object.defineProperty(options, 'day', {value: 'numeric', |
+ ObjectDefineProperty(options, 'year', {value: 'numeric', |
+ writable: true, |
+ enumerable: true, |
+ configurable: true}); |
+ ObjectDefineProperty(options, 'month', {value: 'numeric', |
writable: true, |
enumerable: true, |
configurable: true}); |
+ ObjectDefineProperty(options, 'day', {value: 'numeric', |
+ writable: true, |
+ enumerable: true, |
+ configurable: true}); |
} |
if (needsDefault && (defaults === 'time' || defaults === 'all')) { |
- $Object.defineProperty(options, 'hour', {value: 'numeric', |
+ ObjectDefineProperty(options, 'hour', {value: 'numeric', |
writable: true, |
enumerable: true, |
configurable: true}); |
- $Object.defineProperty(options, 'minute', {value: 'numeric', |
+ ObjectDefineProperty(options, 'minute', {value: 'numeric', |
writable: true, |
enumerable: true, |
configurable: true}); |
- $Object.defineProperty(options, 'second', {value: 'numeric', |
+ ObjectDefineProperty(options, 'second', {value: 'numeric', |
writable: true, |
enumerable: true, |
configurable: true}); |
@@ -1561,7 +1558,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { |
getOption, internalOptions); |
var requestedLocale = locale.locale + extension; |
- var resolved = $Object.defineProperties({}, { |
+ var resolved = ObjectDefineProperties({}, { |
calendar: {writable: true}, |
day: {writable: true}, |
era: {writable: true}, |
@@ -1589,7 +1586,7 @@ function initializeDateTimeFormat(dateFormat, locales, options) { |
} |
%MarkAsInitializedIntlObjectOfType(dateFormat, 'dateformat', formatter); |
- $Object.defineProperty(dateFormat, 'resolved', {value: resolved}); |
+ ObjectDefineProperty(dateFormat, 'resolved', {value: resolved}); |
return dateFormat; |
} |
@@ -1783,7 +1780,7 @@ function initializeBreakIterator(iterator, locales, options) { |
'type', 'string', ['character', 'word', 'sentence', 'line'], 'word')); |
var locale = resolveLocale('breakiterator', locales, options); |
- var resolved = $Object.defineProperties({}, { |
+ var resolved = ObjectDefineProperties({}, { |
requestedLocale: {value: locale.locale, writable: true}, |
type: {value: internalOptions.type, writable: true}, |
locale: {writable: true} |
@@ -1795,7 +1792,7 @@ function initializeBreakIterator(iterator, locales, options) { |
%MarkAsInitializedIntlObjectOfType(iterator, 'breakiterator', |
internalIterator); |
- $Object.defineProperty(iterator, 'resolved', {value: resolved}); |
+ ObjectDefineProperty(iterator, 'resolved', {value: resolved}); |
return iterator; |
} |
@@ -1961,7 +1958,7 @@ function cachedOrNewService(service, locales, options, defaults) { |
* Compares this and that, and returns less than 0, 0 or greater than 0 value. |
* Overrides the built-in method. |
*/ |
-$Object.defineProperty($String.prototype, 'localeCompare', { |
+ObjectDefineProperty($String.prototype, 'localeCompare', { |
value: function(that) { |
if (%_IsConstructCall()) { |
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
@@ -1992,7 +1989,7 @@ $Object.defineProperty($String.prototype, 'localeCompare', { |
* If the form is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw |
* a RangeError Exception. |
*/ |
-$Object.defineProperty($String.prototype, 'normalize', { |
+ObjectDefineProperty($String.prototype, 'normalize', { |
value: function(that) { |
if (%_IsConstructCall()) { |
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
@@ -2023,7 +2020,7 @@ $Object.defineProperty($String.prototype, 'normalize', { |
* Formats a Number object (this) using locale and options values. |
* If locale or options are omitted, defaults are used. |
*/ |
-$Object.defineProperty($Number.prototype, 'toLocaleString', { |
+ObjectDefineProperty($Number.prototype, 'toLocaleString', { |
value: function() { |
if (%_IsConstructCall()) { |
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
@@ -2073,7 +2070,7 @@ function toLocaleDateTime(date, locales, options, required, defaults, service) { |
* If locale or options are omitted, defaults are used - both date and time are |
* present in the output. |
*/ |
-$Object.defineProperty($Date.prototype, 'toLocaleString', { |
+ObjectDefineProperty($Date.prototype, 'toLocaleString', { |
value: function() { |
if (%_IsConstructCall()) { |
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
@@ -2098,7 +2095,7 @@ $Object.defineProperty($Date.prototype, 'toLocaleString', { |
* If locale or options are omitted, defaults are used - only date is present |
* in the output. |
*/ |
-$Object.defineProperty($Date.prototype, 'toLocaleDateString', { |
+ObjectDefineProperty($Date.prototype, 'toLocaleDateString', { |
value: function() { |
if (%_IsConstructCall()) { |
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |
@@ -2123,7 +2120,7 @@ $Object.defineProperty($Date.prototype, 'toLocaleDateString', { |
* If locale or options are omitted, defaults are used - only time is present |
* in the output. |
*/ |
-$Object.defineProperty($Date.prototype, 'toLocaleTimeString', { |
+ObjectDefineProperty($Date.prototype, 'toLocaleTimeString', { |
value: function() { |
if (%_IsConstructCall()) { |
throw new $TypeError(ORDINARY_FUNCTION_CALLED_AS_CONSTRUCTOR); |