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

Leaking window.__powerCalendars #542

Closed
apellerano-pw opened this issue Feb 5, 2025 · 3 comments
Closed

Leaking window.__powerCalendars #542

apellerano-pw opened this issue Feb 5, 2025 · 3 comments

Comments

@apellerano-pw
Copy link
Contributor

apellerano-pw commented Feb 5, 2025

The code currently creates a window.__powerCalendars hash, and fills it as you create more instances of power-calendar.

However if the last instance of power-calendar is destroyed, it will still leave an empty hash. The unregisterCalendar hook could check Object.keys(window.__powerCalendars).length and delete the property from window if there are no more entries.

This would prevent power-calendar from tripping QUnit's useful "Check for Globals" feature, which detects global state leaks like this.

Any code checking the hash will also need to first check that the hash exists.

@mkszepp
Copy link
Collaborator

mkszepp commented Feb 6, 2025

@apellerano-pw thanks for reporting.

Would you like to make a PR to fix this issue?

@apellerano-pw
Copy link
Contributor Author

Here's one #543

I tested by running the test-app's QUnit suite in browser, and observed that __powerCalendars is no longer in the list of leaked objects

@mkszepp
Copy link
Collaborator

mkszepp commented Feb 7, 2025

fixed by #543

@mkszepp mkszepp closed this as completed Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants