Commit 70177a81 authored by littledan's avatar littledan Committed by Commit bot

Revert of [Intl] create new instances when new.target is undefined (patchset...

Revert of [Intl] create new instances when new.target is undefined (patchset #2 id:20001 of https://codereview.chromium.org/1440593003/ )

Reason for revert:
This breaks backwards compatibility by disallowing call. Web application authors have noticed the breakage. https://github.com/tc39/ecma402/issues/57

Original issue's description:
> [Intl] create new instances when new.target is undefined
>
> BUG=v8:4360
> LOG=N
> R=littledan@chromium.org
>
> Committed: https://crrev.com/fa9c39eeadd8e692af03b024fe2fdcf94ad0da6b
> Cr-Commit-Position: refs/heads/master@{#31971}

TBR=caitpotter88@gmail.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:4360

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

Cr-Commit-Position: refs/heads/master@{#32189}
parent 2ea7f3c8
......@@ -947,16 +947,19 @@ function initializeCollator(collator, locales, options) {
*
* @constructor
*/
function Collator() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
if (IS_UNDEFINED(new.target)) return new Collator(locales, options);
%AddNamedProperty(Intl, 'Collator', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
return initializeCollator(this, locales, options);
}
if (!this || this === Intl) {
// Constructor is called as a function.
return new Intl.Collator(locales, options);
}
%AddNamedProperty(Intl, 'Collator', Collator, DONT_ENUM);
return initializeCollator(TO_OBJECT(this), locales, options);
},
DONT_ENUM
);
/**
......@@ -1186,15 +1189,19 @@ function initializeNumberFormat(numberFormat, locales, options) {
*
* @constructor
*/
function NumberFormat() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
%AddNamedProperty(Intl, 'NumberFormat', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
if (IS_UNDEFINED(new.target)) return new NumberFormat(locales, options);
if (!this || this === Intl) {
// Constructor is called as a function.
return new Intl.NumberFormat(locales, options);
}
return initializeNumberFormat(this, locales, options);
}
%AddNamedProperty(Intl, 'NumberFormat', NumberFormat, DONT_ENUM);
return initializeNumberFormat(TO_OBJECT(this), locales, options);
},
DONT_ENUM
);
/**
......@@ -1584,15 +1591,19 @@ function initializeDateTimeFormat(dateFormat, locales, options) {
*
* @constructor
*/
function DateTimeFormat() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
%AddNamedProperty(Intl, 'DateTimeFormat', function() {
var locales = %_Arguments(0);
var options = %_Arguments(1);
if (IS_UNDEFINED(new.target)) return new DateTimeFormat(locales, options);
if (!this || this === Intl) {
// Constructor is called as a function.
return new Intl.DateTimeFormat(locales, options);
}
return initializeDateTimeFormat(this, locales, options);
}
%AddNamedProperty(Intl, 'DateTimeFormat', DateTimeFormat, DONT_ENUM);
return initializeDateTimeFormat(TO_OBJECT(this), locales, options);
},
DONT_ENUM
);
/**
......
......@@ -358,6 +358,11 @@
# 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],
......@@ -403,6 +408,7 @@
'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