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 leaks #108

Merged
merged 3 commits into from
Aug 28, 2023
Merged

Fix leaks #108

merged 3 commits into from
Aug 28, 2023

Conversation

jhonatangcavalcanti
Copy link
Member

Summary

This PR fixes a leak of the contextmenu event handler on the video tag and prevents adding multiple style tag children to the core when changing the video with the load method.

Changes

  • core.js:
    • Add style only once
  • html5_video.js:
    • Remove contextmenu on destroy

How to test

  1. Play the sample media
  2. Run load on the same sample media many times
  3. There should be no duplicated style tags and only one contextmenu listener

Images

Before this PR

Screenshot 2023-08-28 at 14 01 46

After this PR

Screenshot 2023-08-28 at 14 02 31

For each call to load method, the core was appending new style tags, creating unnecessary multiple
DOM elements
The contextmenu event was not removed. This was causing a leak of event listeners since a new
listener was added but not removed for each player load call.
@pedrochamberlain pedrochamberlain merged commit 4e73425 into master Aug 28, 2023
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

Successfully merging this pull request may close these issues.

3 participants