forked from shaka-project/shaka-player
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cmcd): Fix Symbol usage in CMCD on Xbox One (shaka-project#4073)
Close shaka-project#4072 Co-authored-by: Joey Parrish <[email protected]>
- Loading branch information
1 parent
3822519
commit 4005754
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters