Skip to content

Commit

Permalink
[MERGE #5594 @sethbrenith] Update global toStringTag to match attribu…
Browse files Browse the repository at this point in the history
…tes from v8

Merge pull request #5594 from sethbrenith:user/sethb/global-tst-attrib

We saw failures in node-chakracore because it tries to reconfigure global[Symbol.toStringTag]. This change updates the attributes to match what v8 does.
  • Loading branch information
sethbrenith committed Aug 13, 2018
2 parents 294015c + 80bb9c5 commit 3ed6f86
Show file tree
Hide file tree
Showing 89 changed files with 307 additions and 41 deletions.
5 changes: 4 additions & 1 deletion lib/Runtime/Library/JavascriptLibrary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,7 +1142,10 @@ namespace Js
AddMember(globalObject, PropertyIds::Infinity, positiveInfinite, PropertyNone);
AddMember(globalObject, PropertyIds::undefined, undefinedValue, PropertyNone);
// Note: for global object, we need to set toStringTag to global like other engines (v8)
AddMember(globalObject, PropertyIds::_symbolToStringTag, scriptContext->GetPropertyString(PropertyIds::global) , PropertyNone);
if (globalObject->GetScriptContext()->GetConfig()->IsES6ToStringTagEnabled())
{
AddMember(globalObject, PropertyIds::_symbolToStringTag, scriptContext->GetPropertyString(PropertyIds::global), PropertyConfigurable | PropertyWritable | PropertyEnumerable);
}

// Note: Any global function added/removed/changed here should also be updated in JavascriptLibrary::ProfilerRegisterBuiltinFunctions
// so that the new functions show up in the profiler too.
Expand Down
4 changes: 4 additions & 0 deletions test/Debugger/JsDiagGetStackProperties.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"this": "Object {...}",
"{exception}": "number 1",
"locals": {
"Symbol.toStringTag": "string global",
"globalVar": "undefined undefined",
"FuncLevel1": "function <large string>",
"outerFunc1": "function <large string>"
Expand All @@ -12,6 +13,7 @@
"this": "Object {...}",
"{exception}": "Error Caught Error",
"locals": {
"Symbol.toStringTag": "string global",
"globalVar": "undefined undefined",
"FuncLevel1": "function <large string>",
"outerFunc1": "function <large string>"
Expand Down Expand Up @@ -44,6 +46,7 @@
"level1Var": "Object {...}"
},
"globals": {
"Symbol.toStringTag": "string global",
"globalVar": "Object {...}",
"FuncLevel1": "function <large string>",
"outerFunc1": "function <large string>"
Expand Down Expand Up @@ -97,6 +100,7 @@
}
},
"globals": {
"Symbol.toStringTag": "string global",
"globalVar": "Object {...}",
"FuncLevel1": "function <large string>",
"outerFunc1": "function <large string>"
Expand Down
1 change: 1 addition & 0 deletions test/Debugger/MultipleContextStack.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
"x": "undefined undefined"
},
"globals": {
"Symbol.toStringTag": "string global",
"script1": "Object {...}",
"script2": "Object {...}",
"Func2": "function <large string>",
Expand Down
1 change: 1 addition & 0 deletions test/DebuggerCommon/ES6_intl_simple_attach.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
}
},
"globals": {
"Symbol.toStringTag": "string global",
"x": "undefined undefined",
"Run": "function <large string>"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
},
"locals": {
"a": "number 1",
"b": "number 2"
"b": "number 2",
"Symbol.toStringTag": "string global"
},
"globals": {}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"Symbol.toStringTag": "string global"
},
"locals": {
"a": "number 1"
"a": "number 1",
"Symbol.toStringTag": "string global"
},
"globals": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"a": "number 1"
},
"globals": {
"Symbol.toStringTag": "string global",
"Run": "function <large string>"
}
},
Expand Down
5 changes: 5 additions & 0 deletions test/DebuggerCommon/ES6_letconst_for.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"this": "Object {...}",
"locals": {
"y": "number 1",
"Symbol.toStringTag": "string global",
"x": "number 1"
}
},
Expand All @@ -14,6 +15,7 @@
"locals": {
"z": "number 1",
"y": "number 1",
"Symbol.toStringTag": "string global",
"x": "number 1"
},
"globals": {}
Expand All @@ -22,6 +24,7 @@
"this": "Object {...}",
"locals": {
"y": "number 2",
"Symbol.toStringTag": "string global",
"x": "number 1"
}
},
Expand All @@ -33,6 +36,7 @@
"locals": {
"z": "number 1",
"y": "number 2",
"Symbol.toStringTag": "string global",
"x": "number 1"
},
"globals": {}
Expand All @@ -41,6 +45,7 @@
"this": "Object {...}",
"locals": {
"y": "number 3",
"Symbol.toStringTag": "string global",
"x": "number 1"
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/DebuggerCommon/ES6_letconst_forin.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
},
"locals": {
"y": "string x",
"Symbol.toStringTag": "string global",
"a": {
"#__proto__": "Object {...}",
"x": "number 2",
Expand All @@ -21,6 +22,7 @@
},
"locals": {
"y": "string y",
"Symbol.toStringTag": "string global",
"a": {
"#__proto__": "Object {...}",
"x": "number 2",
Expand Down
3 changes: 2 additions & 1 deletion test/DebuggerCommon/ES6_letconst_redcl.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
},
"locals": {
"a": "number 100",
"b": "number 200"
"b": "number 200",
"Symbol.toStringTag": "string global"
},
"globals": {}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"b": "number 2"
},
"globals": {
"Symbol.toStringTag": "string global",
"Run": "function <large string>"
}
},
Expand All @@ -34,6 +35,7 @@
}
},
"globals": {
"Symbol.toStringTag": "string global",
"Run": "function <large string>"
}
},
Expand All @@ -53,6 +55,7 @@
"a": "number 1"
},
"globals": {
"Symbol.toStringTag": "string global",
"Run": "function <large string>"
}
},
Expand All @@ -72,6 +75,7 @@
"b": "number 2"
},
"globals": {
"Symbol.toStringTag": "string global",
"Run": "function <large string>"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"z": "number 1"
},
"globals": {
"Symbol.toStringTag": "string global",
"callcount": "number 3",
"Call": "function <large string>",
"bar": "function <large string>",
Expand Down Expand Up @@ -47,6 +48,7 @@
"z": "number 2"
},
"globals": {
"Symbol.toStringTag": "string global",
"callcount": "number 3",
"Call": "function <large string>",
"bar": "function <large string>",
Expand Down
1 change: 1 addition & 0 deletions test/DebuggerCommon/ES6_proto_simple.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
},
"locals": {
"Symbol.toStringTag": "string global",
"a": {
"#__proto__": {
"constructor": "function <large string>",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
}
},
"locals": {
"Symbol.toStringTag": "string global",
"a": {
"#__proto__": {
"constructor": "function <large string>",
Expand Down
1 change: 1 addition & 0 deletions test/DebuggerCommon/ES6_spread.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
}
},
"globals": {
"Symbol.toStringTag": "string global",
"a": "Array [1,2,check]",
"bar": "function <large string>",
"foo": "function <large string>"
Expand Down
6 changes: 4 additions & 2 deletions test/DebuggerCommon/IntlInit.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"[Intl.getCanonicalLocales returned]": "Array [en-US]"
},
"locals": {
"x": "number 0"
"x": "number 0",
"Symbol.toStringTag": "string global"
}
},
{
Expand All @@ -14,7 +15,8 @@
"[Intl.getCanonicalLocales returned]": "Array [en-US]"
},
"locals": {
"x": "number 1"
"x": "number 1",
"Symbol.toStringTag": "string global"
}
}
]
4 changes: 4 additions & 0 deletions test/DebuggerCommon/JIT_localsAtNativeFrame1.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F1": "function <large string>",
"F2": "function <large string>",
"Run": "function <large string>"
Expand Down Expand Up @@ -116,6 +117,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F1": "function <large string>",
"F2": "function <large string>",
"Run": "function <large string>"
Expand Down Expand Up @@ -177,6 +179,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F1": "function <large string>",
"F2": "function <large string>",
"Run": "function <large string>"
Expand Down Expand Up @@ -238,6 +241,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F1": "function <large string>",
"F2": "function <large string>",
"Run": "function <large string>"
Expand Down
20 changes: 12 additions & 8 deletions test/DebuggerCommon/JIT_localsAtNativeFrame2.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@
"this": "Object {...}",
"arguments": "Object {...}",
"locals": {
"F5_1": "function <large string>",
"x": "number 20",
"y": "Object {...}",
"t1": "number 22.2"
"t1": "number 22.2",
"F5_1": "function <large string>"
}
},
{
Expand Down Expand Up @@ -160,6 +160,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F2": "function <large string>",
"F3": "function <large string>",
"F5": "function <large string>",
Expand Down Expand Up @@ -332,10 +333,10 @@
"this": "Object {...}",
"arguments": "Object {...}",
"locals": {
"F5_1": "function <large string>",
"x": "number 20",
"y": "Object {...}",
"t1": "number 22.2"
"t1": "number 22.2",
"F5_1": "function <large string>"
}
},
{
Expand Down Expand Up @@ -408,6 +409,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F2": "function <large string>",
"F3": "function <large string>",
"F5": "function <large string>",
Expand Down Expand Up @@ -580,10 +582,10 @@
"this": "Object {...}",
"arguments": "Object {...}",
"locals": {
"F5_1": "function <large string>",
"x": "number 20",
"y": "Object {...}",
"t1": "number 22.2"
"t1": "number 22.2",
"F5_1": "function <large string>"
}
},
{
Expand Down Expand Up @@ -656,6 +658,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F2": "function <large string>",
"F3": "function <large string>",
"F5": "function <large string>",
Expand Down Expand Up @@ -828,10 +831,10 @@
"this": "Object {...}",
"arguments": "Object {...}",
"locals": {
"F5_1": "function <large string>",
"x": "number 20",
"y": "Object {...}",
"t1": "number 22.2"
"t1": "number 22.2",
"F5_1": "function <large string>"
}
},
{
Expand Down Expand Up @@ -904,6 +907,7 @@
{
"this": "Object {...}",
"locals": {
"Symbol.toStringTag": "string global",
"F2": "function <large string>",
"F3": "function <large string>",
"F5": "function <large string>",
Expand Down
1 change: 1 addition & 0 deletions test/DebuggerCommon/ObjLit_step_into_out.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
}
},
"globals": {
"Symbol.toStringTag": "string global",
"a1": "number 10",
"foo": "function <large string>",
"sub_expression_step_into": "function <large string>"
Expand Down
1 change: 1 addition & 0 deletions test/DebuggerCommon/ObjLit_step_over.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
}
},
"globals": {
"Symbol.toStringTag": "string global",
"a1": "number 10",
"foo": "function <large string>",
"sub_expression_step_over": "function <large string>"
Expand Down
1 change: 1 addition & 0 deletions test/DebuggerCommon/argument_disp.js.dbg.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"a": "string Hello"
},
"globals": {
"Symbol.toStringTag": "string global",
"F1": "function <large string>",
"F2": "function <large string>"
}
Expand Down
Loading

0 comments on commit 3ed6f86

Please sign in to comment.