[ htmlunit-Bugs-1495132 ] HtmlElement.parseHtmlSnippet should deregister WebWindow

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ htmlunit-Bugs-1495132 ] HtmlElement.parseHtmlSnippet should deregister WebWindow

SourceForge.net
Bugs item #1495132, was opened at 2006-05-25 21:50
Message generated for change (Comment added) made by mguillem
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1495132&group_id=47038

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: 1.8
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Ben Flynn (benf1977)
>Assigned to: Marc Guillemot (mguillem)
Summary: HtmlElement.parseHtmlSnippet should deregister WebWindow

Initial Comment:
In the HTMLElement.parseHtmlSnippet(final String
htmlSnippet) method, a "psuedoWindow" is created in
order to parse an HtmlSnippet as seen here:

final WebWindow pseudoWindow = new WebWindowImpl(webClient)

Instantiating this WebWindowImpl necessarily registers
the WebWindow with the the WebClient.  It does some
processing and returns a Collection, but doesn't clean
up the psuedoWindow (it remains registered with the
WebClient).  This WebWindow should be de-registered.

I recommend moving the declaration of the psuedoWindow
variable outside of the try block (and making it
non-final), and adding the following lines to the
finally block:

if (psuedoWindow != null) {
   webClient.deregisterWebWindow(pseudoWindow);
}

This method can be found approximately 480 lines into:
com.gargoylesoftware.htmlunit.javascript.host.HTMLElement

I have the 1.8 source code.  I attached the source code
with the change I proposed in place.

Thanks!

----------------------------------------------------------------------

>Comment By: Marc Guillemot (mguillem)
Date: 2006-09-11 15:08

Message:
Logged In: YES
user_id=402164

Now fixed in SVN.

When you find a bug, please first expose it before proposing
a solution. Indeed to be sure that there is a problem, I
must first be able to reproduce it.

----------------------------------------------------------------------

Comment By: Marc Guillemot (mguillem)
Date: 2006-05-26 09:19

Message:
Logged In: YES
user_id=402164

Can you send your patch in unified diff format?
Can you provide a unit test (Fixes are not performed without
unit test.)?

Both really help committers to integrate the fix quickly.

----------------------------------------------------------------------

Comment By: Ben Flynn (benf1977)
Date: 2006-05-25 21:52

Message:
Logged In: YES
user_id=1528760

Note that I attached only the changed method, not the
complete HTMLElement.java file.

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=448266&aid=1495132&group_id=47038

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop