Files
shaka-player/lib/polyfill/indexed_db.js
T
Joey Parrish f539147d48 fix: Correct license headers in compiled output
This fixes all the license headers in the main library, which corrects
the appearance of the main license in the compiled output.

It seems that the `!` in the header forces the compiler to keep it in
the output.  I believe older compiler releases did this purely based
on `@license`.

Issue #2638

Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
2020-06-09 16:05:09 -07:00

52 lines
1.2 KiB
JavaScript

/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.polyfill.IndexedDB');
goog.require('goog.asserts');
goog.require('shaka.log');
goog.require('shaka.polyfill');
/**
* @summary A polyfill to patch IndexedDB bugs.
*/
shaka.polyfill.IndexedDB = class {
/**
* Install the polyfill if needed.
*/
static install() {
shaka.log.debug('IndexedDB.install');
let disableIDB = false;
if (shaka.util.Platform.isChromecast()) {
shaka.log.debug('Removing IndexedDB from ChromeCast');
disableIDB = true;
} else {
try {
// This is necessary to avoid Closure compiler over optimize this
// block and remove it if it looks like a noop
if (window.indexedDB) {
disableIDB = false;
}
} catch (e) {
shaka.log.debug(
'Removing IndexedDB due to an exception when accessing it');
disableIDB = true;
}
}
if (disableIDB) {
delete window.indexedDB;
goog.asserts.assert(
!window.indexedDB, 'Failed to override window.indexedDB');
}
}
};
shaka.polyfill.register(shaka.polyfill.IndexedDB.install);