Closed
Bug 918075
Opened 11 years ago
Closed 11 years ago
Iteration of GeneratorObject user made is broken
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla27
People
(Reporter: teramako, Assigned: wingo)
References
Details
User Agent: Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 (Beta/Release) Build ID: 20130918030202 Steps to reproduce: function * gene() { for (var i = 0; i < 3; ++i) { yield i; } } for (var v of gene()) { console.log(v); } Actual results: Each 'v' variables are logged: [object Object]: { done: false, value: 0 } [object Object]: { done: false, value: 1 } [object Object]: { done: false, value: 2 } [object Object]: { done: true, value: undefined } And finally, an exception is occurred: TypeError: generator has already finished. Expected results: Each 'v' variables are should be logged: 0 1 2
Comment 1•11 years ago
|
||
Yeah, star_generator_next is just wrong about this. Looks like our iteration protocol stuff, internally, still needs a bit of cleanup/work to account for next on a closed star generator. (Might also be the case that the patchwork to fix this is in a bug but isn't landed yet; not sure offhand.)
Flags: needinfo?(wingo)
Comment 2•11 years ago
|
||
I believe star_generator_next is correct. But for-of is still using the old iteration protocol. for-of is getting the necessary upgrade in bug 907077. In the current ES6 draft, Generator.prototype.next calls GeneratorResume, which throws a TypeError in step 5 if the [[GeneratorState]] is not either "suspendedStart" or "suspendedYield". http://people.mozilla.org/~jorendorff/es6-draft.html#sec-25.4.3.2
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee | ||
Comment 3•11 years ago
|
||
As Jason says, this is fixed in bug 907077.
Flags: needinfo?(wingo)
It seems fixed by bug 907077 .
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WORKSFORME
Comment 5•11 years ago
|
||
We know what fixed it, so -> RESO FIXED. Thanks teramako!
Resolution: WORKSFORME → FIXED
Updated•11 years ago
|
Assignee: general → wingo
Target Milestone: --- → mozilla27
You need to log in
before you can comment on or make changes to this bug.
Description
•