From 08c3effe6edd87124f917799c8c104a39175dabc Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Mon, 29 Dec 2014 05:28:01 -0600 Subject: [PATCH 1/2] Allow meta redirects when running tests and account for new document --- .../tools/testTranslators/translatorTester.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index ac4c6c4996..dd6f5be0b0 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -195,6 +195,8 @@ Zotero_TranslatorTester = function(translator, type, debugCallback) { } }; +Zotero_TranslatorTester.DEFER_DELAY = 30000; // Delay for deferred tests + /** * Removes document objects, which contain cyclic references, and other fields to be ignored from items * @param {Object} Item, in the format returned by Zotero.Item.serialize() @@ -374,7 +376,14 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC var hiddenBrowser = Zotero.HTTP.processDocuments(test.url, function(doc) { if(test.defer) { - Zotero.setTimeout(function() { runTest(doc) }, 30000, true); + me._debug(this, "TranslatorTesting: Waiting " + + (Zotero_TranslatorTester.DEFER_DELAY/1000) + + " second(s) for page content to settle" + ); + Zotero.setTimeout( + function() {runTest(hiddenBrowser.contentDocument) }, + Zotero_TranslatorTester.DEFER_DELAY, true + ); } else { runTest(doc); } @@ -385,6 +394,8 @@ Zotero_TranslatorTester.prototype.fetchPageAndRunTest = function(test, testDoneC }, true ); + + hiddenBrowser.docShell.allowMetaRedirects = true; }; /** From e530c3a0012b4b3f979de70d7c72a98c9f1221c8 Mon Sep 17 00:00:00 2001 From: Aurimas Vinckevicius Date: Mon, 29 Dec 2014 05:28:44 -0600 Subject: [PATCH 2/2] Remove unnecessary newline in TranslatorTester log output --- chrome/content/zotero/tools/testTranslators/translatorTester.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index dd6f5be0b0..516d6e261e 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -319,7 +319,7 @@ Zotero_TranslatorTester.prototype._runTestsRecursively = function(testDoneCallba var testNumber = this.tests.length-this.pending.length; var me = this; - this._debug(this, "\nTranslatorTester: Running "+this.translator.label+" Test "+testNumber); + this._debug(this, "TranslatorTester: Running "+this.translator.label+" Test "+testNumber); var executedCallback = false; var callback = function(obj, test, status, message) {