Closed Bug 857113 Opened 12 years ago Closed 12 years ago

Inject Iterator into sandboxes

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(1 file)

I don't remember the reason why we explicitely prevent from using Iterator in sandboxes, but it doesn't really make much sense to me right now and introduce some issues with devtools using Iterator in some of their code. As webcontent already and still have access to it, I thing we should expose it in sandboxes.
Attached file Pull request 914 (deleted) —
Assignee: nobody → poirot.alex
Attachment #732344 - Flags: review?(rFobic)
The main reason Iterator was removed is because it's broken for SDK APIs. It's also a non standard easily implementable in JS function. I've spoken about this with dcamp and my impression was it's not really a big deal for them, specially since one could easily expose it by manually adding to a loader globals. What's more important IMO is to embrace now the standard `for of` construct over all the moz specific non standard features like this. // You can call it Iterator if you like function keyvals(object) { for (key in object) yield [key, object[key]] } for ([key, value] of keyvals({ a: 1, b: 2 })) console.log(key, value) P.S.: This will also work for `for each` for each ([key, value] in keyvals({ a: 1, b: 2 })) console.log(key, value)
Attachment #732344 - Flags: review?(rFobic) → review-
Dave if this is problematic for devtools feel free to reopen, otherwise I don't think we should do this.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
(In reply to Irakli Gozilalishvili [:irakli] [:gozala] [@gozala] from comment #2) > The main reason Iterator was removed is because it's broken for SDK APIs. > It's also a non standard easily implementable in JS function. I've spoken > about this with dcamp and my impression was it's not really a big deal for > them, specially since > one could easily expose it by manually adding to a loader globals. Why is it broken for SDK APIs?
(In reply to Dave Townsend (:Mossop) from comment #4) > (In reply to Irakli Gozilalishvili [:irakli] [:gozala] [@gozala] from > comment #2) > > The main reason Iterator was removed is because it's broken for SDK APIs. > > It's also a non standard easily implementable in JS function. I've spoken > > about this with dcamp and my impression was it's not really a big deal for > > them, specially since > > one could easily expose it by manually adding to a loader globals. > > Why is it broken for SDK APIs? Because we can't fully emulate behavior with __iterator__, so our collections were not behaving as expected.
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: