TEST=test/intl/string/normalization
BUG=v8:4303
LOG=N
Review URL: https://codereview.chromium.org/
1274653002
Cr-Commit-Position: refs/heads/master@{#30030}
* If the form is not one of "NFC", "NFD", "NFKC", or "NFKD", then throw
* a RangeError Exception.
*/
-OverrideFunction(GlobalString.prototype, 'normalize', function(form) {
+
+OverrideFunction(GlobalString.prototype, 'normalize', function() {
if (%_IsConstructCall()) {
throw MakeTypeError(kOrdinaryFunctionCalledAsConstructor);
}
CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize");
- form = IS_UNDEFINED(form) ? 'NFC' : form;
+ var formArg = %_Arguments(0);
+ var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg);
var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
// For now we do nothing, as proper normalization requires big tables.
// If Intl is enabled, then i18n.js will override it and provide the the
// proper functionality.
-function StringNormalizeJS(form) {
+function StringNormalizeJS() {
CHECK_OBJECT_COERCIBLE(this, "String.prototype.normalize");
- var form = IS_UNDEFINED(form) ? 'NFC' : TO_STRING_INLINE(form);
+ var formArg = %_Arguments(0);
+ var form = IS_UNDEFINED(formArg) ? 'NFC' : TO_STRING_INLINE(formArg);
var NORMALIZATION_FORMS = ['NFC', 'NFD', 'NFKC', 'NFKD'];
var normalizationForm =
// Tests the new String.prototype.normalize method.
+assertEquals(String.prototype.normalize.length, 0);
+assertEquals(String.prototype.propertyIsEnumerable("normalize"), false);
// Common use case when searching for 'not very exact' match.
// These are examples of data one might encounter in real use.