jbreeden / rubium

A Chromium shell for MRuby applications
14 stars 4 forks source link

Make the JavaScript API safe #4

Closed jbreeden closed 8 years ago

jbreeden commented 8 years ago

When you call methods on a JavaScript method from ruby, exception handling is safe, all javascript exceptions are marked as handled, and they are raised in ruby to be handled by the client. (If they are not handled, they are re-raised in JavaScript).

Using the lower level API (ex: obj[:method].apply(obj, *args)) you are expected to supply a block to handle exceptions. If you don't handle them, and continue to interact with javascript, the process will crash.

Both of these API's should be safe. And the block handling of exceptions is strange. Should probably just re-raise in both cases.

jbreeden commented 8 years ago

4c25f70c9d1e208a024d28e303b4487c03e15997