From 993320655e8d25097bea06744b00f2c3b58eeca6 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Sun, 5 Jul 2020 06:21:40 -0400 Subject: [PATCH] fx-compat: Throw error if generator is passed to DB.executeTransaction() --- chrome/content/zotero/xpcom/db.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js index d68664b6d3..791d79b137 100644 --- a/chrome/content/zotero/xpcom/db.js +++ b/chrome/content/zotero/xpcom/db.js @@ -466,6 +466,12 @@ Zotero.DBConnection.prototype.executeTransaction = async function (func, options } var conn = this._getConnection(options) || (await this._getConnectionAsync(options)); + + if (func.constructor.name == 'GeneratorFunction') { + throw new Error("Zotero.DB.executeTransaction() no longer takes a generator function " + + "-- pass an async function instead"); + } + var result = await conn.executeTransaction(func); Zotero.debug(`Committed DB transaction ${id}`, 4);