Add backward compatibility shim for exported util

This method (shaka.util.Uint8ArrayUtils.equal) was removed between
v2.5.0 and v2.6, but could be in use by applications.  This change
adds the utility method back, with a deprecation warning.

Change-Id: Ifd780759ae389e766c1889a83545cfda8969e76b
This commit is contained in:
Joey Parrish
2020-04-22 14:13:31 -07:00
parent 1e3e9f479d
commit 423e6c98e8
+17
View File
@@ -5,6 +5,7 @@
goog.provide('shaka.util.Uint8ArrayUtils');
goog.require('shaka.Deprecate');
goog.require('shaka.util.BufferUtils');
goog.require('shaka.util.Iterables');
goog.require('shaka.util.StringUtils');
@@ -15,6 +16,22 @@ goog.require('shaka.util.StringUtils');
* @exportDoc
*/
shaka.util.Uint8ArrayUtils = class {
/**
* Compare two Uint8Arrays for equality.
* @param {Uint8Array} arr1
* @param {Uint8Array} arr2
* @return {boolean}
* @deprecated
* @export
*/
static equal(arr1, arr2) {
shaka.Deprecate.deprecateFeature(
2, 7,
'shaka.util.Uint8ArrayUtils.equal',
'Please use shaka.util.BufferUtils.equal instead.');
return shaka.util.BufferUtils.equal(arr1, arr2);
}
/**
* Convert a buffer to a base64 string. The output will be standard
* alphabet as opposed to base64url safe alphabet.