execjs icon indicating copy to clipboard operation
execjs copied to clipboard

Fails DuktapeRuntime::Context#call with complex identifier

Open maisumakun opened this issue 8 years ago • 2 comments

I'm trying to use duktape with Rails environment:

  • Rails 4.2.6
  • ExecJS 2.7
  • duktape 1.3.0.6
  • autoprefixer-rails 6.0.3

After bundling gems I accessed the server and got ExecJS::ProgramError : identifier '(function(opts) {return eval(process' undefined .

In autoprefixer-rails, #call was called with following contexts:

      apply_wrapper =
        "(function(opts) {" +
        "return eval(process.apply(this, opts));" +
        "})"

      params = params_with_browsers(opts[:from]).merge(opts)
      result = runtime.call(apply_wrapper, [css, params])

In ExecJS::DuktapeRuntime::Context#call, it is parsed by identifier.split("."). It results in wrongly splitted code.

I don't know it is good to pass complex identifier for #call, but the code written as such exists.

maisumakun avatar Jun 29 '16 06:06 maisumakun

It's unclear to me exactly what the requirements of Runtime#call is. There's no documentation so it's hard to know what the expected behaviour is.

judofyr avatar May 23 '18 08:05 judofyr

That said, it was @josh who implemented the "calling function in nested object"-feature in Duktape, so I believe the intention was to not support very complicated expressions in #call?

This repo seems pretty dead though, so the easiest fix is probably to change autoprefixer-rails.

judofyr avatar May 23 '18 08:05 judofyr