Remove check for ES5 generators in Zotero.DB.executeTransaction()
This doesn't work properly in some contexts and can break things. There might be a better test, but we probably don't need this anymore.
This commit is contained in:
parent
f78b18c692
commit
4cb5e7e4d5
1 changed files with 0 additions and 18 deletions
|
@ -89,10 +89,6 @@ Zotero.DBConnection = function(dbName) {
|
||||||
this._self = this;
|
this._self = this;
|
||||||
|
|
||||||
this._transactionPromise = null;
|
this._transactionPromise = null;
|
||||||
|
|
||||||
// Get GeneratorFunction, so we can test for an ES6 generator
|
|
||||||
var g = function* () { yield 1; };
|
|
||||||
this._generatorFunction = Object.getPrototypeOf(g).constructor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
|
@ -460,20 +456,6 @@ Zotero.DBConnection.prototype.executeTransaction = Zotero.Promise.coroutine(func
|
||||||
Zotero.debug("Async DB transaction in progress -- increasing level to "
|
Zotero.debug("Async DB transaction in progress -- increasing level to "
|
||||||
+ ++this._asyncTransactionNestingLevel, 5);
|
+ ++this._asyncTransactionNestingLevel, 5);
|
||||||
|
|
||||||
try {
|
|
||||||
// Check for ES5 generators, which don't work properly
|
|
||||||
if (func.isGenerator() && !(func instanceof this._generatorFunction)) {
|
|
||||||
Zotero.debug(func);
|
|
||||||
throw new Error("func must be an ES6 generator");
|
|
||||||
}
|
|
||||||
var result = yield Zotero.Promise.coroutine(func)();
|
|
||||||
}
|
|
||||||
catch (e) {
|
|
||||||
Zotero.debug("Rolled back nested async DB transaction", 5);
|
|
||||||
this._asyncTransactionNestingLevel = 0;
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
if (options.onCommit) {
|
if (options.onCommit) {
|
||||||
this._callbacks.current.commit.push(options.onCommit);
|
this._callbacks.current.commit.push(options.onCommit);
|
||||||
|
|
Loading…
Reference in a new issue