Skip to content

Commit

Permalink
Resolve yield * issues for Firefox < 45 (#278)
Browse files Browse the repository at this point in the history
* Detect when Firefox is trying to use the broken, alternative Iterator form and don't use it. Polyfill instead.

* Fix @@iterator function call for generators, so that the generator itself is returned.
  • Loading branch information
rayd authored and benjamn committed Apr 28, 2017
1 parent 2271c65 commit ea4de31
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/regenerator-runtime/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,15 @@

Gp[toStringTagSymbol] = "Generator";

// A Generator should always return itself as the iterator object when the
// @@iterator function is called on it. Some browsers' implementations of the
// iterator prototype chain incorrectly implement this, causing the Generator
// object to not be returned from this call. This ensures that doesn't happen.
// See https://github.com/facebook/regenerator/issues/274 for more details.
Gp[iteratorSymbol] = function() {
return this;
};

Gp.toString = function() {
return "[object Generator]";
};
Expand Down

0 comments on commit ea4de31

Please sign in to comment.