From 289983f4866a5cafe8587cb0186db3319abaedb1 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Tue, 12 Jul 2011 07:41:51 +0000 Subject: [PATCH] Some very small modifications for translator test support in zotero-node that are probably never going to get used --- .../content/zotero/tools/testTranslators/testTranslators.js | 6 ++++-- .../zotero/tools/testTranslators/translatorTester.js | 2 +- chrome/content/zotero/xpcom/connector/translator.js | 2 +- chrome/content/zotero/xpcom/utilities.js | 5 +---- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/chrome/content/zotero/tools/testTranslators/testTranslators.js b/chrome/content/zotero/tools/testTranslators/testTranslators.js index 8227583aca..dc253efa10 100644 --- a/chrome/content/zotero/tools/testTranslators/testTranslators.js +++ b/chrome/content/zotero/tools/testTranslators/testTranslators.js @@ -316,10 +316,12 @@ function haveTranslators(translators, type) { /** * Runs translator tests recursively, after translatorTestViews has been populated */ -function runTranslatorTests(type) { +function runTranslatorTests(type, callback) { if(translatorTestViewsToRun[type].length) { var translatorTestView = translatorTestViewsToRun[type].shift(); - translatorTestView.runTests(function() { runTranslatorTests(type) }); + translatorTestView.runTests(function() { runTranslatorTests(type, callback) }); + } else if(callback) { + callback(); } } diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index a0e837a601..a29e0508b7 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -170,7 +170,7 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC var hiddenBrowser = Zotero.HTTP.processDocuments(test.url, function(doc) { me.runTest(test, doc, function(obj, test, status, message) { - Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); + if(hiddenBrowser) Zotero.Browser.deleteHiddenBrowser(hiddenBrowser); testDoneCallback(obj, test, status, message); }); }, diff --git a/chrome/content/zotero/xpcom/connector/translator.js b/chrome/content/zotero/xpcom/connector/translator.js index 5226677c43..caf4a31bbc 100644 --- a/chrome/content/zotero/xpcom/connector/translator.js +++ b/chrome/content/zotero/xpcom/connector/translator.js @@ -344,7 +344,7 @@ Zotero.Translators.CodeGetter.prototype.getCodeFor = function(i) { || (this._debugMode && (!translator.hasOwnProperty("code") // or if in debug mode and the code we have came from the repo (which doesn't // include test cases) - || translator.codeSource === Zotero.Repo.SOURCE_REPO))) { + || (Zotero.Repo && translator.codeSource === Zotero.Repo.SOURCE_REPO)))) { // get next translator translator.getCode(function() { me.getCodeFor(i+1) }); return; diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 11ee4cc33c..0d26d649b9 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -705,10 +705,7 @@ Zotero.Utilities = { } try { - var xpathObject = rootDoc.evaluate(xpath, element, nsResolver, - (Zotero.isFx - ? Components.interfaces.nsIDOMXPathResult.ORDERED_NODE_ITERATOR_TYPE - : XPathResult.ORDERED_NODE_ITERATOR_TYPE), + var xpathObject = rootDoc.evaluate(xpath, element, nsResolver, 5, // 5 = ORDERED_NODE_ITERATOR_TYPE null); } catch(e) { // rethrow so that we get a stack