diff --git a/chrome/content/zotero/xpcom/connector/connector.js b/chrome/content/zotero/xpcom/connector/connector.js index 97c6fd2d77..eec94cca5f 100644 --- a/chrome/content/zotero/xpcom/connector/connector.js +++ b/chrome/content/zotero/xpcom/connector/connector.js @@ -276,8 +276,8 @@ Zotero.Connector_Debug = new function() { /** * Call a callback with the lines themselves */ - this.get = Zotero.Promise.coroutine(function* (callback) { - callback(yield Zotero.Debug.get()); + this.get = function(callback) { + Zotero.Debug.get().then(callback); }); /** @@ -290,29 +290,31 @@ Zotero.Connector_Debug = new function() { /** * Submit data to the server */ - this.submitReport = Zotero.Promise.coroutine(function* (callback) { - var output = yield Zotero.Debug.get(); - var req = yield Zotero.HTTP.request( - ZOTERO_CONFIG.REPOSITORY_URL + "report?debug=1", - { - headers: { - "Content-Type": "text/plain" - }, - body: output, - successCodes: false + this.submitReport = function(callback) { + Zotero.Debug.get().then(function(output){ + return Zotero.HTTP.request( + ZOTERO_CONFIG.REPOSITORY_URL + "report?debug=1", + { + headers: { + "Content-Type": "text/plain" + }, + body: output, + successCodes: false + } + ); + }).then(function(xmlhttp){ + if (!xmlhttp.responseXML) { + callback(false, 'Invalid response from server'); + return; } - ); - if (!xmlhttp.responseXML) { - callback(false, 'Invalid response from server'); - return; - } - var reported = xmlhttp.responseXML.getElementsByTagName('reported'); - if (reported.length != 1) { - callback(false, 'The server returned an error. Please try again.'); - return; - } - - var reportID = reported[0].getAttribute('reportID'); - callback(true, reportID); + var reported = xmlhttp.responseXML.getElementsByTagName('reported'); + if (reported.length != 1) { + callback(false, 'The server returned an error. Please try again.'); + return; + } + + var reportID = reported[0].getAttribute('reportID'); + callback(true, reportID); + }); }); } diff --git a/chrome/content/zotero/xpcom/debug.js b/chrome/content/zotero/xpcom/debug.js index 4b2907e770..0b80a9e31b 100644 --- a/chrome/content/zotero/xpcom/debug.js +++ b/chrome/content/zotero/xpcom/debug.js @@ -129,7 +129,7 @@ Zotero.Debug = new function () { } - this.get = Zotero.Promise.coroutine(function* (maxChars, maxLineLength) { + this.get = Zotero.Promise.method(function(maxChars, maxLineLength) { var output = _output; var total = output.length; @@ -158,11 +158,13 @@ Zotero.Debug = new function () { } } - if(Zotero.getErrors) { - return Zotero.getErrors(true).join('\n\n') + - "\n\n" + (yield Zotero.getSystemInfo()) + "\n\n" + + if (Zotero.getErrors) { + return Zotero.getSystemInfo().then(function(sysInfo) { + return Zotero.getErrors(true).join('\n\n') + + "\n\n" + sysInfo + "\n\n" + "=========================================================\n\n" + output; + }); } else { return output; }