mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-14 15:56:38 +03:00
Add a test util for dumping and restoring from IDB
This makes it easy to dump and restore databases from IndexedDB. This, in turn, makes it easy for us to test that all database versions can be read. Before we close the backward compatibility issue that has plagued v2.3, we will add tests that use this utility to load DB snapshots from various older schemas and prove that they can still be read. This also adds dumps of all database versions to the assets folder, including a snapshot of a what our broken upgrade in v2.3.0 did to the v2 database schema. Issue #1248 Change-Id: If7e8995f50abbdee67e3fa93e79f07a49582c5e8
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
|
||||
goog.provide('shaka.util.Uint8ArrayUtils');
|
||||
|
||||
goog.require('shaka.util.StringUtils');
|
||||
|
||||
|
||||
/**
|
||||
* @namespace shaka.util.Uint8ArrayUtils
|
||||
@@ -36,7 +38,7 @@ goog.provide('shaka.util.Uint8ArrayUtils');
|
||||
*/
|
||||
shaka.util.Uint8ArrayUtils.toBase64 = function(arr, opt_padding) {
|
||||
// btoa expects a "raw string" where each character is interpreted as a byte.
|
||||
let bytes = String.fromCharCode.apply(null, arr);
|
||||
let bytes = shaka.util.StringUtils.fromCharCode(arr);
|
||||
let padding = (opt_padding == undefined) ? true : opt_padding;
|
||||
let base64 = window.btoa(bytes).replace(/\+/g, '-').replace(/\//g, '_');
|
||||
return padding ? base64 : base64.replace(/=*$/, '');
|
||||
|
||||
Reference in New Issue
Block a user