rubyjs / therubyrhino

Embed the Mozilla Rhino Javascript interpreter into Ruby
155 stars 40 forks source link

context timeout restriction and 1.9 compatibility #14

Closed kares closed 12 years ago

kares commented 12 years ago

see the commits for details and as usual let me know if something bother your eye. especially due jruby --1.9 incompatibilities a soonish release would be fine ...

kares commented 12 years ago

@cowboyd any chance we get a 1.9 compatible release soon ?

cowboyd commented 12 years ago

Quick question: why not make the default restrictable?

kares commented 12 years ago

the genesis of restrictable would be, if I recall correctly:

  1. don't create a factory per context by default
  2. put the restrictions into a context sub-class + add a restrictable factory since there's a timeout_limit to be added
  3. add the timeout limit as the instruction limit ain't always enough (e.g. JS code might perform some setTimeout)

basically for most every day use it did not make much sense for the restrictable code to sit around + the code seems better manageable (with the timeout limit being added) to me when separated. than of course I retained backwards compatibility - that's probably why you ask seeing this :

  def instruction_limit=(limit)
    if restrictable?
      @native.instruction_limit = limit
    else
      raise "setting an instruction_limit has no effect on this context, use " + 
            "Context.open(:restricted => true) to gain a restrictable instance"
    end
  end
kares commented 12 years ago

@cowboyd could we also get out 1.73.2 release of master please (if you do not have more plans for it) ... thanks

cowboyd commented 12 years ago

Done. Thanks!