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

Unified Diff: test/mjsunit/es6/generators-poisoned-properties.js

Issue 1027283004: [es6] do not add caller/arguments to ES6 function definitions (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/es6/generators-runtime.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/generators-poisoned-properties.js
diff --git a/test/mjsunit/es6/generators-poisoned-properties.js b/test/mjsunit/es6/generators-poisoned-properties.js
index 44d823a50345f09a571cdf79f90fe5dd74d1e0ec..e8610220fc3cec9d7178c00a81a918cec05640e4 100644
--- a/test/mjsunit/es6/generators-poisoned-properties.js
+++ b/test/mjsunit/es6/generators-poisoned-properties.js
@@ -2,39 +2,41 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-function assertIteratorResult(value, done, result) {
- assertEquals({value: value, done: done}, result);
-}
-
-function test(f) {
- var cdesc = Object.getOwnPropertyDescriptor(f, "caller");
- var adesc = Object.getOwnPropertyDescriptor(f, "arguments");
+(function testRestrictedPropertiesStrict() {
+ function* generator() { "use strict"; }
+ assertFalse(generator.hasOwnProperty("arguments"));
+ assertThrows(function() { return generator.arguments; }, TypeError);
+ assertThrows(function() { return generator.arguments = {}; }, TypeError);
- assertFalse(cdesc.enumerable);
- assertFalse(cdesc.configurable);
+ assertFalse(generator.hasOwnProperty("caller"));
+ assertThrows(function() { return generator.caller; }, TypeError);
+ assertThrows(function() { return generator.caller = {}; }, TypeError);
+})();
- assertFalse(adesc.enumerable);
- assertFalse(adesc.configurable);
- assertSame(cdesc.get, cdesc.set);
- assertSame(cdesc.get, adesc.get);
- assertSame(cdesc.get, adesc.set);
+(function testRestrictedPropertiesSloppy() {
+ function* generator() {}
+ assertFalse(generator.hasOwnProperty("arguments"));
+ assertThrows(function() { return generator.arguments; }, TypeError);
+ assertThrows(function() { return generator.arguments = {}; }, TypeError);
- assertTrue(cdesc.get instanceof Function);
- assertEquals(0, cdesc.get.length);
- assertThrows(cdesc.get, TypeError);
+ assertFalse(generator.hasOwnProperty("caller"));
+ assertThrows(function() { return generator.caller; }, TypeError);
+ assertThrows(function() { return generator.caller = {}; }, TypeError);
+})();
- assertThrows(function() { return f.caller; }, TypeError);
- assertThrows(function() { f.caller = 42; }, TypeError);
- assertThrows(function() { return f.arguments; }, TypeError);
- assertThrows(function() { f.arguments = 42; }, TypeError);
+function assertIteratorResult(value, done, result) {
+ assertEquals({value: value, done: done}, result);
}
-function *sloppy() { test(sloppy); }
-function *strict() { "use strict"; test(strict); }
-test(sloppy);
-test(strict);
+(function testIteratorResultStrict() {
+ function* generator() { "use strict"; }
+ assertIteratorResult(undefined, true, generator().next());
+})();
+
-assertIteratorResult(undefined, true, sloppy().next());
-assertIteratorResult(undefined, true, strict().next());
+(function testIteratorResultSloppy() {
+ function* generator() {}
+ assertIteratorResult(undefined, true, generator().next());
+})();
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/es6/generators-runtime.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698