Javascript 使用IndexedDB创建多个对象存储时,Safari 7.1中出现未知错误

Javascript 使用IndexedDB创建多个对象存储时,Safari 7.1中出现未知错误,javascript,safari,indexeddb,Javascript,Safari,Indexeddb,我想检查一下是否有人对Safari 7.1和IndexedDB有问题。似乎我得到了UnknownError类型的错误,根据规范,当“操作因与数据库本身无关的原因而失败,且未被任何其他错误覆盖”时,会发生此错误。在第一次调用回调(onSuccess或onError)后,我第二次调用此函数时会发生此错误。下面是我创建对象存储的函数,它可以在Chrome和Firefox中使用 IndexedDBClient.prototype.createObjectStore = function(options)

我想检查一下是否有人对Safari 7.1和IndexedDB有问题。似乎我得到了UnknownError类型的错误,根据规范,当“操作因与数据库本身无关的原因而失败,且未被任何其他错误覆盖”时,会发生此错误。在第一次调用回调(onSuccess或onError)后,我第二次调用此函数时会发生此错误。下面是我创建对象存储的函数,它可以在Chrome和Firefox中使用

IndexedDBClient.prototype.createObjectStore = function(options) {
  if (this.checkIfObjectStoreExists(options.objectStoreName)) {
    options.onError(this.objectStoreDNEMessage);
    return;
  }

  var objectStore;

  var objectStoreCreated = false;
  var databaseOpened = false;

  var version = this.database.version;
  var dbName = this.database.name;
  this.database.close();
  var request = indexedDB.open(dbName, ++version);
  var that = this;

  request.onupgradeneeded = function(e) {
    that.database = e.target.result;
    objectStore = that.database.createObjectStore(options.objectStoreName, { keyPath: options.keyPathName });

    objectStore.transaction.oncomplete = function(e) {
      objectStoreCreated = true;
      successCallback();
    }

    objectStore.transaction.onerror = function(e) {
      options.onError(e);
    };
  };

  request.onsuccess = function(e) {
    databaseOpened = true;
    successCallback();
  }

  request.onerror = function(e) {
    options.onError(e);
  };

  request.onblocked = function(e) {
    typeof options.onBlocked === 'function' && options.onBlocked();
  };

  function successCallback() {
    // This is needed because we must be sure that both the objectstore creation transaction has completed,
    // and the db open request has fired the onsuccess event.
    objectStoreCreated && databaseOpened && options.onSuccess(objectStore);
  }
};

Safari浏览器中的IndexedDB API在多个存储事务上具有相同的功能