| 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..cdbf641a72b248dba26a0d5ac71bc370bbce9365 100644
|
| --- a/test/mjsunit/es6/generators-poisoned-properties.js
|
| +++ b/test/mjsunit/es6/generators-poisoned-properties.js
|
| @@ -2,39 +2,36 @@
|
| // 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() {
|
| + "use strict";
|
| + assertFalse((function*() {}).hasOwnProperty("arguments"));
|
| + assertThrows(function() { return (function*() {}).arguments; }, TypeError);
|
|
|
| - assertFalse(cdesc.enumerable);
|
| - assertFalse(cdesc.configurable);
|
| + assertFalse((function*() {}).hasOwnProperty("caller"));
|
| + assertThrows(function() { return (function*() {}).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() {
|
| + assertFalse((function*() {}).hasOwnProperty("arguments"));
|
| + assertThrows(function() { return (function*() {}).arguments; }, TypeError);
|
|
|
| - assertTrue(cdesc.get instanceof Function);
|
| - assertEquals(0, cdesc.get.length);
|
| - assertThrows(cdesc.get, TypeError);
|
| + assertFalse((function*() {}).hasOwnProperty("caller"));
|
| + assertThrows(function() { return (function*() {}).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());
|
| +})();
|
|
|