Closed Bug 1051891 Opened 10 years ago Closed 10 years ago

ReferenceError: Iterator is not defined with simple Add-On

Categories

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

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: Fallen, Unassigned)

Details

Simplified STR:

1) Create an addon with jpm, use default settings
2) Replace index.js contents with "Iterator({})"
3) jpm run


Results:

console.error: jpm: 
  Message: ReferenceError: Iterator is not defined
  Stack:
    @resource://jpm/index.js:2:1
run@resource://gre/modules/commonjs/sdk/addon/runner.js:138:19
startup/</<@resource://gre/modules/commonjs/sdk/addon/runner.js:81:7
Handler.prototype.process@resource://gre/modules/Promise-backend.js:866:23
this.PromiseWalker.walkerLoop@resource://gre/modules/Promise-backend.js:745:7

I've tested this with the Firefox Nightly from 2014-08-11.
the `Iterator` is a proprietary firefox extension to the JS, and the recommendation is to use the new standard stuff available in recent ES versions, like `Object.keys()` and 

  for (let x of obj)

but if you have a specific use case not covered here, feel free to ask..
I'm fine with using other alternatives, I'm just surprised it doesn't work. Is support for Iterator() going away or does this maybe have to do with the loader deleting the Iterator from the sandbox here:

http://mxr.mozilla.org/mozilla-central/source/addon-sdk/source/lib/toolkit/loader.js#237

If you'd rather close this bug WONTFIX thats fine with me too, its up to you.
i'm gonna guess that's probably because we (mozilla, SM folks) want to discourage the use of that..
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.