/
784358.doctest
executable file
·94 lines (92 loc) · 2.66 KB
/
784358.doctest
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// https://bugzilla.mozilla.org/show_bug.cgi?id=784358
js> var v1=1
js> v1
1
js> eval("var v2=1")
js> v2
1
js> const c1=1
js> c1
1
js> eval("const c2=1")
js> c2
1
js> try {eval("const v1=2")}catch(e){e instanceof TypeError}
true
js> try {eval("const v1=2")}catch(e){e instanceof TypeError}
true
js> try{eval("const c1=1")}catch(e){e instanceof TypeError}
true
js> try{eval("const c2=1")}catch(e){e instanceof TypeError}
true
js> try{eval("var c1=1")}catch(e){e instanceof TypeError}
true
js> try{eval("var c2=1")}catch(e){e instanceof TypeError}
true
js> try {(1,eval)("const v1=2")}catch(e){e instanceof TypeError}
true
js> try {(1,eval)("const v1=2")}catch(e){e instanceof TypeError}
true
js> try{(1,eval)("const c1=1")}catch(e){e instanceof TypeError}
true
js> try{(1,eval)("const c2=1")}catch(e){e instanceof TypeError}
true
js> try{(1,eval)("var c1=1")}catch(e){e instanceof TypeError}
true
js> try{(1,eval)("var c2=1")}catch(e){e instanceof TypeError}
true
js> (function(){eval("const v1=2"); return v1})()
2
js> (function(){eval("const v2=2"); return v2})()
2
js> (function(){eval("const c1=2"); return c1})()
2
js> (function(){eval("const c2=2"); return c2})()
2
js> (function(){eval("var c1=2"); return c1})()
2
js> (function(){eval("var c2=2"); return c2})()
2
js> try{ (function(){(1,eval)("const v1=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){(1,eval)("const v2=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){(1,eval)("const c1=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){(1,eval)("const c2=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){(1,eval)("var c1=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){(1,eval)("var c2=1")})() }catch(e){e instanceof TypeError}
true
js> (v1 = 3, v1)
3
js> (v2 = 3, v2)
3
js> (c1 = 3, c1)
1
js> (c2 = 3, c2)
1
js> delete v1
false
js> delete v2
true
js> delete c1
false
js> delete c2
false
js> try{ (function(){const c1=1; eval("const c1=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){eval("const c1=1"); const c1=1})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){eval("const c1=1"); eval("const c1=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){const c1=1; eval("var c1=1")})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){eval("var c1=1"); const c1=1})() }catch(e){e instanceof TypeError}
true
js> try{ (function(){var c1=1; eval("const c1=1")})() }catch(e){e instanceof TypeError}
true