Closed
Bug 857113
Opened 12 years ago
Closed 12 years ago
Inject Iterator into sandboxes
Categories
(Add-on SDK Graveyard :: General, defect)
Add-on SDK Graveyard
General
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.
Assignee | ||
Comment 1•12 years ago
|
||
Assignee: nobody → poirot.alex
Attachment #732344 -
Flags: review?(rFobic)
Comment 2•12 years ago
|
||
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)
Updated•12 years ago
|
Attachment #732344 -
Flags: review?(rFobic) → review-
Comment 3•12 years ago
|
||
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
Comment 4•12 years ago
|
||
(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?
Comment 5•12 years ago
|
||
(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.
Description
•