New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8088420: JavaFX WebView memory leak via EventListener #799
Conversation
👋 Welcome back jbhaskar! A progress list of the required criteria for merging this PR into |
Webrevs
|
/reviewers 2 |
@kevinrushforth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While testing, I noticed one problem in that the new unit tests calls Platform.exit()
(this was my fault for adding it when sending you the test case), causing any subsequent web test to fail.
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix looks good with a couple questions about removing entries from the map when they are done and some cleanup comments.
In addition to the inline comments I left about the test, I think the following scenarios should be added to the automated test:
- Multiple listeners single webiew implicit release (i.e., WebView goes out of scope)
- Multiple listeners multiple webiew with explicit release of one webview and implicit release of the other (this one is basically a combination of the others)
- Ref count test (single webview is fine) with adding and removing listeners. It should handle the cases of both increasing and decreasing the ref count, and adding the listener to another DOM node after its ref count has gone to zero to make sure that case works.
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.h
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/JavaEventListener.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple comments and one question on the changes to the fix.
The new tests look good. I left a few comments and suggestions on the test, but overall they are good additions to verify the fix.
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.h
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.h
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My review is not complete. I shall continue later. Providing few comments for now.
Please take a look.
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.h
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/JavaEventListener.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.h
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a couple comments on one of your test changes.
I think the only remaining question (aside from the few minor comments that Ambarish left) is around the logic in EventListenerManager::resetDOMWindow
.
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.h
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comments inline.
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/test/java/test/javafx/scene/web/EventListenerLeakTest.java
Outdated
Show resolved
Hide resolved
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look good. While doing my final review I noticed one more thing that I think should be changed.
modules/javafx.web/src/main/native/Source/WebCore/bindings/java/EventListenerManager.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jaybhaskar This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 3 new commits pushed to the
Please see this link for an up-to-date comparison between the source branch of this pull request and the As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@kevinrushforth, @arapte) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
@jaybhaskar |
/sponsor |
Going to push as commit f534850.
Your commit was automatically rebased without conflicts. |
@kevinrushforth @jaybhaskar Pushed as commit f534850. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
This PR is new implementation of JavaEvent listener memory management.
Issue JDK-8088420
Solution:
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jfx pull/799/head:pull/799
$ git checkout pull/799
Update a local copy of the PR:
$ git checkout pull/799
$ git pull https://git.openjdk.java.net/jfx pull/799/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 799
View PR using the GUI difftool:
$ git pr show -t 799
Using diff file
Download this PR as a diff file:
https://git.openjdk.java.net/jfx/pull/799.diff