Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generator function causing JS_SYNTAX_ERROR #2108

Closed
lidel opened this issue Jul 17, 2018 · 2 comments · Fixed by dguo/color-tailor#18, dguo/chromatastic#4, dguo/picture-paint#3 or armateam/extension#99 · May be fixed by restinpeaceinout/web-ext-webpack-plugin#1

Comments

@lidel
Copy link

lidel commented Jul 17, 2018

Describe the problem and steps to reproduce it:

Attempted to validate an extension whose background .js had generator function:

content: (async function * () { 
// ...

How to reproduce

git clone https://github.com/mozilla/libdweb.git 
cd libdweb && git checkout fbff435b33542b02bc35c0bb8c27bc203e6d4e6e
cd demo/protocol && npx [email protected] lint

What happened?

Code              Message                       Description
JS_SYNTAX_ERROR   JavaScript syntax error       There is a JavaScript syntax error in your code; validation cannot continue on this file.

What did you expect to happen?

Firefox runs generators just fine. It guess function * should be accepted?
I may be missing some background on this, but MDN support table is green:

screenshot_11

Anything else we should know?

Versions:

"web-ext": "2.7.0" with "addons-linter": "1.0.0"

Examples of use of generator functions in browser extensions:

@lidel
Copy link
Author

lidel commented Jul 17, 2018

Hm.. I repeated the test wih latest version and the error is gone:

git clone https://github.com/mozilla/libdweb.git 
cd libdweb && git checkout fbff435b33542b02bc35c0bb8c27bc203e6d4e6e
cd demo/protocol && npx [email protected] .

Does it mean generators were added after 1.0.0 and web-ext just needs to be bumped to the latest version of addons-linter?

@EnTeQuAk
Copy link
Contributor

Does it mean generators were added after 1.0.0 and web-ext just needs to be bumped to the latest version of addons-linter?

Correct. There were quite a few updates after 1.0.0 even that added support for many more recent JS features (e.g generators like you described, catch without an exception etc).

I'm closing this in favor of mozilla/web-ext#1326

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment