static dbOpenNew_(name, version, upgrade) {
    let upgraded = false;

    /** @type {!shaka.util.PublicPromise} */
    const p = new shaka.util.PublicPromise();

    const open = window.indexedDB.open(name, version);
    open.onerror = (e) => {
      p.reject();
    };
    open.onsuccess = (e) => {
      // Make sure that the database actually upgraded when connecting or else
      // we will have an old copy.
      if (upgraded) {
        p.resolve(open.result);
      } else {
        // Make sure to close the connection as we won't be using it.
        open.result.close();
        p.reject();
      }
    };
    open.onupgradeneeded = (e) => {
      upgrade(/** @type {IDBDatabase} */ (open.result));
      upgraded = true;
    };

    return p;
  }
@param {string} name
@param {number} version
@param {function(IDBDatabase)} upgrade

@return {!Promise<IDBDatabase>}
@private