Commit 0a488160 authored by mike's avatar mike Committed by Commit bot

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}
parent 6e17f661
......@@ -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]);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment