sstephenson/execjs — Issue #53: Difference in Runtimes behavior
Author: bogdan
Created: 2011-10-23 07:24:03+00:00
State: open

I am having the code, that works with JS context.

In RubyRacer runtime:

``` ruby
ENV['EXECJS_RUNTIME']="RubyRacer"
require 'execjs'
c = ExecJS.compile("var window = {}; window.a = 5; window.b = 2;")
c.eval("window.b = 3")
c.eval("window") #=> {"a"=>5, "b"=>3}
```

And it looks right.

In case of Node runtime:

``` ruby
ENV['EXECJS_RUNTIME']="Node"
require 'execjs'
c = ExecJS.compile("var window = {}; window.a = 5; window.b = 2;")
c.eval("window.b = 3")
c.eval("window") #=> {"a"=>5, "b"=>2}
```

The context doesn't change after eval.

Feel like this difference in behavior breaks the idea of ExecJS.

How can I operate on the same JS context eval there multiple times in Node runtime?