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

Side by Side Diff: test/mjsunit/harmony/generators-poisoned-properties.js

Issue 270133003: Poison .arguments and .caller for generator functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 7 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 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-generators
6
7 function test(f) {
8 var cdesc = Object.getOwnPropertyDescriptor(f, "caller");
9 var adesc = Object.getOwnPropertyDescriptor(f, "arguments");
10
11 assertFalse(cdesc.enumerable);
12 assertFalse(cdesc.configurable);
13
14 assertFalse(adesc.enumerable);
15 assertFalse(adesc.configurable);
16
17 assertSame(cdesc.get, cdesc.set);
18 assertSame(cdesc.get, adesc.get);
19 assertSame(cdesc.get, adesc.set);
20
21 assertTrue(cdesc.get instanceof Function);
22 assertEquals(0, cdesc.get.length);
23 assertThrows(cdesc.get, TypeError);
24
25 assertThrows(function() { return f.caller; }, TypeError);
26 assertThrows(function() { f.caller = 42; }, TypeError);
27 assertThrows(function() { return f.arguments; }, TypeError);
28 assertThrows(function() { f.arguments = 42; }, TypeError);
29 }
rossberg 2014/05/07 09:19:54 This should probably include tests to check the pr
30
31 function *sloppy() {}
32 function *strict() { "use strict"; }
33
34 test(sloppy);
35 test(strict);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698