Skip to content

Commit f5c33ac

Browse files
committed
[MERGE #5588 @duongnhn] fixes #5513 add toStringTag for global object
Merge pull request #5588 from duongnhn:user/duongn/global-object-tag-to-string - add toStringTag for global object to mach other engines. - recreate baseline files.
2 parents 361df65 + e906651 commit f5c33ac

File tree

81 files changed

+737
-528
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+737
-528
lines changed

lib/Runtime/Library/JavascriptLibrary.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,8 @@ namespace Js
11411141
AddMember(globalObject, PropertyIds::NaN, nan, PropertyNone);
11421142
AddMember(globalObject, PropertyIds::Infinity, positiveInfinite, PropertyNone);
11431143
AddMember(globalObject, PropertyIds::undefined, undefinedValue, PropertyNone);
1144+
// Note: for global object, we need to set toStringTag to global like other engines (v8)
1145+
AddMember(globalObject, PropertyIds::_symbolToStringTag, scriptContext->GetPropertyString(PropertyIds::global) , PropertyNone);
11441146

11451147
// Note: Any global function added/removed/changed here should also be updated in JavascriptLibrary::ProfilerRegisterBuiltinFunctions
11461148
// so that the new functions show up in the profiler too.

test/Basics/scopedaccessors.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ in nested setter2
77
11
88
test3: nested setter and setter from this
99
in nested setter3
10-
[object Object]
10+
[object global]
1111
12
1212
test4: closure and with
1313
in nested setter3

test/Debugger/JsDiagGetStackProperties.js.dbg.baseline

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,25 +3,26 @@
33
"this": "Object {...}",
44
"{exception}": "number 1",
55
"locals": {
6+
"globalVar": "undefined undefined",
67
"FuncLevel1": "function <large string>",
7-
"outerFunc1": "function <large string>",
8-
"globalVar": "undefined undefined"
8+
"outerFunc1": "function <large string>"
99
}
1010
},
1111
{
1212
"this": "Object {...}",
1313
"{exception}": "Error Caught Error",
1414
"locals": {
15+
"globalVar": "undefined undefined",
1516
"FuncLevel1": "function <large string>",
16-
"outerFunc1": "function <large string>",
17-
"globalVar": "undefined undefined"
17+
"outerFunc1": "function <large string>"
1818
}
1919
},
2020
{
2121
"this": {
22+
"Symbol.toStringTag": "string global",
23+
"globalVar": "Object {...}",
2224
"FuncLevel1": "function <large string>",
23-
"outerFunc1": "function <large string>",
24-
"globalVar": "Object {...}"
25+
"outerFunc1": "function <large string>"
2526
},
2627
"arguments": {
2728
"#__proto__": "Object {...}",
@@ -43,16 +44,17 @@
4344
"level1Var": "Object {...}"
4445
},
4546
"globals": {
47+
"globalVar": "Object {...}",
4648
"FuncLevel1": "function <large string>",
47-
"outerFunc1": "function <large string>",
48-
"globalVar": "Object {...}"
49+
"outerFunc1": "function <large string>"
4950
}
5051
},
5152
{
5253
"this": {
54+
"Symbol.toStringTag": "string global",
55+
"globalVar": "Object {...}",
5356
"FuncLevel1": "function <large string>",
54-
"outerFunc1": "function <large string>",
55-
"globalVar": "Object {...}"
57+
"outerFunc1": "function <large string>"
5658
},
5759
"arguments": {
5860
"#__proto__": "Object {...}",
@@ -95,9 +97,9 @@
9597
}
9698
},
9799
"globals": {
100+
"globalVar": "Object {...}",
98101
"FuncLevel1": "function <large string>",
99-
"outerFunc1": "function <large string>",
100-
"globalVar": "Object {...}"
102+
"outerFunc1": "function <large string>"
101103
}
102104
}
103105
]

test/Debugger/MultipleContextStack.js.dbg.baseline

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,12 @@
6565
},
6666
{
6767
"this": {
68+
"Symbol.toStringTag": "string global",
69+
"script1": "Object {...}",
70+
"script2": "Object {...}",
6871
"Func2": "function <large string>",
6972
"Func3": "function <large string>",
70-
"Func1": "function <large string>",
71-
"script1": "Object {...}",
72-
"script2": "Object {...}"
73+
"Func1": "function <large string>"
7374
},
7475
"arguments": {
7576
"#__proto__": "Object {...}",
@@ -81,11 +82,11 @@
8182
"x": "undefined undefined"
8283
},
8384
"globals": {
85+
"script1": "Object {...}",
86+
"script2": "Object {...}",
8487
"Func2": "function <large string>",
8588
"Func3": "function <large string>",
86-
"Func1": "function <large string>",
87-
"script1": "Object {...}",
88-
"script2": "Object {...}"
89+
"Func1": "function <large string>"
8990
}
9091
}
9192
]

test/DebuggerCommon/ES6_intl_simple_attach.js.dbg.baseline

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{
33
"this": {
4+
"Symbol.toStringTag": "string global",
45
"x": "undefined undefined",
56
"Run": "function <large string>"
67
},

test/DebuggerCommon/ES6_letconst_const_reassignment_globalscope.js.dbg.baseline

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[
22
{
3-
"this": {},
3+
"this": {
4+
"Symbol.toStringTag": "string global"
5+
},
46
"locals": {
57
"a": "number 1",
68
"b": "number 2"

test/DebuggerCommon/ES6_letconst_eval_nonstrict.js.dbg.baseline

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
[
22
{
3-
"this": {},
3+
"this": {
4+
"Symbol.toStringTag": "string global"
5+
},
46
"locals": {
57
"a": "number 1"
68
},

test/DebuggerCommon/ES6_letconst_eval_strict_fn.js.dbg.baseline

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{
33
"this": {
4+
"Symbol.toStringTag": "string global",
45
"Run": "function <large string>"
56
},
67
"locals": {
@@ -21,4 +22,4 @@
2122
"a": "number 1"
2223
}
2324
}
24-
]
25+
]

test/DebuggerCommon/ES6_letconst_for.js.dbg.baseline

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
{
1010
"this": {
11+
"Symbol.toStringTag": "string global",
1112
"x": "number 1"
1213
},
1314
"locals": {
@@ -26,6 +27,7 @@
2627
},
2728
{
2829
"this": {
30+
"Symbol.toStringTag": "string global",
2931
"x": "number 1"
3032
},
3133
"locals": {

test/DebuggerCommon/ES6_letconst_forin.js.dbg.baseline

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[
22
{
33
"this": {
4+
"Symbol.toStringTag": "string global",
45
"a": "Object {...}"
56
},
67
"locals": {
@@ -15,6 +16,7 @@
1516
},
1617
{
1718
"this": {
19+
"Symbol.toStringTag": "string global",
1820
"a": "Object {...}"
1921
},
2022
"locals": {

0 commit comments

Comments
 (0)