Source: lib/polyfill/indexed_db.js

  1. /**
  2. * @license
  3. * Copyright 2016 Google Inc.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. goog.provide('shaka.polyfill.IndexedDB');
  18. goog.require('goog.asserts');
  19. goog.require('shaka.log');
  20. goog.require('shaka.polyfill.register');
  21. /**
  22. * @namespace shaka.polyfill.IndexedDB
  23. *
  24. * @summary A polyfill to patch IndexedDB bugs.
  25. */
  26. /**
  27. * Install the polyfill if needed.
  28. */
  29. shaka.polyfill.IndexedDB.install = function() {
  30. shaka.log.debug('IndexedDB.install');
  31. let agent = navigator.userAgent;
  32. if (agent && agent.indexOf('CrKey') >= 0) {
  33. shaka.log.debug('Removing IndexedDB from ChromeCast');
  34. delete window.indexedDB;
  35. goog.asserts.assert(
  36. !window.indexedDB, 'Failed to override window.indexedDB');
  37. }
  38. };
  39. shaka.polyfill.register(shaka.polyfill.IndexedDB.install);