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

make V8::Function use portal in lieu of context directly.

This commit is contained in:
Charles Lowell 2010-08-28 13:44:33 -05:00
parent 948de0a5f3
commit 8f8c03e207

View file

@ -5,9 +5,9 @@ module V8
err = nil
return_value = nil
C::TryCatch.try do |try|
@context.enter do
this = To.v8(thisObject)
return_value = To.rb(@native.Call(this, To.v8(args)))
@portal.open do |to|
this = to.v8(thisObject)
return_value = to.rb(@native.Call(this, to.v8(args)))
err = JSError.new(try) if try.HasCaught()
end
end
@ -20,40 +20,9 @@ module V8
end
def new(*args)
@context.enter do
To.rb(@native.NewInstance(To.v8(args)))
@portal.open do |to|
to.rb(@native.NewInstance(to.v8(args)))
end
end
# def self.rubyprotect(&blk)
# To.v8(rubyprotect2(&blk))
# end
#
# def self.rubyprotect2
# begin
# yield
# rescue Exception => e
# case e
# when SystemExit, NoMemoryError
# raise e
# else
# error = V8::C::Exception::Error(V8::C::String::New(e.message))
# error.SetHiddenValue("TheRubyRacer::Cause", C::External::New(e))
# V8::C::ThrowException(error)
# end
# end
# end
#
# def self.rubycall(rubycode, *args, &block)
# rubyprotect do
# rubycode.call(*args, &block)
# end
# end
#
# def self.rubysend(obj, message, *args, &block)
# rubyprotect do
# obj.send(message, *args, &block)
# end
# end
end
end