Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix conflicts with multiple installations (#71)
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.
- Loading branch information