Menu

#1645 Temporary response files deleted too early

Latest SVN
open
nobody
None
1
2014-10-23
2014-10-09
No

Hi Guys,

I've noticed that since HtmlUnit v2.14 the temporary files holding the response of external JavaScript/CSS are deleted immediately after parsing them. But the webresponse is still alive and might be cached; at least in my case since I am using a custom web-connection that caches responses as real browsers do.
Subsequent attempts to access the webresponse's content obviously fail since the files are gone.

May I suggest to trigger the WebResponseData cleanUp procedure when it is assumed to be garbage collected by overriding finalize(), and to remove the response.cleanUp() statements in HtmlPage#loadJavaScriptFromUrl() and CSSStyleSheet.loadStyleSheet()? This way, the files will be removed when the container object is not referenced anymore.
I've attached a proper patch file that accomplishes this.

Please let me know your thoughts.

Thanks,
H

1 Attachments

Discussion


Log in to post a comment.