Bug 159211 - Iterable interfaces should have their related prototype @@iterator property writable
Summary: Iterable interfaces should have their related prototype @@iterator property w...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL: http://heycam.github.io/webidl/#es-it...
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-06-28 05:25 PDT by youenn fablet
Modified: 2016-06-29 03:35 PDT (History)
5 users (show)

See Also:


Attachments
Patch (6.77 KB, patch)
2016-06-28 05:53 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (7.10 KB, patch)
2016-06-28 12:49 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2016-06-28 05:25:25 PDT
Currently the property is read-only, which is not consistent with JSC iterators.
Comment 1 youenn fablet 2016-06-28 05:53:13 PDT
Created attachment 282245 [details]
Patch
Comment 2 Chris Dumez 2016-06-28 10:52:12 PDT
Comment on attachment 282245 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=282245&action=review

R=me with comments

> Source/WebCore/ChangeLog:5
> +

<rdar://problem/26950766>

> Source/WebCore/ChangeLog:7
> +

Please link to the spec:
http://heycam.github.io/webidl/#es-iterator

> Source/WebCore/ChangeLog:8
> +        Related to radar 26950766.

Move this to the top.
Comment 3 Chris Dumez 2016-06-28 10:52:53 PDT
<rdar://problem/26950766>
Comment 4 Chris Dumez 2016-06-28 10:56:15 PDT
Comment on attachment 282245 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=282245&action=review

> LayoutTests/fast/dom/nodeListIterator.html:90
> +            shouldNotThrow('NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];');

Please also add a check for the value returned by Object.getOwnPropertyDescriptor(NodeList.prototype, Symbol.iterator) to make sure writable is true, enumerable is false and configurable is true. As per the Web IDL spec.
Comment 5 youenn fablet 2016-06-28 12:28:49 PDT
Thanks for the review.

> > Source/WebCore/ChangeLog:5
> > +
> 
> <rdar://problem/26950766>

OK.

> > Source/WebCore/ChangeLog:7
> > +
> 
> Please link to the spec:
> http://heycam.github.io/webidl/#es-iterator

OK.

> > Source/WebCore/ChangeLog:8
> > +        Related to radar 26950766.
> 
> Move this to the top.

OK

> > LayoutTests/fast/dom/nodeListIterator.html:90
> > +            shouldNotThrow('NodeList.prototype[Symbol.iterator] = Array.prototype[Symbol.iterator];');
> 
> Please also add a check for the value returned by
> Object.getOwnPropertyDescriptor(NodeList.prototype, Symbol.iterator) to make
> sure writable is true, enumerable is false and configurable is true. As per
> the Web IDL spec.

OK
FWIW, I plan to beef-up wpt idlharness.js to have thorough testing of iterable and setlike.
Comment 6 youenn fablet 2016-06-28 12:49:40 PDT
Created attachment 282271 [details]
Patch for landing
Comment 7 WebKit Commit Bot 2016-06-28 13:19:22 PDT
Comment on attachment 282271 [details]
Patch for landing

Clearing flags on attachment: 282271

Committed r202583: <http://trac.webkit.org/changeset/202583>
Comment 8 WebKit Commit Bot 2016-06-28 13:19:26 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 youenn fablet 2016-06-29 03:35:22 PDT
> FWIW, I plan to beef-up wpt idlharness.js to have thorough testing of
> iterable and setlike.

Related PR is https://github.com/w3c/testharness.js/pull/201