fix: Fix getOrInsertComputed is not available at the init, so not used at the init (#10202)

getOrInsertComputed is not available at init, until polyfills are used,
but the problem that this PR fixes is that there is a call that uses it
before calling the polyfill.
This commit is contained in:
Álvaro Velad Galván
2026-06-11 10:39:27 +02:00
committed by GitHub
parent 0f8f2edea2
commit 1c63e75557
+4 -1
View File
@@ -81,7 +81,10 @@ shaka.metadata.Metadata = class {
*/
static registerParserByMime(mimeType, parserFactory) {
const map = shaka.metadata.Metadata.parsersByMime_;
map.getOrInsertComputed(mimeType, () => []).push(parserFactory);
if (!map.has(mimeType)) {
map.set(mimeType, []);
}
map.get(mimeType).push(parserFactory);
}
/**