Sha256: 2ec81217fe1bf983c5a186592a194ba1996c2ceedc31731e589c26ca96fb9b8a

Contents?: true

Size: 873 Bytes

Versions: 56

Compression:

Stored size: 873 Bytes

Contents

module V8
  class Portal
    class Caller

      def initialize(portal)
        @portal = portal
      end

      def raw
        yield
      rescue Exception => e
        case e
        when SystemExit, NoMemoryError
          raise e
        else
          error = V8::C::Exception::Error(V8::C::String::New(e.message))
          #TODO: This is almost certainly a crash here.
          #we need to hold onto `error` while it bubbles up the javascript stack.
          error.SetHiddenValue("TheRubyRacer::Cause", C::External::New(e))
          V8::C::ThrowException(error)
        end
      end

      def protect(*args, &block)
        @portal.v8 raw(*args, &block)
      end

      def invoke(code, *args, &block)
        protect do
          args = args.slice(0, code.arity) if code.arity >= 0
          code.call(*args, &block)
        end
      end
    end
  end
end

Version data entries

56 entries across 56 versions & 5 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.7.4 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.7.3 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.7.2 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.7.1 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.7.0 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.9 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.8 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.7 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.6 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.5 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.4 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.3 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.2 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.1 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.6.0 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.5.17 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.5.16 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.5.15 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb
classiccms-0.5.14 vendor/bundle/gems/therubyracer-0.10.1/lib/v8/portal/caller.rb