[Celerity-users] memory leaks and serialize blockage

jason franklin-stokes jasoninclass at googlemail.com
Thu Dec 10 17:28:57 EST 2009


Jari, 

so serialize works when i take @web_client out of the initialize in Listener

    def initialize
      @procs = Hash.new { |h, k| h[k] = [] }
    end

and add listener looks then like this:

 def add_listener(type, webclient, &block)
      case type
      when :status
        webclient.setStatusHandler(self)
      when :alert
        webclient.setAlertHandler(self)
      when :attachment
        webclient.setAttachmentHandler(self)
      when :web_window_event
        webclient.addWebWindowListener(self)
      when :html_parser
        webclient.setHTMLParserListener(self)
      when :incorrectness
        webclient.setIncorrectnessListener(self)
      when :confirm
        webclient.setConfirmHandler(self)
      when :prompt
        webclient.setPromptHandler(self)
      else
        raise ArgumentError, "unknown listener type #{type.inspect}"
      end

      @procs[type] << block
    end

Obviously the callers have to pass webclient. 

I changed the required tests and they all pass - not perfect, but it works. 

BR 
Jason.













On Dec 10, 2009, at 9:44 PM, Jari Bakken wrote:

> On Thu, Dec 10, 2009 at 9:28 PM, jason franklin-stokes
> <jasoninclass at googlemail.com> wrote:
>> 
>> def add_listener(type, &block)
>>      return
>> end
>> 
> 
> That is fine if you only use Browser#goto to navigate (assuming the
> page you goto doesn't do anything of importance in its onload
> handler). If you click links or interact with the page in other ways
> you're going to experience a lot of problems. Try running the
> watirspec suite to see what fails with that change.
> _______________________________________________
> Celerity-users mailing list
> Celerity-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/celerity-users



More information about the Celerity-users mailing list