diff --git a/chrome/content/zotero/tools/testTranslators/translatorTester.js b/chrome/content/zotero/tools/testTranslators/translatorTester.js index 3de43ca5a4..ef1c30ed11 100644 --- a/chrome/content/zotero/tools/testTranslators/translatorTester.js +++ b/chrome/content/zotero/tools/testTranslators/translatorTester.js @@ -40,6 +40,8 @@ Zotero_TranslatorTesters = new function() { * Runs all tests */ this.runAllTests = function (numConcurrentTests, skipTranslators, resultsCallback) { + waitForDialog(); + if(!Zotero) { Zotero = Components.classes["@zotero.org/Zotero;1"] .getService(Components.interfaces.nsISupports).wrappedJSObject; @@ -109,6 +111,27 @@ Zotero_TranslatorTesters = new function() { runNextTester(); }; } + + function waitForDialog() { + Components.utils.import("resource://gre/modules/Services.jsm"); + var loadobserver = function (ev) { + ev.originalTarget.removeEventListener("load", loadobserver, false); + if (ev.target.location == "chrome://global/content/commonDialog.xul") { + let win = ev.target.docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor) + .getInterface(Components.interfaces.nsIDOMWindow); + Zotero.debug("Closing rogue dialog box!\n\n" + win.document.documentElement.textContent, 2); + win.document.documentElement.getButton('accept').click(); + } + }; + var winobserver = { + observe: function (subject, topic, data) { + if (topic != "domwindowopened") return; + var win = subject.QueryInterface(Components.interfaces.nsIDOMWindow); + win.addEventListener("load", loadobserver, false); + } + }; + Services.ww.registerNotification(winobserver); + } } /**