Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: LayoutTests/fast/js/function-dot-arguments2.html

Issue 14195011: Removed WONTFIX tests (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <p></p>
2
3 <pre id="console"></pre>
4
5 <script>
6 function $(id)
7 {
8 return document.getElementById(id);
9 }
10
11 function log(s)
12 {
13 $("console").appendChild(document.createTextNode(s + "\n"));
14 }
15
16 function shouldBeNoEval(aDescription, a, b)
17 {
18 if (a === b) {
19 log("PASS: " + aDescription + " should be " + b + " and is.");
20 return;
21 }
22
23 log("FAIL: " + aDescription + " should be " + b + " but instead is " + a + " .");
24 }
25
26 if (window.testRunner)
27 testRunner.dumpAsText();
28
29 // eval should lazily create 'arguments'.
30 function f1() {
31 if (false)
32 return arguments;
33 return eval("arguments");
34 }
35 shouldBeNoEval("f1(1)[0]", f1(1)[0], 1);
36
37 // 'arguments' created by eval should be live.
38 function f2(x) {
39 var a = eval("arguments");
40 x = 0;
41 return a;
42 }
43 shouldBeNoEval("f2(1)[0]", f2(1)[0], 0);
44
45 // overwriting 'arguments' after lazily creating it should succeed.
46 function f3() {
47 var x = arguments;
48 var arguments = [0];
49 return arguments;
50 }
51 shouldBeNoEval("f3(1)[0]", f3(1)[0], 0);
52
53 // overwriting 'arguments' before lazily creating it should succeed.
54 function f4() {
55 var arguments = [0];
56 var x = arguments;
57 return arguments;
58 }
59 shouldBeNoEval("f4(1)[0]", f4(1)[0], 0);
60
61 // eval should access local, shared 'arguments'.
62 function f5() {
63 eval("arguments.x = 1");
64 return eval("arguments");
65 }
66 shouldBeNoEval("f5().x", f5().x, 1);
67
68 // accessing another function's .arguments should not accidentally overwrite you r own(!).
69 function f6() {
70 return g6(1);
71 }
72 function g6() {
73 f6.arguments;
74 return g6.arguments;
75 }
76 shouldBeNoEval("f6()[0]", f6()[0], 1);
77
78 // access to another function's .arguments should not produce a shared object.
79 function f7() {
80 return g7();
81 }
82 function g7() {
83 return f7.arguments === f7.arguments;
84 }
85 shouldBeNoEval("f7()", f7(), false);
86
87 // ...unless the other function uses 'arguments'.
88 function f8() {
89 arguments;
90 return g8();
91 }
92 function g8() {
93 return f7.arguments === f7.arguments;
94 }
95 shouldBeNoEval("f8()", f8(), true);
96 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698