RFR: 8088420: JavaFX WebView memory leak via EventListener [v2]
Kevin Rushforth
kcr at openjdk.java.net
Fri May 20 12:24:54 UTC 2022
On Thu, 19 May 2022 22:01:31 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Jay Bhaskar has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Platform.exit() , removing code block, as it is causing other test fail
>
> modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java line 637:
>
>> 635: });
>> 636:
>> 637: assertEquals("Click count", 1, listeners1.get(0).getClickCount());
>
> You should add a comment that this check is testing that the immediately previous click does _not_ get delivered since the associated DOM node is not part of the page any more. This is why the count remains at 1 (from the first click on the original page).
>
>
> Also, I think it would be useful here to clear the references to the listeners and WebView and make sure that the listener attached to the previously loaded page for this WebView gets released. Something like this as the final statements of the method:
>
>
> // Clear strong reference to listener and WebView
> listeners1.clear();
> webView1 = null;
>
> // Verify that there is no strong reference to the WebView
> assertNumActive("WebView", webViewRefs, 0);
>
> // Verify that no listeners are strongly held
> assertNumActive("MyListener", listenerRefs, 0);
You will also need to clear the references to the DOM nodes, and set `webView2 = null;` for this to work.
-------------
PR: https://git.openjdk.java.net/jfx/pull/799
More information about the openjfx-dev
mailing list