Closed Bug 1225392 Opened 4 years ago Closed 4 years ago

WebIDL autogenerated iterators don't have an @@iterator property.

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox44 --- fixed
firefox45 --- fixed
b2g-v2.5 --- fixed

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(2 files)

They should.  See this spec bit:

  An iterator prototype object MUST also have a property whose name is the
  @@iterator symbol with attributes { [[Writable]]: true, [[Enumerable]]: false,
  [[Configurable]]: true } and whose value is a function object that behaves as
  follows when invoked:

      Return this.

Without this, doing something like:

  for (var x of iterable.entries()) {
  }

doesn't work.
Note that I think the spec is wrong: we should just inherit from %IteratorPrototype%.  Filed https://github.com/heycam/webidl/issues/75 and will implement that.

Kyle, do we need to backport to 44?
Flags: needinfo?(kyle)
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
(In reply to Boris Zbarsky [:bz] from comment #1)
> Note that I think the spec is wrong: we should just inherit from
> %IteratorPrototype%.  Filed https://github.com/heycam/webidl/issues/75 and
> will implement that.
> 
> Kyle, do we need to backport to 44?

Yeah we probably should.
Flags: needinfo?(kyle)
Attachment #8688280 - Flags: review?(kyle) → review+
Attachment #8688279 - Flags: review?(efaustbmo) → review+
Comment on attachment 8688279 [details] [diff] [review]
part 1.  Expose JSAPI for getting %IteratorPrototype%

Approval Request Comment
[Feature/regressing bug #]: Bug 1085293, sort of.
[User impact if declined]: Some web sites may not work correctly because they get
   non-iterable iterators.
[Describe test coverage new/current, TreeHerder]: Tests in next patch.
[Risks and why]: Low risk, I believe.  Just fixing a bug in a new feature we
   added.
[String/UUID change made/needed]: None.
Attachment #8688279 - Flags: approval-mozilla-aurora?
Attachment #8688280 - Flags: approval-mozilla-aurora?
https://hg.mozilla.org/mozilla-central/rev/0aff4d08702d
https://hg.mozilla.org/mozilla-central/rev/ff8e1e77c615
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
Comment on attachment 8688279 [details] [diff] [review]
part 1.  Expose JSAPI for getting %IteratorPrototype%

Seems like something we should be fixing in 44. Let's uplift to Aurora.
Attachment #8688279 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Ritu, mind approving the changeset that actually fixes the bug?
Flags: needinfo?(rkothari)
Comment on attachment 8688280 [details] [diff] [review]
part 2.  WebIDL autogenerated iterators should chain up to %IteratorPrototype%

I meant to a+ this too.
Attachment #8688280 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
(In reply to Boris Zbarsky [:bz] from comment #9)
> Ritu, mind approving the changeset that actually fixes the bug?

Done! Sorry not sure how I missed it.
Flags: needinfo?(rkothari)
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.