Correct property descriptors on GeneratorPrototype

The ES6 specification does not explicitly state the attributes for the
'next' and 'throw' property descriptors, so their values are defined by
Section 17 [1]:

> Every other data property described in clauses 18 through 26 and in
> Annex B.2 has the attributes
> { [[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true }
> unless otherwise specified.

[1]
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-ecmascript-standard-built-in-objects

BUG=v8:3986
LOG=N
R=wingo,arv

Review URL: https://codereview.chromium.org/1051363003

Cr-Commit-Position: refs/heads/master@{#27770}
This commit is contained in:
mike 2015-04-11 14:14:19 -07:00 committed by Commit bot
parent 6e17f661c1
commit 0a4881600d
2 changed files with 23 additions and 2 deletions

View File

@ -89,7 +89,7 @@ function SetUpGenerators() {
// Set up non-enumerable functions on the generator prototype object.
var GeneratorObjectPrototype = GeneratorFunctionPrototype.prototype;
InstallFunctions(GeneratorObjectPrototype,
DONT_ENUM | DONT_DELETE | READ_ONLY,
DONT_ENUM,
["next", GeneratorObjectNext,
"throw", GeneratorObjectThrow]);

View File

@ -114,7 +114,28 @@ function TestGeneratorObjectPrototype() {
assertArrayEquals(expected_property_names, found_property_names);
iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
var constructor_desc = Object.getOwnPropertyDescriptor(
GeneratorObjectPrototype, "constructor");
assertTrue(constructor_desc !== undefined);
assertFalse(constructor_desc.writable);
assertFalse(constructor_desc.enumerable);
assertTrue(constructor_desc.configurable);
var next_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
"next");
assertTrue(next_desc !== undefined);
assertTrue(next_desc.writable);
assertFalse(next_desc.enumerable);
assertTrue(next_desc.configurable);
var throw_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
"throw");
assertTrue(next_desc !== undefined);
assertTrue(next_desc.writable);
assertFalse(next_desc.enumerable);
assertTrue(next_desc.configurable);
var iterator_desc = Object.getOwnPropertyDescriptor(GeneratorObjectPrototype,
Symbol.iterator);
assertTrue(iterator_desc !== undefined);
assertFalse(iterator_desc.writable);