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

Side by Side Diff: LayoutTests/fast/js/script-tests/primitive-property-access-edge-cases.js

Issue 20867002: Remove old tests that have been migrated to the v8 repo. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove unused script-tests as well Created 7 years, 4 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 description(
2 "This page tests for assertion failures in edge cases of property lookup on prim itive values."
3 );
4
5 var didNotCrash = true;
6
7 (function () {
8 delete String.prototype.constructor;
9 for (var i = 0; i < 3; ++i)
10 "".replace;
11 })();
12
13 (function () {
14 String.prototype.__proto__ = { x: 1, y: 1 };
15 delete String.prototype.__proto__.x;
16 for (var i = 0; i < 3; ++i)
17 "".y;
18 })();
19
20 (function () {
21 function f(x) {
22 x.y;
23 }
24
25 String.prototype.x = 1;
26 String.prototype.y = 1;
27 delete String.prototype.x;
28
29 Number.prototype.x = 1;
30 Number.prototype.y = 1;
31 delete Number.prototype.x;
32
33 for (var i = 0; i < 3; ++i)
34 f("");
35
36 for (var i = 0; i < 3; ++i)
37 f(.5);
38 })();
39
40
41 var checkOkay;
42
43 function checkGet(x, constructor)
44 {
45 checkOkay = false;
46 Object.defineProperty(constructor.prototype, "foo", { get: function() { chec kOkay = typeof this === 'object'; }, configurable: true });
47 x.foo;
48 delete constructor.prototype.foo;
49 return checkOkay;
50 }
51
52 function checkSet(x, constructor)
53 {
54 checkOkay = false;
55 Object.defineProperty(constructor.prototype, "foo", { set: function() { chec kOkay = typeof this === 'object'; }, configurable: true });
56 x.foo = null;
57 delete constructor.prototype.foo;
58 return checkOkay;
59 }
60
61 function checkGetStrict(x, constructor)
62 {
63 checkOkay = false;
64 Object.defineProperty(constructor.prototype, "foo", { get: function() { "use strict"; checkOkay = typeof this !== 'object'; }, configurable: true });
65 x.foo;
66 delete constructor.prototype.foo;
67 return checkOkay;
68 }
69
70 function checkSetStrict(x, constructor)
71 {
72 checkOkay = false;
73 Object.defineProperty(constructor.prototype, "foo", { set: function() { "use strict"; checkOkay = typeof this !== 'object'; }, configurable: true });
74 x.foo = null;
75 delete constructor.prototype.foo;
76 return checkOkay;
77 }
78
79 shouldBeTrue("checkGet(1, Number)");
80 shouldBeTrue("checkGet('hello', String)");
81 shouldBeTrue("checkGet(true, Boolean)");
82 shouldBeTrue("checkSet(1, Number)");
83 shouldBeTrue("checkSet('hello', String)");
84 shouldBeTrue("checkSet(true, Boolean)");
85 shouldBeTrue("checkGetStrict(1, Number)");
86 shouldBeTrue("checkGetStrict('hello', String)");
87 shouldBeTrue("checkGetStrict(true, Boolean)");
88 shouldBeTrue("checkSetStrict(1, Number)");
89 shouldBeTrue("checkSetStrict('hello', String)");
90 shouldBeTrue("checkSetStrict(true, Boolean)");
91
92 function checkRead(x, constructor)
93 {
94 return x.foo === undefined;
95 }
96
97 function checkWrite(x, constructor)
98 {
99 x.foo = null;
100 return x.foo === undefined;
101 }
102
103 function checkReadStrict(x, constructor)
104 {
105 "use strict";
106 return x.foo === undefined;
107 }
108
109 function checkWriteStrict(x, constructor)
110 {
111 "use strict";
112 x.foo = null;
113 return x.foo === undefined;
114 }
115
116 shouldBeTrue("checkRead(1, Number)");
117 shouldBeTrue("checkRead('hello', String)");
118 shouldBeTrue("checkRead(true, Boolean)");
119 shouldBeTrue("checkWrite(1, Number)");
120 shouldBeTrue("checkWrite('hello', String)");
121 shouldBeTrue("checkWrite(true, Boolean)");
122 shouldBeTrue("checkReadStrict(1, Number)");
123 shouldBeTrue("checkReadStrict('hello', String)");
124 shouldBeTrue("checkReadStrict(true, Boolean)");
125 shouldThrow("checkWriteStrict(1, Number)");
126 shouldThrow("checkWriteStrict('hello', String)");
127 shouldThrow("checkWriteStrict(true, Boolean)");
128
129 function checkNumericGet(x, constructor)
130 {
131 checkOkay = false;
132 Object.defineProperty(constructor.prototype, 42, { get: function() { checkOk ay = typeof this === 'object'; }, configurable: true });
133 x[42];
134 delete constructor.prototype[42];
135 return checkOkay;
136 }
137
138 function checkNumericSet(x, constructor)
139 {
140 checkOkay = false;
141 Object.defineProperty(constructor.prototype, 42, { set: function() { checkOk ay = typeof this === 'object'; }, configurable: true });
142 x[42] = null;
143 delete constructor.prototype[42];
144 return checkOkay;
145 }
146
147 function checkNumericGetStrict(x, constructor)
148 {
149 checkOkay = false;
150 Object.defineProperty(constructor.prototype, 42, { get: function() { "use st rict"; checkOkay = typeof this !== 'object'; }, configurable: true });
151 x[42];
152 delete constructor.prototype[42];
153 return checkOkay;
154 }
155
156 function checkNumericSetStrict(x, constructor)
157 {
158 checkOkay = false;
159 Object.defineProperty(constructor.prototype, 42, { set: function() { "use st rict"; checkOkay = typeof this !== 'object'; }, configurable: true });
160 x[42] = null;
161 delete constructor.prototype[42];
162 return checkOkay;
163 }
164
165 shouldBeTrue("checkNumericGet(1, Number)");
166 shouldBeTrue("checkNumericGet('hello', String)");
167 shouldBeTrue("checkNumericGet(true, Boolean)");
168 shouldBeTrue("checkNumericSet(1, Number)");
169 shouldBeTrue("checkNumericSet('hello', String)");
170 shouldBeTrue("checkNumericSet(true, Boolean)");
171 shouldBeTrue("checkNumericGetStrict(1, Number)");
172 shouldBeTrue("checkNumericGetStrict('hello', String)");
173 shouldBeTrue("checkNumericGetStrict(true, Boolean)");
174 shouldBeTrue("checkNumericSetStrict(1, Number)");
175 shouldBeTrue("checkNumericSetStrict('hello', String)");
176 shouldBeTrue("checkNumericSetStrict(true, Boolean)");
177
178 function checkNumericRead(x, constructor)
179 {
180 return x[42] === undefined;
181 }
182
183 function checkNumericWrite(x, constructor)
184 {
185 x[42] = null;
186 return x[42] === undefined;
187 }
188
189 function checkNumericReadStrict(x, constructor)
190 {
191 "use strict";
192 return x[42] === undefined;
193 }
194
195 function checkNumericWriteStrict(x, constructor)
196 {
197 "use strict";
198 x[42] = null;
199 return x[42] === undefined;
200 }
201
202 shouldBeTrue("checkNumericRead(1, Number)");
203 shouldBeTrue("checkNumericRead('hello', String)");
204 shouldBeTrue("checkNumericRead(true, Boolean)");
205 shouldBeTrue("checkNumericWrite(1, Number)");
206 shouldBeTrue("checkNumericWrite('hello', String)");
207 shouldBeTrue("checkNumericWrite(true, Boolean)");
208 shouldBeTrue("checkNumericReadStrict(1, Number)");
209 shouldBeTrue("checkNumericReadStrict('hello', String)");
210 shouldBeTrue("checkNumericReadStrict(true, Boolean)");
211 shouldThrow("checkNumericWriteStrict(1, Number)");
212 shouldThrow("checkNumericWriteStrict('hello', String)");
213 shouldThrow("checkNumericWriteStrict(true, Boolean)");
214
215 shouldBeTrue("didNotCrash");
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/script-tests/parser-syntax-check.js ('k') | LayoutTests/fast/js/script-tests/read-modify-eval.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698