www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit f99038fd37a2baf14c474e282fe0015ad324f0b0
parent 757709cf43cef7794659738b9dae50b936a6079f
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 28 Feb 2018 17:32:23 -0500

Fix recognizer dialog with multiple tests

Do cleanup on 'unload' rather than 'close' (which is limited to a click
on the close button and doesn't get called for win.close()) and clear
the queue after each test.

Diffstat:
Mchrome/content/zotero/recognizePDFDialog.js | 17+++++++++--------
Mtest/tests/recognizePDFTest.js | 1+
2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/chrome/content/zotero/recognizePDFDialog.js b/chrome/content/zotero/recognizePDFDialog.js @@ -51,14 +51,7 @@ var Zotero_RecognizePDF_Dialog = new function () { }; function close() { - if (!_progressWindow) return; - Zotero.RecognizePDF.removeListener('rowadded'); - Zotero.RecognizePDF.removeListener('rowupdated'); - Zotero.RecognizePDF.removeListener('rowdeleted'); _progressWindow.close(); - _progressWindow = null; - _progressIndicator = null; - _rowIDs = []; } function _getImageByStatus(status) { @@ -143,7 +136,15 @@ var Zotero_RecognizePDF_Dialog = new function () { close(); } }); - _progressWindow.addEventListener('close', close.bind(this), false); + + _progressWindow.addEventListener('unload', function () { + Zotero.RecognizePDF.removeListener('rowadded'); + Zotero.RecognizePDF.removeListener('rowupdated'); + Zotero.RecognizePDF.removeListener('rowdeleted'); + _progressWindow = null; + _progressIndicator = null; + _rowIDs = []; + }); _updateProgress(); diff --git a/test/tests/recognizePDFTest.js b/test/tests/recognizePDFTest.js @@ -19,6 +19,7 @@ describe("PDF Recognition", function() { for(let win of getWindows("chrome://zotero/content/recognizePDFDialog.xul")) { win.close(); } + Zotero.RecognizePDF.cancel(); }); after(function() {