From 45ddf9827ce9658576fbf4d30ac4193da421629b Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 5 Feb 2018 23:09:17 -0500 Subject: [PATCH] Reset PDF tools path for tests in resetDB() And include path on error when running PDF tool --- chrome/content/zotero/xpcom/fulltext.js | 8 ++++---- test/content/support.js | 13 ++++++------- test/tests/fulltextTest.js | 1 - test/tests/recognizePDFTest.js | 1 - 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/chrome/content/zotero/xpcom/fulltext.js b/chrome/content/zotero/xpcom/fulltext.js index 9c7e656881..27f99c4948 100644 --- a/chrome/content/zotero/xpcom/fulltext.js +++ b/chrome/content/zotero/xpcom/fulltext.js @@ -446,7 +446,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){ var totalPages = yield getTotalPagesFromFile(itemID); } catch (e) { - Zotero.debug("Error running pdfinfo"); + Zotero.debug("Error running " + _pdfInfo.path, 1); + Zotero.logError(e); } @@ -468,9 +469,8 @@ Zotero.Fulltext = Zotero.FullText = new function(){ yield Zotero.Utilities.Internal.exec(exec, args); } catch (e) { - Components.utils.reportError(e); - Zotero.debug("Error running pdftotext", 1); - Zotero.debug(e, 1); + Zotero.debug("Error running " + exec.path, 1); + Zotero.logError(e); return false; } diff --git a/test/content/support.js b/test/content/support.js index 4b10f44a28..e1c9efadcd 100644 --- a/test/content/support.js +++ b/test/content/support.js @@ -566,7 +566,7 @@ var removeDir = Zotero.Promise.coroutine(function* (dir) { * @param {Object} [options] - Initialization options, as passed to Zotero.init(), overriding * any that were set at startup */ -function resetDB(options = {}) { +async function resetDB(options = {}) { // Hack to avoid CustomizableUI warnings in console from icon.js var toolbarIconAdded = Zotero.toolbarIconAdded; resetPrefs(); @@ -575,18 +575,17 @@ function resetDB(options = {}) { options.thisArg.timeout(60000); } var db = Zotero.DataDirectory.getDatabase(); - return Zotero.reinit( + await Zotero.reinit( Zotero.Promise.coroutine(function* () { yield OS.File.remove(db); _defaultGroup = null; }), false, options - ) - .then(() => { - Zotero.toolbarIconAdded = toolbarIconAdded; - return Zotero.Schema.schemaUpdatePromise; - }); + ); + Zotero.toolbarIconAdded = toolbarIconAdded; + await Zotero.Schema.schemaUpdatePromise; + initPDFToolsPath(); } /** diff --git a/test/tests/fulltextTest.js b/test/tests/fulltextTest.js index b8937917cf..02d1ce4279 100644 --- a/test/tests/fulltextTest.js +++ b/test/tests/fulltextTest.js @@ -5,7 +5,6 @@ describe("Zotero.Fulltext", function () { // Hidden browser, which requires a browser window, needed for charset detection // (until we figure out a better way) win = yield loadBrowserWindow(); - initPDFToolsPath(); }); after(function () { if (win) { diff --git a/test/tests/recognizePDFTest.js b/test/tests/recognizePDFTest.js index 5384bd9a89..9d80a1294c 100644 --- a/test/tests/recognizePDFTest.js +++ b/test/tests/recognizePDFTest.js @@ -9,7 +9,6 @@ describe("PDF Recognition", function() { yield Zotero.Promise.all([ loadZoteroPane().then(w => win = w) ]); - initPDFToolsPath(); }); beforeEach(function* () {