Fails DuktapeRuntime::Context#call with complex identifier

Open
#45 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, rails, ruby
Domain
backend

Research direction

Start in ExecJS::DuktapeRuntime::Context#call, where the identifier is split on periods, and compare that behavior with the complex identifier passed from autoprefixer-rails/lib/autoprefixer-rails/processor.rb. Reproduce the reported call and verify that complex function identifiers are handled without breaking the existing lookup behavior.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Ruby
Stars
578
Forks
286
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rails/execjs

All issues in rails/execjs

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.