Skip to content

Commit

Permalink
[MERGE #5407 @MSLaguana] Enable es6 prototype chain by default
Browse files Browse the repository at this point in the history
We want to enable the `-Es6PrototypeChain` flag by default to support the spec better. Most of this PR is updating test baselines.

Fixes #5065
  • Loading branch information
MSLaguana committed Sep 11, 2018
2 parents d180cd3 + 82fad63 commit 9456152
Show file tree
Hide file tree
Showing 22 changed files with 119 additions and 143 deletions.
11 changes: 6 additions & 5 deletions lib/Common/ConfigFlagsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -628,12 +628,16 @@ PHASE(All)
#define DEFAULT_CONFIG_ES6String (true)
#define DEFAULT_CONFIG_ES6StringPrototypeFixes (true)
#define DEFAULT_CONFIG_ES2018ObjectRestSpread (false)

#ifndef DEFAULT_CONFIG_ES6PrototypeChain
#ifdef COMPILE_DISABLE_ES6PrototypeChain
// If ES6PrototypeChain needs to be disabled by compile flag, DEFAULT_CONFIG_ES6PrototypeChain should be false
#define DEFAULT_CONFIG_ES6PrototypeChain (false)
#else
#define DEFAULT_CONFIG_ES6PrototypeChain (false)
#define DEFAULT_CONFIG_ES6PrototypeChain (true)
#endif
#endif

#define DEFAULT_CONFIG_ES6ToPrimitive (true)
#define DEFAULT_CONFIG_ES6ToLength (true)
#define DEFAULT_CONFIG_ES6ToStringTag (true)
Expand Down Expand Up @@ -1126,10 +1130,7 @@ FLAGPR (Boolean, ES6, ES6String , "Enable ES6 String exte
FLAGPR (Boolean, ES6, ES6StringPrototypeFixes, "Enable ES6 String.prototype fixes" , DEFAULT_CONFIG_ES6StringPrototypeFixes)
FLAGPR (Boolean, ES6, ES2018ObjectRestSpread , "Enable ES2018 Object Rest/Spread" , DEFAULT_CONFIG_ES2018ObjectRestSpread)

#ifndef COMPILE_DISABLE_ES6PrototypeChain
#define COMPILE_DISABLE_ES6PrototypeChain 0
#endif
FLAGPR_REGOVR_EXP(Boolean, ES6, ES6PrototypeChain , "Enable ES6 prototypes (Example: Date prototype is object)", DEFAULT_CONFIG_ES6PrototypeChain)
FLAGPR (Boolean, ES6, ES6PrototypeChain , "Enable ES6 prototypes (Example: Date prototype is object)", DEFAULT_CONFIG_ES6PrototypeChain)
FLAGPR (Boolean, ES6, ES6ToPrimitive , "Enable ES6 ToPrimitive symbol" , DEFAULT_CONFIG_ES6ToPrimitive)
FLAGPR (Boolean, ES6, ES6ToLength , "Enable ES6 ToLength fixes" , DEFAULT_CONFIG_ES6ToLength)
FLAGPR (Boolean, ES6, ES6ToStringTag , "Enable ES6 ToStringTag symbol" , DEFAULT_CONFIG_ES6ToStringTag)
Expand Down
6 changes: 0 additions & 6 deletions test/Date/DateGetSet.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,3 @@ toUTCString : Fri, 26 Jul 35816 03:06:07 GMT
valueOf : 1068094436767008
toISOString method : function
toJSON method : function
1905
1904
0
1999
1998
5
19 changes: 8 additions & 11 deletions test/Date/DateGetSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,11 @@ WScript.Echo("valueOf : " + d.valueOf())
WScript.Echo("toISOString method : " + typeof d.toISOString);
WScript.Echo("toJSON method : " + typeof d.toJSON);

// Set fullYear/fullYear+month/year on the Date prototype
Date.prototype.setYear(5); // Year
WScript.Echo(Date.prototype.getFullYear());
Date.prototype.setYear(4, 4); // Year, month -- month should be ignored
WScript.Echo(Date.prototype.getFullYear());
WScript.Echo(Date.prototype.getMonth());
Date.prototype.setFullYear(1999); // Only full year
WScript.Echo(Date.prototype.getFullYear());
Date.prototype.setFullYear(1998, 5); // Full year and month
WScript.Echo(Date.prototype.getFullYear());
WScript.Echo(Date.prototype.getMonth());
WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js", "self");

assert.throws(() => Date.prototype.setYear(5), TypeError);
assert.throws(() => Date.prototype.getFullYear(), TypeError);
assert.throws(() => Date.prototype.setYear(4, 4), TypeError);
assert.throws(() => Date.prototype.getMonth(), TypeError);
assert.throws(() => Date.prototype.setFullYear(1999), TypeError);
assert.throws(() => Date.prototype.setFullYear(1998, 5), TypeError);
10 changes: 5 additions & 5 deletions test/Debugger/JsrtDebugUtilsAddPropertyType.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
"a14": {
"#__proto__": "function <large string>",
"prototype": "Object {...}",
"length": "number 0",
"name": "string func",
"caller": "object null",
"arguments": "object null",
"length": "number 0"
"arguments": "object null"
},
"a15": {
"#__proto__": "Array []",
Expand All @@ -61,7 +61,7 @@
"#__proto__": "Object {...}"
},
"a19": {
"#__proto__": "RegExp ",
"#__proto__": "Object {...}",
"lastIndex": "number 0",
"global": "boolean false",
"multiline": "boolean false",
Expand All @@ -73,13 +73,13 @@
"sticky": "boolean false"
},
"a20": {
"#__proto__": "Error ",
"#__proto__": "Object {...}",
"description": "string Hello World!",
"message": "string Hello World!",
"stack": "string <large string>"
},
"a21": {
"#__proto__": "Error ",
"#__proto__": "Object {...}",
"message": "string Hello World!",
"stack": "string <large string>"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"evaluate": {
"r": {
"#__proto__": "RegExp ",
"#__proto__": "Object {...}",
"lastIndex": "number 0",
"global": "boolean false",
"multiline": "boolean false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"evaluate": {
"r": {
"#__proto__": "RegExp ",
"#__proto__": "Object {...}",
"lastIndex": "number 0",
"global": "boolean false",
"multiline": "boolean false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"evaluate": {
"r": {
"#__proto__": "RegExp ",
"#__proto__": "Object {...}",
"lastIndex": "number 0",
"global": "boolean false",
"multiline": "boolean false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{
"evaluate": {
"r": {
"#__proto__": "RegExp ",
"#__proto__": "Object {...}",
"lastIndex": "number 0",
"global": "boolean false",
"multiline": "boolean false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
},
"locals": {
"e": {
"#__proto__": "Error ",
"#__proto__": "Object {...}",
"number": "number 0",
"description": "string ",
"stack": "string <large string>"
Expand Down
22 changes: 11 additions & 11 deletions test/DebuggerCommon/attachWithDeferParse.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
"f1": {
"#__proto__": "function <large string>",
"prototype": "Object {...}",
"length": "number 0",
"name": "string f1",
"caller": "object null",
"arguments": "object null",
"length": "number 0"
"arguments": "object null"
},
"g": {
"#__proto__": "function <large string>",
"prototype": "Object {...}",
"length": "number 0",
"name": "string g",
"caller": "object null",
"arguments": "object null",
"length": "number 0"
"arguments": "object null"
}
},
"globals": {
Expand All @@ -75,7 +75,7 @@
},
"locals": {
"t": {
"#__proto__": "Error ",
"#__proto__": "Object {...}",
"message": "string <large string>",
"description": "string <large string>",
"number": "number -2146823279",
Expand All @@ -85,26 +85,26 @@
"s": {
"#__proto__": "function <large string>",
"prototype": "Object {...}",
"length": "number 2",
"name": "string ",
"caller": "object null",
"arguments": "object null",
"length": "number 2"
"arguments": "object null"
},
"f1": {
"#__proto__": "function <large string>",
"prototype": "Object {...}",
"length": "number 0",
"name": "string f1",
"caller": "object null",
"arguments": "object null",
"length": "number 0"
"arguments": "object null"
},
"g": {
"#__proto__": "function <large string>",
"prototype": "Object {...}",
"length": "number 0",
"name": "string g",
"caller": "object null",
"arguments": "object null",
"length": "number 0"
"arguments": "object null"
}
},
"globals": {
Expand Down
8 changes: 4 additions & 4 deletions test/DebuggerCommon/bug_543550.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"name": "string set"
},
"size": {
"#__proto__": "Error ",
"#__proto__": "Object {...}",
"message": "string Map.prototype.size: 'this' is not a Map object",
"description": "string Map.prototype.size: 'this' is not a Map object",
"number": "number -2146823172",
Expand Down Expand Up @@ -104,9 +104,9 @@
"#__proto__": "Object {...}",
"constructor": "function function bar() {\r\n\t}"
},
"name": "string bar",
"length": "number 0"
"length": "number 0",
"name": "string bar"
}
}
}
]
]
Loading

0 comments on commit 9456152

Please sign in to comment.