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 class Java::OrgMozillaJavascript::NativeObject
import "org.mozilla.javascript"
# re-implement Map#put # re-implement Map#put
def []=(key, value) def []=(key, value)
scope = self scope = self

View file

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