Fx60: Update DB query onRow() behavior
onRow() handlers now get passed a cancellation function as a second argument
This commit is contained in:
parent
564e72196f
commit
b08bd6849e
3 changed files with 12 additions and 18 deletions
|
@ -151,16 +151,17 @@ describe("Zotero.DB", function() {
|
|||
assert.equal(e.message, "Failed");
|
||||
});
|
||||
|
||||
it("should stop gracefully if onRow throws a StopIteration", function* () {
|
||||
it("should stop gracefully if onRow calls cancel()", function* () {
|
||||
var i = 0;
|
||||
var rows = [];
|
||||
yield Zotero.DB.queryAsync(
|
||||
"SELECT * FROM " + tmpTable,
|
||||
false,
|
||||
{
|
||||
onRow: function (row) {
|
||||
onRow: function (row, cancel) {
|
||||
if (i > 0) {
|
||||
throw StopIteration;
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
rows.push(row.getResultByIndex(0));
|
||||
i++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue