Some very small modifications for translator test support in zotero-node that are probably never going to get used

This commit is contained in:
Simon Kornblith 2011-07-12 07:41:51 +00:00
parent 3238656ca0
commit 289983f486
4 changed files with 7 additions and 8 deletions

View file

@ -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();
}
}

View file

@ -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);
});
},

View file

@ -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;

View file

@ -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