Open Bug 958950 Opened 11 years ago Updated 2 years ago

IteratorResult object for completed generators not from same global as next()

Categories

(Core :: JavaScript Engine, defect)

defect

Tracking

()

REOPENED

People

(Reporter: anba, Unassigned)

References

(Blocks 1 open bug)

Details

When "25.3.3.1 GeneratorStart" creates the IteratorResult object, the generator's execution context was already removed from the execution context stack, that means that the CreateIterResultObject() call in 25.3.3.1, step 4g creates an object from the current running execution context. And that current running execution context is the execution context from the Generator.prototype.next() function. So the created IteratorResult object is from the same global/realm as the Generator.prototype.next() function. Note: IteratorResult objects created through `yield` are not the same global as the Generator.prototype.next() function, but instead from the same global as the generator function itself. Test case: --- js> o = newGlobal().eval("function*g(){ return 1 } g()") js> next = function*(){}().next js> next.call(o).constructor === Object Expected: true Actual: false ---
CCing probably-interested parties
Blocks: es6
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INACTIVE
Status: RESOLVED → REOPENED
Resolution: INACTIVE → ---
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.