Skip to content
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

fix: attach polymer binding callback to a promise that always resolves #14729

Merged
merged 1 commit into from
Oct 5, 2022

Conversation

mcollovati
Copy link
Collaborator

Description

Polymer binding callback was attached to the promise returned by customElements.whenDefined, but this promise may never complete if the input element is not a custom element, causing memory leaks on browser because of element capture.
This change introduces a new promise that completes either when whenDefined is fulfilled or after a fixed timeout, allowing the garbage collector to clean resources.

Fixes #14422

Type of change

  • Bugfix
  • Feature

Checklist

  • I have read the contribution guide: https://vaadin.com/docs/latest/guide/contributing/overview/
  • I have added a description following the guideline.
  • The issue is created in the corresponding repository and I have referenced it.
  • I have added tests to ensure my change is effective and works as intended.
  • New and existing tests are passing locally with my change.
  • I have performed self-review and corrected misspellings.

Additional for Feature type of change

  • Enhancement / new feature was discussed in a corresponding GitHub issue and Acceptance Criteria were created.

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
@sonarcloud
Copy link

sonarcloud bot commented Oct 4, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

@github-actions
Copy link

github-actions bot commented Oct 4, 2022

Unit Test Results

   955 files  ±0     955 suites  ±0   52m 27s ⏱️ + 1m 57s
6 082 tests ±0  6 028 ✔️ ±0  54 💤 ±0  0 ±0 
6 344 runs  ±0  6 282 ✔️ ±0  62 💤 ±0  0 ±0 

Results for commit ce97925. ± Comparison against base commit babfef2.

@mcollovati mcollovati added this to Iteration Reviews in OLD Vaadin Flow ongoing work (Vaadin 10+) via automation Oct 4, 2022
@mshabarov mshabarov self-requested a review October 5, 2022 06:50
@mshabarov mshabarov merged commit dc00ef1 into master Oct 5, 2022
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from Iteration Reviews to Done - pending release Oct 5, 2022
@mshabarov mshabarov deleted the issues/14422_dom_memory_leak branch October 5, 2022 11:25
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729) (#14755)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422

Co-authored-by: Marco Collovati <marco@vaadin.com>
ZheSun88 pushed a commit that referenced this pull request Oct 7, 2022
#14729) (#14754)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422

Co-authored-by: Marco Collovati <marco@vaadin.com>
mcollovati added a commit that referenced this pull request Oct 7, 2022
#14729) (#14757)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422

Co-authored-by: Marco Collovati <marco@vaadin.com>
mcollovati pushed a commit that referenced this pull request Oct 7, 2022
#14729) (CP: 2.7) (#14758)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
mcollovati pushed a commit that referenced this pull request Oct 7, 2022
#14729) (CP: 2.8) (#14756)

Polymer binding callback was attached to the promise returned by
customElements.whenDefined, but this promise may never complete
if the input element is not a custom element, causing memory leaks
on browser because of element capture.
This change introduces a new promise that completes either when
whenDefined is fulfilled or after a fixed timeout, allowing
the garbage collector to clean resources.

Fixes #14422
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
OLD Vaadin Flow ongoing work (Vaadin ...
  
Done - pending release
Development

Successfully merging this pull request may close these issues.

When removing a custom component with @Tag, a DetachedHTMLElement occurs
3 participants