Skip to content

Commit

Permalink
Revert use of new Function() in player config.
Browse files Browse the repository at this point in the history
Chrome App Content Security Policy prohibits use of new Fuction()
method. Revert the change that introduced it.

Closes #487

Change-Id: Id38522318affb9c5be8f6d2f4446e2967b43f58b
  • Loading branch information
ismena committed Aug 26, 2016
1 parent 40f8817 commit 05a5fb9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/offline/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,14 @@ shaka.offline.Storage.prototype.defaultTrackSelect_ = function(tracks) {
shaka.offline.Storage.prototype.defaultConfig_ = function() {
return {
trackSelectionCallback: this.defaultTrackSelect_.bind(this),
progressCallback: new Function('storedContent', 'percent', '')
progressCallback: function(storedContent, percent) {
// Reference arguments to keep closure from removing it.
// If the argument is removed, it breaks our function length check
// in mergeConfigObjects_().
// NOTE: Chrome App Content Security Policy prohibits usage of new
// Function().
if (storedContent || percent) return null;
}
};
};

Expand Down
11 changes: 10 additions & 1 deletion lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,16 @@ shaka.Player.prototype.defaultConfig_ = function() {
manifest: {
retryParameters: shaka.net.NetworkingEngine.defaultRetryParameters(),
dash: {
customScheme: new Function('node', ''),
customScheme: function(node) {
// Reference node to keep closure from removing it.
// If the argument is removed, it breaks our function length check
// in mergeConfigObjects_().
// TODO: Find a better solution if possible.
// NOTE: Chrome App Content Security Policy prohibits usage of new
// Function()

if (node) return null;
},
clockSyncUri: ''
}
},
Expand Down

0 comments on commit 05a5fb9

Please sign in to comment.