From 026bce81a8f59c0f6da2ea77d17c3699546a7587 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 20 Sep 2011 06:23:44 +0000 Subject: [PATCH] Use Zotero.repaint() in callbacks instead of calling Zotero.wait() during translation to reduce non-determinism --- chrome/content/zotero/browser.js | 2 ++ chrome/content/zotero/fileInterface.js | 2 ++ chrome/content/zotero/xpcom/translation/translate.js | 6 ------ .../content/zotero/xpcom/translation/translate_firefox.js | 3 --- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/browser.js b/chrome/content/zotero/browser.js index 4c066879d0..9827f065f0 100644 --- a/chrome/content/zotero/browser.js +++ b/chrome/content/zotero/browser.js @@ -470,6 +470,8 @@ var Zotero_Browser = new function() { collection.addItem(dbItem.id); } + Zotero.repaint(window); + if(Zotero_Browser.isScraping) { // initialize close timer between item saves in case translator doesn't call done Zotero_Browser.progress.startCloseTimer(10000); // is this long enough? diff --git a/chrome/content/zotero/fileInterface.js b/chrome/content/zotero/fileInterface.js index d0052fdcad..e211a75d51 100644 --- a/chrome/content/zotero/fileInterface.js +++ b/chrome/content/zotero/fileInterface.js @@ -295,6 +295,7 @@ var Zotero_File_Interface = new function() { Zotero_File_Interface.Progress.show( Zotero.getString("fileInterface.itemsImported") ); + Zotero.repaint(window); Zotero.DB.beginTransaction(); translation.translate(); } else { @@ -616,6 +617,7 @@ var Zotero_File_Interface = new function() { */ this.updateProgress = function(translate) { Zotero.updateZoteroPaneProgressMeter(translate.getProgress()); + Zotero.repaint(window); } } diff --git a/chrome/content/zotero/xpcom/translation/translate.js b/chrome/content/zotero/xpcom/translation/translate.js index 923334b36f..e540220ce6 100644 --- a/chrome/content/zotero/xpcom/translation/translate.js +++ b/chrome/content/zotero/xpcom/translation/translate.js @@ -144,9 +144,6 @@ Zotero.Translate.Sandbox = { throw data; } }); - - // Allow progress meter to update - if(!translate.noWait && Zotero.wait) Zotero.wait(); translate._runHandler("itemSaving", item); // pass both the saved item and the original JS array item @@ -612,9 +609,6 @@ Zotero.Translate.Sandbox = { translate._runHandler("itemDone", item); - // Update progress bar - if(!translate.noWait && Zotero.wait) Zotero.wait(); - return item; }, diff --git a/chrome/content/zotero/xpcom/translation/translate_firefox.js b/chrome/content/zotero/xpcom/translation/translate_firefox.js index 61d583ba93..835b3b1005 100644 --- a/chrome/content/zotero/xpcom/translation/translate_firefox.js +++ b/chrome/content/zotero/xpcom/translation/translate_firefox.js @@ -392,9 +392,6 @@ Zotero.Translate.IO.Read.prototype = { }, "_initRDF":function() { - // call Zotero.wait() to do UI repaints - Zotero.wait(); - // get URI var IOService = Components.classes['@mozilla.org/network/io-service;1'] .getService(Components.interfaces.nsIIOService);