[ 
http://jira.openqa.org/browse/WTR-462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=19994#action_19994
 ] 

Jarmo Pertman commented on WTR-462:
-----------------------------------

I think that using #_new_window_init like that is not intended since it is an 
internal method (notice the leading underscore).

But adding that one assignment statement wouldn't hurt also i guess. Although 
i'd put it into #_new_window_init method instead of #close because if you 
execute #close multiple times in a row currently then #exists? would return 
false for the second invocation which is the correct behavior.

> Watir::IE#close doesn't set @closing variable to false after closing IE
> -----------------------------------------------------------------------
>
>                 Key: WTR-462
>                 URL: http://jira.openqa.org/browse/WTR-462
>             Project: Watir
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 1.6.7
>         Environment: WIN XP, IE7
>            Reporter: Alan Baird
>            Priority: Major
>
> All -
> Consider the following example where I am trying to restart a browser using 
> Watir's instance methods:
> irb(main):001:0> require 'watir'
> => true
> irb(main):002:0> br = Watir::IE.new
> => #<Watir::IE:0x2e384a4 url="about:blank" title=""> irb(main):003:0> br.goto 
> 'google.com'
> => 1.641
> irb(main):004:0> br.close
> => nil
> irb(main):005:0> br._new_window_init
> => 0.422
> irb(main):006:0> br.goto 'google.com'
> => 0.859
> irb(main):007:0> br.close
> => nil
> This actually works just fine until the last line where the browser doesn't 
> close (but the first br.close does close the browser).  
> So, I examined the close method:
>     # Closes the Browser
>     def close
>       return unless exists?
>       @closing = true
>       @ie.stop
>       wait rescue nil
>       chwnd = @ie.hwnd.to_i
>       @ie.quit
>       while Win32API.new("user32","IsWindow", 'L', 'L').Call(chwnd) == 1
>         sleep 0.3
>       end
>     end
> Note that @closing is never set to false.  Thus, whenever close is called 
> subsequently, it will return immediately because the first thing #exists? 
> does is: 
>       return false if @closing
> The fix is simple, just add @closing = false to the end of #close.  I tested 
> this in a monkeypatched version and it fixes the problem as I recreated it in 
> IRB above.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.openqa.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
Wtr-development mailing list
Wtr-development@rubyforge.org
http://rubyforge.org/mailman/listinfo/wtr-development

Reply via email to