mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
add spec for segfaulting on native prototype extension.
This commit is contained in:
parent
d2017c673d
commit
dd7f1ffd21
2 changed files with 26 additions and 1 deletions
|
@ -29,4 +29,29 @@ describe C::TryCatch do
|
||||||
}.should raise_error(ScriptError)
|
}.should raise_error(ScriptError)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "doesn't segfault when an error is raised in a javascript function on a native prototype" do
|
||||||
|
constructor = Class.new
|
||||||
|
constructor.class_eval do
|
||||||
|
def detonate(*a)
|
||||||
|
raise "BOOM!"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
V8::Context.new do |cxt|
|
||||||
|
cxt['Boom'] = constructor
|
||||||
|
cxt['puts'] = method(:puts)
|
||||||
|
danger = <<-JS
|
||||||
|
Boom.prototype.boom = function() {
|
||||||
|
this.detonate()
|
||||||
|
}
|
||||||
|
var go = new(Boom)()
|
||||||
|
try {
|
||||||
|
go.boom()
|
||||||
|
} catch (e) {
|
||||||
|
}
|
||||||
|
go.boom()
|
||||||
|
JS
|
||||||
|
expect {cxt.eval(danger, 'danger.js')}.should raise_error(V8::JSError)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
Loading…
Add table
Reference in a new issue