lib/johnson/spidermonkey/runtime.rb in jbarnette-johnson-1.0.0.20090326161333 vs lib/johnson/spidermonkey/runtime.rb in jbarnette-johnson-1.0.0.20090402144841
- old
+ new
@@ -5,10 +5,11 @@
def initialize(options={})
@debugger = nil
@compiled_scripts = {}
@gcthings = {}
+ @traps = []
initialize_native(options)
self["Ruby"] = Object
end
# called from js_land_proxy.c:make_js_land_proxy
@@ -40,10 +41,17 @@
def evaluate(script, filename = nil, linenum = nil)
compiled_script = compile(script, filename, linenum)
evaluate_compiled_script(compiled_script)
end
+ def evaluate_compiled script
+ evaluate_compiled_script(script)
+ @traps.each do |trap_tuple|
+ clear_trap(*trap_tuple)
+ end
+ end
+
###
# Compile +script+ with +filename+ and +linenum+
def compile(script, filename=nil, linenum=nil)
filename ||= 'none'
linenum ||= 1
@@ -55,9 +63,10 @@
def break(filename, linenum, &block)
raise "#{filename} has not been compiled" unless @compiled_scripts.key?(filename)
compiled_script = @compiled_scripts[filename]
set_trap(compiled_script, linenum, block)
+ @traps << [compiled_script, linenum]
end
class << self
def raise_js_exception(jsex)
raise jsex if Exception === jsex