From a076edc8361ff955311edcb075a15c69b05bca3e Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 29 Dec 2016 15:39:09 -0500 Subject: [PATCH] Update some deprecated function calls --- chrome/content/zotero/xpcom/sync/syncEngine.js | 6 ++++-- chrome/content/zotero/xpcom/zotero.js | 2 +- resource/concurrentCaller.js | 6 ------ test/tests/syncFullTextEngineTest.js | 9 ++++++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/chrome/content/zotero/xpcom/sync/syncEngine.js b/chrome/content/zotero/xpcom/sync/syncEngine.js index af06737a7..15418cf16 100644 --- a/chrome/content/zotero/xpcom/sync/syncEngine.js +++ b/chrome/content/zotero/xpcom/sync/syncEngine.js @@ -274,7 +274,8 @@ Zotero.Sync.Data.Engine.prototype._startDownload = Zotero.Promise.coroutine(func } if (newLibraryVersion) { - yield Zotero.Libraries.setVersion(this.libraryID, newLibraryVersion); + this.library.libraryVersion = newLibraryVersion; + yield this.library.saveTx(); } return localChanges @@ -1513,7 +1514,8 @@ Zotero.Sync.Data.Engine.prototype._fullSync = Zotero.Promise.coroutine(function* break; } - yield Zotero.Libraries.setVersion(this.libraryID, lastLibraryVersion); + this.library.libraryVersion = lastLibraryVersion; + yield this.library.saveTx(); Zotero.debug("Done with full sync for " + this.library.name); diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 0feaa893e..19f031af5 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1453,7 +1453,7 @@ Services.scriptloader.loadSubScript("resource://zotero/polyfill.js"); caller.setLogger(Zotero.debug); return function () { var args = arguments; - return caller.fcall(function () { + return caller.start(function () { return fn.apply(this, args); }.bind(this)); }; diff --git a/resource/concurrentCaller.js b/resource/concurrentCaller.js index 19a08fd4a..ba3cc9e22 100644 --- a/resource/concurrentCaller.js +++ b/resource/concurrentCaller.js @@ -165,12 +165,6 @@ ConcurrentCaller.prototype.runAll = function () { } -ConcurrentCaller.prototype.fcall = function (func) { - this._log("fcall() is deprecated -- use start()"); - return this.start(func); -} - - /** * Wait for all running tasks to complete * diff --git a/test/tests/syncFullTextEngineTest.js b/test/tests/syncFullTextEngineTest.js index 66f5a9b90..b23710185 100644 --- a/test/tests/syncFullTextEngineTest.js +++ b/test/tests/syncFullTextEngineTest.js @@ -239,8 +239,10 @@ describe("Zotero.Sync.Data.FullTextEngine", function () { // https://github.com/cjohansen/Sinon.JS/issues/607 var fixSinonBug = ";charset=utf-8"; - var libraryID = Zotero.Libraries.userLibraryID; - yield Zotero.Libraries.setVersion(libraryID, 5); + var library = Zotero.Libraries.userLibrary; + var libraryID = library.id; + library.libraryVersion = 5; + yield library.saveTx(); ({ engine, client, caller } = yield setup()); @@ -347,7 +349,8 @@ describe("Zotero.Sync.Data.FullTextEngine", function () { // Upload new content // ({ engine, client, caller } = yield setup()); - yield Zotero.Libraries.setVersion(libraryID, libraryVersion); + library.libraryVersion = libraryVersion; + yield library.saveTx(); var attachment3 = new Zotero.Item('attachment'); attachment3.parentItemID = item.id;