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

Side by Side Diff: test/mjsunit/harmony/collections.js

Issue 9074003: Fix handling of bogus receivers for Harmony collections. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 11 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
« no previous file with comments | « src/macros.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 assertEquals(undefined, o.set); 267 assertEquals(undefined, o.set);
268 var o = Object.create({}, { myValue: { 268 var o = Object.create({}, { myValue: {
269 value: 10, 269 value: 10,
270 enumerable: false, 270 enumerable: false,
271 configurable: true, 271 configurable: true,
272 writable: true 272 writable: true
273 }}); 273 }});
274 assertEquals(10, o.myValue); 274 assertEquals(10, o.myValue);
275 275
276 276
277 // Regression test for issue 1884: Invoking any of the methods for Harmony
278 // maps, sets, or weak maps, with a wrong type of receiver should be throwing
279 // a proper TypeError.
280 function TestBogusReceivers(func) {
281 assertThrows(function () { func.call(undefined, {}) }, TypeError);
282 assertThrows(function () { func.call(null, {}) }, TypeError);
283 assertThrows(function () { func.call(true, {}) }, TypeError);
284 assertThrows(function () { func.call("x", {}) }, TypeError);
285 assertThrows(function () { func.call(23, {}) }, TypeError);
286 assertThrows(function () { func.call({}, {}) }, TypeError);
rossberg 2012/01/04 10:07:00 Particularly interesting cases would be variations
Michael Starzinger 2012/01/05 10:40:09 Done. I generalized the regression test a bit.
287 }
288 TestBogusReceivers(Set.prototype.add);
289 TestBogusReceivers(Set.prototype.has);
290 TestBogusReceivers(Set.prototype.delete);
291 TestBogusReceivers(Map.prototype.get);
292 TestBogusReceivers(Map.prototype.set);
293 TestBogusReceivers(Map.prototype.has);
294 TestBogusReceivers(Map.prototype.delete);
295 TestBogusReceivers(WeakMap.prototype.get);
296 TestBogusReceivers(WeakMap.prototype.set);
297 TestBogusReceivers(WeakMap.prototype.has);
298 TestBogusReceivers(WeakMap.prototype.delete);
299
300
277 // Stress Test 301 // Stress Test
278 // There is a proposed stress-test available at the es-discuss mailing list 302 // There is a proposed stress-test available at the es-discuss mailing list
279 // which cannot be reasonably automated. Check it out by hand if you like: 303 // which cannot be reasonably automated. Check it out by hand if you like:
280 // https://mail.mozilla.org/pipermail/es-discuss/2011-May/014096.html 304 // https://mail.mozilla.org/pipermail/es-discuss/2011-May/014096.html
OLDNEW
« no previous file with comments | « src/macros.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698