Closed Bug 1486249 Opened 6 years ago Closed 6 years ago

Allow JS iterators to act as nsISimpleEnumerators

Categories

(Core :: XPConnect, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla64
Tracking Status
firefox64 --- fixed

People

(Reporter: kmag, Assigned: kmag)

References

Details

Attachments

(2 files)

This is essentially the inverse of bug 1484496: That bug allows us to use C++-implemented nsISimpleEnumerator instances as JS iterators. This one should allow us to pass plain JS iterators to C++ callers expecting nsISimpleEnumerator instances.

This should help to significantly decrease the impedance mismatch between JS and C++ callers of the relevante APIs, and make it much easier for us to move code from one language to the other as necessary.
This allows JS callers and C++ callers to both create and consumer iterators
in their preferred style, while still presenting the appropriate interfaces to
callers in the other language.

When a C++ caller requires an nsISimpleEnumerator from an XPCWrappedJS object,
if that class does not already have a QueryInterface method, it is assumed to
be a JS enumerator, and an appropriate wrapper is created. JS callers who wish
to implement nsISimpleEnumerator manually, or opt out of the automatic
conversions, may implement a QueryInterface method, which automatically opts
them out of this behavior.
Priority: -- → P2
Comment on attachment 9004047 [details]
Bug 1486249: Part 1 - Automatically convert JS iterators to nsISimpleEnumerators at XPConnect boundary. r=mccr8

Andrew McCreight [:mccr8] has approved the revision.
Attachment #9004047 - Flags: review+
Comment on attachment 9004048 [details]
Bug 1486249: Part 2 - Convert JS nsISimpleEnumerator implements to JS enumerators. r=mccr8

Andrew McCreight [:mccr8] has approved the revision.
Attachment #9004048 - Flags: review+
Blocks: 1488908
https://hg.mozilla.org/integration/mozilla-inbound/rev/de02445193810e0fc97767036db4184742ceebac
Bug 1486249: Part 1 - Automatically convert JS iterators to nsISimpleEnumerators at XPConnect boundary. r=mccr8

https://hg.mozilla.org/integration/mozilla-inbound/rev/11351ef0d0b0a92db8a26828412f3b6586cccb7a
Bug 1486249: Part 2 - Convert JS nsISimpleEnumerator implements to JS enumerators. r=mccr8
https://hg.mozilla.org/mozilla-central/rev/de0244519381
https://hg.mozilla.org/mozilla-central/rev/11351ef0d0b0
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Depends on: 1489532
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: