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

Rhino is only JS 1.7 compatible - prevents using modern JS syntax #38

Open
rob99 opened this issue Dec 12, 2017 · 1 comment
Open

Rhino is only JS 1.7 compatible - prevents using modern JS syntax #38

rob99 opened this issue Dec 12, 2017 · 1 comment

Comments

@rob99
Copy link

rob99 commented Dec 12, 2017

I'm putting this here for documentation as much as anything. It's not clear to me if Mozilla Rhino will ever be made ECMAscript 6 compliant or be kept up to date in general...

I've found that using therubyrhino in a rails 4.2 application on JRuby that rake assets:precompile will fail even though my javascript executes without error in the browser.

This appears to be because Mozilla Rhino is only JS 1.7 compliant, whereas my browser can execute v6.

E.g.:

jirb
irb(main):001:0> require 'rhino'
=> true
irb(main):002:0> eval_js "7 * 6"
=> 42
irb(main):003:0> eval_js "var a = 1"
=> nil
irb(main):004:0> eval_js "let a = 1"
Rhino::JSError: missing ; before statement

Not sure if the solution is to have JRuby move to another Java JS engine (are there any?) or somehow make rake assets:precompile not do syntax checking, or get Mozilla Rhino updated.

@kares
Copy link
Collaborator

kares commented Jun 6, 2018

unfortunately, there's very little maintenance I can afford going into Rhino.
if someone lends here should definitely look into that, there's failures that might need looking into ... attempting to upgrade rhino
alternatively you can give dienashorner gem a go (uses the Nashorn JS engine available in Java 8)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants