1
0
Fork 0
mirror of https://github.com/rubyjs/therubyrhino synced 2023-03-27 23:21:34 -04:00

fix NativeObject#[]= JS constant resolution + change getCurrentContext when converting scoped values

This commit is contained in:
kares 2011-12-09 19:02:08 +01:00
parent b59f15acbe
commit 167e089722
2 changed files with 4 additions and 4 deletions

View file

@ -98,6 +98,8 @@ end
class Java::OrgMozillaJavascript::NativeObject
import "org.mozilla.javascript"
# re-implement Map#put
def []=(key, value)
scope = self

View file

@ -40,8 +40,7 @@ module Rhino
end
def array_to_javascript(rb_array, scope = nil)
if scope
raise "no current context" unless context = JS::Context.getCurrentContext
if scope && context = JS::Context.getCurrentContext
context.newArray(scope, rb_array.to_java)
else
JS::NativeArray.new(rb_array.to_java)
@ -50,8 +49,7 @@ module Rhino
def hash_to_javascript(rb_hash, scope = nil)
js_object =
if scope
raise "no current context" unless context = JS::Context.getCurrentContext
if scope && context = JS::Context.getCurrentContext
context.newObject(scope)
else
JS::NativeObject.new