mirror of
https://github.com/rubyjs/therubyrhino
synced 2023-03-27 23:21:34 -04:00
parent
9e872e7d36
commit
30f109bf65
3 changed files with 16 additions and 1 deletions
2
Gemfile
2
Gemfile
|
@ -4,4 +4,4 @@ gemspec
|
|||
|
||||
# NOTE: some specs might be excluded @see #spec/spec_helper.rb
|
||||
gem 'redjs', :git => 'git://github.com/cowboyd/redjs.git', :group => :test,
|
||||
:ref => "8656639e99d52b8d5414250db2e27db4bb531506"
|
||||
:ref => "b212e50ad347c0d32e53f28d0d627df6b8077e68"
|
||||
|
|
|
@ -200,6 +200,8 @@ class Java::OrgMozillaJavascript::BaseFunction
|
|||
context = Rhino::JS::Context.enter; scope = current_scope(context)
|
||||
args = Rhino.args_to_javascript(args, scope)
|
||||
__call__(context, scope, Rhino.to_javascript(this), args)
|
||||
rescue Rhino::JS::JavaScriptException => e
|
||||
raise Rhino::JSError.new(e)
|
||||
ensure
|
||||
Rhino::JS::Context.exit
|
||||
end
|
||||
|
|
|
@ -127,5 +127,18 @@ describe Rhino::JSError do
|
|||
fail "expected to rescue"
|
||||
end
|
||||
end
|
||||
|
||||
it "raises correct error from function#apply" do
|
||||
begin
|
||||
context = Rhino::Context.new
|
||||
context.eval "function foo() { throw 'bar' }"
|
||||
context['foo'].apply(nil)
|
||||
rescue => e
|
||||
e.should be_a Rhino::JSError
|
||||
e.value.should == 'bar'
|
||||
else
|
||||
fail "expected to rescue"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Loading…
Reference in a new issue