Skip to content

Commit

Permalink
fix(cast): Fix Shaka+Cast apps using IndexedDB
Browse files Browse the repository at this point in the history
The IndexedDB polyfill was preventing Cast apps from using IndexedDB
outside of Shaka Player.  Instead of breaking IDB, we should just
directly disallow offline storage on the Cast platform.

Fixes #2850

b/168565999

Change-Id: Ie504531c412723cc0f93530b2e34000873bfaf32
  • Loading branch information
joeyparrish committed Sep 17, 2020
1 parent ee5fe52 commit 256f89d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 57 deletions.
1 change: 0 additions & 1 deletion build/types/polyfill
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
+../../node_modules/eme-encryption-scheme-polyfill/index.js
+../../lib/polyfill/encryption_scheme.js
+../../lib/polyfill/fullscreen.js
+../../lib/polyfill/indexed_db.js
+../../lib/polyfill/input_event.js
+../../lib/polyfill/languages.js
+../../lib/polyfill/mathround.js
Expand Down
12 changes: 9 additions & 3 deletions lib/offline/indexeddb/storage_mechanism.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,13 @@ shaka.offline.indexeddb.StorageMechanism.SESSION_ID_STORE = 'session-ids';
shaka.offline.StorageMuxer.register(
'idb',
() => {
return window.indexedDB ?
new shaka.offline.indexeddb.StorageMechanism() :
null;
// Offline storage is not supported on the Chromecast platform.
if (shaka.util.Platform.isChromecast()) {
return null;
}
// Offline storage requires the IndexedDB API.
if (!window.indexedDB) {
return null;
}
return new shaka.offline.indexeddb.StorageMechanism();
});
52 changes: 0 additions & 52 deletions lib/polyfill/indexed_db.js

This file was deleted.

1 change: 0 additions & 1 deletion shaka-player.uncompiled.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ goog.require('shaka.offline.Storage');
goog.require('shaka.offline.indexeddb.StorageMechanism');
goog.require('shaka.polyfill.EncryptionScheme');
goog.require('shaka.polyfill.Fullscreen');
goog.require('shaka.polyfill.IndexedDB');
goog.require('shaka.polyfill.InputEvent');
goog.require('shaka.polyfill.MathRound');
goog.require('shaka.polyfill.MediaSource');
Expand Down

0 comments on commit 256f89d

Please sign in to comment.