Intent to Ship: Iterable Array-like interfaces ("IterableCollections")

122 views
Skip to first unread message

Caitlin Potter

unread,
Mar 14, 2016, 12:50:48 PM3/14/16
to blink-dev

Contact emails

caitpo...@gmail.com


Spec

http://heycam.github.io/webidl/#es-iterators


Summary

This is a small WebIDL bindings feature, which adds a property named Symbol.iterator, with value %ArrayProto_values%[1], to any WebIDL interface with an integer-typed "length" attribute, and an indexed property getter.


This was originally implemented back in October, 2015, in https://codereview.chromium.org/1381413003, behind the RuntimeEnabledFlag "IterableCollections".


Removing this flag exposes the Symbol.iterator on the following interfaces:


CSSRuleList, CSSStyleDeclaration, ClientRectList, DOMStringList, DataTransferItemList, FileList, HTMLAllCollection, HTMLCollection, HTMLFormElement, HTMLOptionsCollection, HTMLSelectElement, MediaList, MimeTypeArray, NamedNodeMap, Plugin, PluginArray, SVGLengthList, SVGNumberList, SVGPointList, SVGStringList, SVGTransformList, SourceBufferList, Storage, StyleSheetList, TextTrackCueList, TextTrackList, TouchList, webkitSpeechGrammarList


In addition, it also exposes Symbol.iterator, and methods "forEach", "values", "keys", and "entries", on NodeList. These methods behave

similarly to how they do on ECMAScript Array objects.


Is this feature supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes


Interoperability and Compatibility Risk

This change is largely compatible with the implementation in Firefox 48 --- One exception is that Symbol.iterator is currently installed on Window, but a spec change has since made this invalid. The property being inserted on Window is in the process of being removed (and would be removed automatically if the indexed property getter were removed from Window, as it has been removed in the spec[2].


OWP launch tracking bug

This is currently being tracked at crbug.com/538558[3].


Entry on the feature dashboard

There currently is none, as this is a very small feature, and very low cost, and is primarily implemented to enable a simple convention introduced in ECMAScript 6, rather than to enable some new exciting feature.


Boris Zbarsky

unread,
Mar 14, 2016, 1:41:18 PM3/14/16
to Caitlin Potter, blink-dev
On 3/14/16 12:50 PM, Caitlin Potter wrote:
> Interoperability and Compatibility Risk
>
> This change is largely compatible with the implementation in Firefox 48

One minor note: Firefox does not implement forEach/values/keys/entries
on NodeList at the moment. Not sure whether anyone does, so there might
be some compat worries around that.

For the rest, this is awesome news. :)

-Boris

Jochen Eisinger

unread,
Mar 14, 2016, 1:52:51 PM3/14/16
to Boris Zbarsky, Caitlin Potter, blink-dev
Do you plan to remove the iterator symbol from Window before shipping?

Caitlin Potter

unread,
Mar 14, 2016, 2:06:14 PM3/14/16
to blink-dev, bzba...@mit.edu, caitpo...@gmail.com
Yes, there's a CL for removing iterator from Window open, and should land before or soon after a shipping CL lands

Jochen Eisinger

unread,
Mar 14, 2016, 2:10:54 PM3/14/16
to Caitlin Potter, blink-dev, bzba...@mit.edu

lgtm1

Rick Byers

unread,
Mar 14, 2016, 3:30:42 PM3/14/16
to Jochen Eisinger, Caitlin Potter, blink-dev, Boris Zbarsky
LGTM2

Chris Harrelson

unread,
Mar 14, 2016, 8:29:06 PM3/14/16
to Rick Byers, Jochen Eisinger, Caitlin Potter, blink-dev, Boris Zbarsky
LGTM3

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
Reply all
Reply to author
Forward
0 new messages