Skip to content

Commit 9456152

Browse files
committed
[MERGE #5407 @MSLaguana] Enable es6 prototype chain by default
We want to enable the `-Es6PrototypeChain` flag by default to support the spec better. Most of this PR is updating test baselines. Fixes #5065
2 parents d180cd3 + 82fad63 commit 9456152

22 files changed

+119
-143
lines changed

lib/Common/ConfigFlagsList.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -628,12 +628,16 @@ PHASE(All)
628628
#define DEFAULT_CONFIG_ES6String (true)
629629
#define DEFAULT_CONFIG_ES6StringPrototypeFixes (true)
630630
#define DEFAULT_CONFIG_ES2018ObjectRestSpread (false)
631+
632+
#ifndef DEFAULT_CONFIG_ES6PrototypeChain
631633
#ifdef COMPILE_DISABLE_ES6PrototypeChain
632634
// If ES6PrototypeChain needs to be disabled by compile flag, DEFAULT_CONFIG_ES6PrototypeChain should be false
633635
#define DEFAULT_CONFIG_ES6PrototypeChain (false)
634636
#else
635-
#define DEFAULT_CONFIG_ES6PrototypeChain (false)
637+
#define DEFAULT_CONFIG_ES6PrototypeChain (true)
638+
#endif
636639
#endif
640+
637641
#define DEFAULT_CONFIG_ES6ToPrimitive (true)
638642
#define DEFAULT_CONFIG_ES6ToLength (true)
639643
#define DEFAULT_CONFIG_ES6ToStringTag (true)
@@ -1126,10 +1130,7 @@ FLAGPR (Boolean, ES6, ES6String , "Enable ES6 String exte
11261130
FLAGPR (Boolean, ES6, ES6StringPrototypeFixes, "Enable ES6 String.prototype fixes" , DEFAULT_CONFIG_ES6StringPrototypeFixes)
11271131
FLAGPR (Boolean, ES6, ES2018ObjectRestSpread , "Enable ES2018 Object Rest/Spread" , DEFAULT_CONFIG_ES2018ObjectRestSpread)
11281132

1129-
#ifndef COMPILE_DISABLE_ES6PrototypeChain
1130-
#define COMPILE_DISABLE_ES6PrototypeChain 0
1131-
#endif
1132-
FLAGPR_REGOVR_EXP(Boolean, ES6, ES6PrototypeChain , "Enable ES6 prototypes (Example: Date prototype is object)", DEFAULT_CONFIG_ES6PrototypeChain)
1133+
FLAGPR (Boolean, ES6, ES6PrototypeChain , "Enable ES6 prototypes (Example: Date prototype is object)", DEFAULT_CONFIG_ES6PrototypeChain)
11331134
FLAGPR (Boolean, ES6, ES6ToPrimitive , "Enable ES6 ToPrimitive symbol" , DEFAULT_CONFIG_ES6ToPrimitive)
11341135
FLAGPR (Boolean, ES6, ES6ToLength , "Enable ES6 ToLength fixes" , DEFAULT_CONFIG_ES6ToLength)
11351136
FLAGPR (Boolean, ES6, ES6ToStringTag , "Enable ES6 ToStringTag symbol" , DEFAULT_CONFIG_ES6ToStringTag)

test/Date/DateGetSet.baseline

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,3 @@ toUTCString : Fri, 26 Jul 35816 03:06:07 GMT
8484
valueOf : 1068094436767008
8585
toISOString method : function
8686
toJSON method : function
87-
1905
88-
1904
89-
0
90-
1999
91-
1998
92-
5

test/Date/DateGetSet.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -183,14 +183,11 @@ WScript.Echo("valueOf : " + d.valueOf())
183183
WScript.Echo("toISOString method : " + typeof d.toISOString);
184184
WScript.Echo("toJSON method : " + typeof d.toJSON);
185185

186-
// Set fullYear/fullYear+month/year on the Date prototype
187-
Date.prototype.setYear(5); // Year
188-
WScript.Echo(Date.prototype.getFullYear());
189-
Date.prototype.setYear(4, 4); // Year, month -- month should be ignored
190-
WScript.Echo(Date.prototype.getFullYear());
191-
WScript.Echo(Date.prototype.getMonth());
192-
Date.prototype.setFullYear(1999); // Only full year
193-
WScript.Echo(Date.prototype.getFullYear());
194-
Date.prototype.setFullYear(1998, 5); // Full year and month
195-
WScript.Echo(Date.prototype.getFullYear());
196-
WScript.Echo(Date.prototype.getMonth());
186+
WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js", "self");
187+
188+
assert.throws(() => Date.prototype.setYear(5), TypeError);
189+
assert.throws(() => Date.prototype.getFullYear(), TypeError);
190+
assert.throws(() => Date.prototype.setYear(4, 4), TypeError);
191+
assert.throws(() => Date.prototype.getMonth(), TypeError);
192+
assert.throws(() => Date.prototype.setFullYear(1999), TypeError);
193+
assert.throws(() => Date.prototype.setFullYear(1998, 5), TypeError);

test/Debugger/JsrtDebugUtilsAddPropertyType.js.dbg.baseline

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@
3434
"a14": {
3535
"#__proto__": "function <large string>",
3636
"prototype": "Object {...}",
37+
"length": "number 0",
3738
"name": "string func",
3839
"caller": "object null",
39-
"arguments": "object null",
40-
"length": "number 0"
40+
"arguments": "object null"
4141
},
4242
"a15": {
4343
"#__proto__": "Array []",
@@ -61,7 +61,7 @@
6161
"#__proto__": "Object {...}"
6262
},
6363
"a19": {
64-
"#__proto__": "RegExp ",
64+
"#__proto__": "Object {...}",
6565
"lastIndex": "number 0",
6666
"global": "boolean false",
6767
"multiline": "boolean false",
@@ -73,13 +73,13 @@
7373
"sticky": "boolean false"
7474
},
7575
"a20": {
76-
"#__proto__": "Error ",
76+
"#__proto__": "Object {...}",
7777
"description": "string Hello World!",
7878
"message": "string Hello World!",
7979
"stack": "string <large string>"
8080
},
8181
"a21": {
82-
"#__proto__": "Error ",
82+
"#__proto__": "Object {...}",
8383
"message": "string Hello World!",
8484
"stack": "string <large string>"
8585
},

test/DebuggerCommon/ES6_RegExp_specialproperties_all.js.dbg.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"evaluate": {
44
"r": {
5-
"#__proto__": "RegExp ",
5+
"#__proto__": "Object {...}",
66
"lastIndex": "number 0",
77
"global": "boolean false",
88
"multiline": "boolean false",

test/DebuggerCommon/ES6_RegExp_specialproperties_default.js.dbg.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"evaluate": {
44
"r": {
5-
"#__proto__": "RegExp ",
5+
"#__proto__": "Object {...}",
66
"lastIndex": "number 0",
77
"global": "boolean false",
88
"multiline": "boolean false",

test/DebuggerCommon/ES6_RegExp_specialproperties_with_sticky.js.dbg.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"evaluate": {
44
"r": {
5-
"#__proto__": "RegExp ",
5+
"#__proto__": "Object {...}",
66
"lastIndex": "number 0",
77
"global": "boolean false",
88
"multiline": "boolean false",

test/DebuggerCommon/ES6_RegExp_specialproperties_with_unicode.js.dbg.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{
33
"evaluate": {
44
"r": {
5-
"#__proto__": "RegExp ",
5+
"#__proto__": "Object {...}",
66
"lastIndex": "number 0",
77
"global": "boolean false",
88
"multiline": "boolean false",

test/DebuggerCommon/ES6_letconst_trycatch_simple_fast.js.dbg.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
},
4141
"locals": {
4242
"e": {
43-
"#__proto__": "Error ",
43+
"#__proto__": "Object {...}",
4444
"number": "number 0",
4545
"description": "string ",
4646
"stack": "string <large string>"

test/DebuggerCommon/attachWithDeferParse.js.dbg.baseline

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,18 +41,18 @@
4141
"f1": {
4242
"#__proto__": "function <large string>",
4343
"prototype": "Object {...}",
44+
"length": "number 0",
4445
"name": "string f1",
4546
"caller": "object null",
46-
"arguments": "object null",
47-
"length": "number 0"
47+
"arguments": "object null"
4848
},
4949
"g": {
5050
"#__proto__": "function <large string>",
5151
"prototype": "Object {...}",
52+
"length": "number 0",
5253
"name": "string g",
5354
"caller": "object null",
54-
"arguments": "object null",
55-
"length": "number 0"
55+
"arguments": "object null"
5656
}
5757
},
5858
"globals": {
@@ -75,7 +75,7 @@
7575
},
7676
"locals": {
7777
"t": {
78-
"#__proto__": "Error ",
78+
"#__proto__": "Object {...}",
7979
"message": "string <large string>",
8080
"description": "string <large string>",
8181
"number": "number -2146823279",
@@ -85,26 +85,26 @@
8585
"s": {
8686
"#__proto__": "function <large string>",
8787
"prototype": "Object {...}",
88+
"length": "number 2",
8889
"name": "string ",
8990
"caller": "object null",
90-
"arguments": "object null",
91-
"length": "number 2"
91+
"arguments": "object null"
9292
},
9393
"f1": {
9494
"#__proto__": "function <large string>",
9595
"prototype": "Object {...}",
96+
"length": "number 0",
9697
"name": "string f1",
9798
"caller": "object null",
98-
"arguments": "object null",
99-
"length": "number 0"
99+
"arguments": "object null"
100100
},
101101
"g": {
102102
"#__proto__": "function <large string>",
103103
"prototype": "Object {...}",
104+
"length": "number 0",
104105
"name": "string g",
105106
"caller": "object null",
106-
"arguments": "object null",
107-
"length": "number 0"
107+
"arguments": "object null"
108108
}
109109
},
110110
"globals": {

0 commit comments

Comments
 (0)