From 87b198246496db59e28a1849f15e79fb1cc04d08 Mon Sep 17 00:00:00 2001 From: Charles Lowell Date: Mon, 2 Aug 2010 16:23:01 -0500 Subject: [PATCH] protect calls to dynamic accessors and interceptors so that if they throw ruby exceptions, it raises them in javascript instead of causing segfaults. --- lib/v8/access.rb | 6 +++--- spec/redjs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/v8/access.rb b/lib/v8/access.rb index e0239de..7bfb965 100644 --- a/lib/v8/access.rb +++ b/lib/v8/access.rb @@ -122,7 +122,7 @@ module V8 To.v8(method) end elsif obj.respond_to?(:[]) - To.v8(obj[name]) + Function.rubycall(obj.method(:[]), name) else C::Empty end @@ -137,10 +137,10 @@ module V8 setter = name + "=" methods = accessible_methods(obj) if methods.include?(setter) - obj.send(setter, To.rb(value)) + Function.rubycall(obj.method(setter), To.rb(value)) value elsif obj.respond_to?(:[]=) - obj.send(:[]=, name, To.rb(value)) + Function.rubycall(obj.method(:[]=), name, To.rb(value)) value else C::Empty diff --git a/spec/redjs b/spec/redjs index 9ff9293..d8d64af 160000 --- a/spec/redjs +++ b/spec/redjs @@ -1 +1 @@ -Subproject commit 9ff9293c6d55d9276c3512221c4fdb912808564a +Subproject commit d8d64af2cb47e913247691d6a18c0fa9dd94512b