commit deea80c49566d232eb38b5cacc5a8908454de87a
parent 417e00a4f66e1950c378f2bab46cb84822ca8551
Author: Simon Kornblith <simon@simonster.com>
Date: Tue, 28 Feb 2012 10:49:11 -0500
Cancel timer at end of test
Diffstat:
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js
@@ -316,9 +316,18 @@ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallba
* @param {Function} testDoneCallback A callback to be executed when test is complete
*/
Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneCallback) {
+ var timer = Components.classes["@mozilla.org/timer;1"].
+ createInstance(Components.interfaces.nsITimer);
+ timer.initWithCallback({"notify":function() {
+ Zotero.Browser.deleteHiddenBrowser(hiddenBrowser);
+ }}, TEST_RUN_TIMEOUT, Components.interfaces.nsITimer.TYPE_ONE_SHOT);
+
var me = this;
var runTest = function(doc) {
me.runTest(test, doc, function(obj, test, status, message) {
+ try {
+ timer.cancel();
+ } catch(e) {};
if(hiddenBrowser) Zotero.Browser.deleteHiddenBrowser(hiddenBrowser);
testDoneCallback(obj, test, status, message);
});
@@ -337,9 +346,6 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC
},
true
);
- (Zotero.setTimeout ? Zotero : window).setTimeout(function() {
- Zotero.Browser.deleteHiddenBrowser(hiddenBrowser);
- }, TEST_RUN_TIMEOUT);
};
/**