Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cmcd): Fix Symbol usage in CMCD on Xbox One #4073

Merged
merged 2 commits into from Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions build/types/polyfill
Expand Up @@ -15,6 +15,7 @@
+../../lib/polyfill/pip_webkit.js
+../../lib/polyfill/random_uuid.js
+../../lib/polyfill/storage_estimate.js
+../../lib/polyfill/symbol.js
+../../lib/polyfill/video_play_promise.js
+../../lib/polyfill/videoplaybackquality.js
+../../lib/polyfill/vttcue.js
46 changes: 46 additions & 0 deletions lib/polyfill/symbol.js
@@ -0,0 +1,46 @@
/*! @license
* Shaka Player
* Copyright 2016 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.provide('shaka.polyfill.Symbol');

goog.require('shaka.log');
goog.require('shaka.polyfill');

/**
* @summary A polyfill to provide Symbol.prototype.description in all browsers.
* See: https://caniuse.com/mdn-javascript_builtins_symbol_description
* @export
*/
shaka.polyfill.Symbol = class {
/**
* Install the polyfill if needed.
* @export
*/
static install() {
shaka.log.debug('Symbol.install');

// eslint-disable-next-line no-restricted-syntax
const proto = Symbol.prototype;

if (!('description' in proto)) {
Object.defineProperty(proto, 'description', {
get: shaka.polyfill.Symbol.getSymbolDescription_,
});
}
}

/**
* @this {Symbol}
* @return {(string|undefined)}
* @private
*/
static getSymbolDescription_() {
const m = /\((.*)\)/.exec(this.toString());
return m ? m[1] : undefined;
}
};


shaka.polyfill.register(shaka.polyfill.Symbol.install);
1 change: 1 addition & 0 deletions shaka-player.uncompiled.js
Expand Up @@ -45,6 +45,7 @@ goog.require('shaka.polyfill.PatchedMediaKeysNop');
goog.require('shaka.polyfill.PatchedMediaKeysWebkit');
goog.require('shaka.polyfill.PiPWebkit');
goog.require('shaka.polyfill.RandomUUID');
goog.require('shaka.polyfill.Symbol');
goog.require('shaka.polyfill.VTTCue');
goog.require('shaka.polyfill.VideoPlayPromise');
goog.require('shaka.polyfill.VideoPlaybackQuality');
Expand Down