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

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 + test262 exceptions 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
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());
+})();

Powered by Google App Engine
This is Rietveld 408576698