Commit fa9c39ee authored by caitpotter88's avatar caitpotter88 Committed by Commit bot

[Intl] create new instances when new.target is undefined

BUG=v8:4360
LOG=N
R=littledan@chromium.org

Review URL: https://codereview.chromium.org/1440593003

Cr-Commit-Position: refs/heads/master@{#31971}
parent ccae6b51
......@@ -947,19 +947,16 @@ function initializeCollator(collator, locales, options) {
*
* @constructor
*/
%AddNamedProperty(Intl, 'Collator', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
function Collator() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
if (!this || this === Intl) {
// Constructor is called as a function.
return new Intl.Collator(locales, options);
}
if (IS_UNDEFINED(new.target)) return new Collator(locales, options);
return initializeCollator(TO_OBJECT(this), locales, options);
},
DONT_ENUM
);
return initializeCollator(this, locales, options);
}
%AddNamedProperty(Intl, 'Collator', Collator, DONT_ENUM);
/**
......@@ -1189,19 +1186,15 @@ function initializeNumberFormat(numberFormat, locales, options) {
*
* @constructor
*/
%AddNamedProperty(Intl, 'NumberFormat', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
function NumberFormat() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
if (!this || this === Intl) {
// Constructor is called as a function.
return new Intl.NumberFormat(locales, options);
}
if (IS_UNDEFINED(new.target)) return new NumberFormat(locales, options);
return initializeNumberFormat(TO_OBJECT(this), locales, options);
},
DONT_ENUM
);
return initializeNumberFormat(this, locales, options);
}
%AddNamedProperty(Intl, 'NumberFormat', NumberFormat, DONT_ENUM);
/**
......@@ -1591,19 +1584,15 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
*
* @constructor
*/
%AddNamedProperty(Intl, 'DateTimeFormat', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
function DateTimeFormat() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
if (!this || this === Intl) {
// Constructor is called as a function.
return new Intl.DateTimeFormat(locales, options);
}
if (IS_UNDEFINED(new.target)) return new DateTimeFormat(locales, options);
return initializeDateTimeFormat(TO_OBJECT(this), locales, options);
},
DONT_ENUM
);
return initializeDateTimeFormat(this, locales, options);
}
%AddNamedProperty(Intl, 'DateTimeFormat', DateTimeFormat, DONT_ENUM);
/**
......
......@@ -397,11 +397,6 @@
# https://code.google.com/p/v8/issues/detail?id=4346
'built-ins/RegExp/prototype/flags/u': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4360
'intl402/Collator/10.1.1_1': [FAIL],
'intl402/DateTimeFormat/12.1.1_1': [FAIL],
'intl402/NumberFormat/11.1.1_1': [FAIL],
# https://code.google.com/p/v8/issues/detail?id=4361
'intl402/Collator/10.1.1_a': [FAIL],
......@@ -522,7 +517,6 @@
'intl402/Date/prototype/13.3.0_7': [FAIL],
'intl402/DateTimeFormat/12.1.1': [FAIL],
'intl402/DateTimeFormat/12.1.1_a': [FAIL],
'intl402/DateTimeFormat/12.1.1_1': [FAIL],
'intl402/DateTimeFormat/12.1.2': [PASS, FAIL],
'intl402/DateTimeFormat/12.1.2.1_4': [FAIL],
'intl402/DateTimeFormat/12.2.3_b': [FAIL],
......
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