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

Always return the same ruby peer for a given javascript object.

This commit is contained in:
Charles Lowell 2010-12-22 14:21:34 -06:00
parent 1ae132a14e
commit 77908b575b
4 changed files with 10 additions and 7 deletions

View file

@ -8,8 +8,9 @@ module V8
@to = Portal.new(self, @access)
@native = opts[:with] ? C::Context::New(@to.rubytemplate) : C::Context::New()
@native.enter do
@scope = @to.rb(@native.Global())
@native.Global().SetHiddenValue(C::String::New("TheRubyRacer::RubyObject"), C::External::New(opts[:with])) if opts[:with]
@global = @native.Global()
@scope = @to.rb(@global)
@global.SetHiddenValue(C::String::New("TheRubyRacer::RubyObject"), C::External::New(opts[:with])) if opts[:with]
end
yield(self) if block_given?
end

View file

@ -107,9 +107,9 @@ module V8
#in the TryCatch. Is there a better way to detect a syntax error
def syntax_error?(try)
ex = try.Exception()
if ex && ex.kind_of?(V8::C::Object)
type = ex.Get("constructor")
type && type.kind_of?(V8::C::Function) && type.GetName().AsciiValue == "SyntaxError"
if ex && ex.kind_of?(V8::Object)
type = ex["constructor"]
type && type.kind_of?(V8::Function) && type.name == "SyntaxError"
else
false
end

View file

@ -186,7 +186,9 @@ module V8
if external && !external.IsEmpty()
external.Value()
else
yield.new(value, self)
yield.new(value, self).tap do |object|
value.SetHiddenValue(C::String::NewSymbol("TheRubyRacer::RubyObject"), C::External::New(object))
end
end
end

@ -1 +1 @@
Subproject commit 89c9609f1637f2a3505548313fe2d89c60048109
Subproject commit 88019dcfd31f0cb1bc4c27ba8e4cbb359af1b804