Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Issue 2777183004: Make pair iterators inherit from %IteratorPrototype%. (Closed)

Created:
3 years, 8 months ago by Raphael Kubo da Costa (rakuco)
Modified:
3 years, 8 months ago
Reviewers:
haraken, bashi, Yuki
CC:
chromium-reviews, sof, eae+blinkwatch, blink-reviews-dom_chromium.org, dglazkov+blink, blink-reviews-bindings_chromium.org, blink-reviews, rwlbuis
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Make pair iterators inherit from %IteratorPrototype%. Adjust the prototype chain for iterator objects returned by interfaces that have pair iterators. The WebIDL spec says when an interface has pair iterators the iterators it returns must be instances of the "default iterator object" whose [[Prototype]] points to an "iterator prototype object" whose [[Prototype]], on its turn, points to %IteratorPrototype%. next() must be implemented in the "iterator prototype object", while %IteratorPrototype% provides @@iterator. In practice, this means the following should return true but was returning false: Object.getPrototypeOf(Object.getPrototypeOf(new Headers().entries())) === Object.getPrototypeOf(Object.getPrototypeOf([][Symbol.iterator]())) Previously, we just had the Iterator interface with both next() and @@iterator added to its prototype object, which just inherited from Object.prototype. We now adhere to the spec by making Iterator's prototype object inherit by %IteratorPrototype% (which then inherits from Object.prototype) instead. It also allows us to remove support for the non-standard "Iterable" extended attribute we had in Blink. The way we do it is not very pretty though: when the code for the Iterator interface is generated, we create another function template with no prototype and set the "prototype" property of its function object. When |interfaceTemplate| is instantiated, its prototype.__proto__ will point to the value of the "prototype" property we set, which is exactly what we want. BUG=689576 R=bashi@chromium.org,haraken@chromium.org,yukishiino@chromium.org Review-Url: https://codereview.chromium.org/2777183004 Cr-Commit-Position: refs/heads/master@{#463224} Committed: https://chromium.googlesource.com/chromium/src/+/6579200aa9189bce1cd61c05fb6eb4493f2302d8

Patch Set 1 #

Patch Set 2 : Rebased patch with tests #

Total comments: 6

Patch Set 3 : Address Yuki's comments #

Total comments: 1

Patch Set 4 : Fix typo in comment #

Patch Set 5 : Rebase after The Blink Rename #

Patch Set 6 : Fix the build after The Blink Rename #

Messages

Total messages: 28 (11 generated)
Raphael Kubo da Costa (rakuco)
PTAL. This is a work in progress, and I wanted to get feedback from you ...
3 years, 8 months ago (2017-03-28 16:43:11 UTC) #1
haraken
On 2017/03/28 16:43:11, Raphael Kubo da Costa (rakuco) wrote: > PTAL. This is a work ...
3 years, 8 months ago (2017-03-29 09:08:04 UTC) #2
Yuki
On 2017/03/29 09:08:04, haraken wrote: > On 2017/03/28 16:43:11, Raphael Kubo da Costa (rakuco) wrote: ...
3 years, 8 months ago (2017-03-29 13:37:22 UTC) #3
bashi
On 2017/03/29 13:37:22, Yuki wrote: > On 2017/03/29 09:08:04, haraken wrote: > > On 2017/03/28 ...
3 years, 8 months ago (2017-03-29 23:13:04 UTC) #4
Raphael Kubo da Costa (rakuco)
If anyone else's following this, I sent https://codereview.chromium.org/2784543004/ to expose %IteratorPrototype% in V8. If past ...
3 years, 8 months ago (2017-03-30 14:33:15 UTC) #5
haraken
> If anyone else's following this, I sent https://codereview.chromium.org/2784543004/ to expose %IteratorPrototype% in V8. > ...
3 years, 8 months ago (2017-03-30 14:39:59 UTC) #7
Raphael Kubo da Costa (rakuco)
The V8 side of the patch has finally landed, so I'm updating this CL with ...
3 years, 8 months ago (2017-04-07 08:37:37 UTC) #10
haraken
LGTM Great CL description & comment :)
3 years, 8 months ago (2017-04-07 09:13:47 UTC) #11
Yuki
LGTM! https://codereview.chromium.org/2777183004/diff/20001/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl File third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl (right): https://codereview.chromium.org/2777183004/diff/20001/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl#newcode536 third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl:536: // The WebIDL spec says when an interface ...
3 years, 8 months ago (2017-04-07 09:25:03 UTC) #12
bashi
(yukishiino@ and haraken@ are right reviewers and you don't have to wait for my review)
3 years, 8 months ago (2017-04-07 09:33:31 UTC) #13
Raphael Kubo da Costa (rakuco)
https://codereview.chromium.org/2777183004/diff/20001/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl File third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl (right): https://codereview.chromium.org/2777183004/diff/20001/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl#newcode536 third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl:536: // The WebIDL spec says when an interface has ...
3 years, 8 months ago (2017-04-07 09:45:46 UTC) #14
Raphael Kubo da Costa (rakuco)
Patch v3 is up, hopefully addressing Yuki's comments.
3 years, 8 months ago (2017-04-07 09:47:02 UTC) #15
Yuki
LGTM. https://codereview.chromium.org/2777183004/diff/40001/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl File third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl (right): https://codereview.chromium.org/2777183004/diff/40001/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl#newcode558 third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl:558: // - |interfaceTemplate| is is cached in V8PerIsolateData, ...
3 years, 8 months ago (2017-04-07 09:49:12 UTC) #16
Raphael Kubo da Costa (rakuco)
Patch v4 is up with hopefully no typos :-) I intend to land this next ...
3 years, 8 months ago (2017-04-07 09:57:50 UTC) #17
Yuki
The plan LGTM.
3 years, 8 months ago (2017-04-07 10:08:24 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2777183004/100001
3 years, 8 months ago (2017-04-10 09:32:41 UTC) #25
commit-bot: I haz the power
3 years, 8 months ago (2017-04-10 11:55:08 UTC) #28
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/6579200aa9189bce1cd61c05fb6e...

Powered by Google App Engine
This is Rietveld 408576698