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.
This commit is contained in:
parent
757709cf43
commit
f99038fd37
2 changed files with 10 additions and 8 deletions
|
@ -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();
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue