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: Fix conflicts with multiple installations #71

Merged

Conversation

joeyparrish
Copy link
Member

Most polyfills used in Shaka Player can be installed more than once, because they can check for the necessity of the polyfill synchronously. This is not the case for eme-encryption-scheme-polyfill, which has to install a temporary shim to determine the need for a true polyfill on the first call.

This polyfill checked for a previous installation, but only using a static field on the class. This system breaks in our test environment, where there can be multiple copies of the polyfill: one compiled into Shaka Player as an internal component, and one in source form for unit tests. When both of these are installed at once, they couldn't detect each other because their private static fields were on distinct classes.

To resolve this, we attach bools to navigator that allow multiple versions of the polyfill to detect each other. This fixes Shaka Player test failures and mistakenly skipped tests on some platforms.

Most polyfills used in Shaka Player can be installed more than once, because they can check for the necessity of the polyfill synchronously.  This is not the case for eme-encryption-scheme-polyfill, which has to install a temporary shim to determine the need for a true polyfill on the first call.

This polyfill checked for a previous installation, but only using a static field on the class.  This system breaks in our test environment, where there can be multiple copies of the polyfill: one compiled into Shaka Player as an internal component, and one in source form for unit tests.  When both of these are installed at once, they couldn't detect each other because their private static fields were on distinct classes.

To resolve this, we attach bools to `navigator` that allow multiple versions of the polyfill to detect each other.  This fixes Shaka Player test failures and mistakenly skipped tests on some platforms.
@avelad avelad merged commit d74823f into shaka-project:main May 16, 2024
7 checks passed
@joeyparrish joeyparrish deleted the fix-multiple-install-conflicts branch May 16, 2024 05:21
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Oct 10, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: archived Archived and locked; will not be updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants