From 5172d8d70e9bc0ed8ea2808128eb42596513f4bb Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 29 Jul 2010 12:59:34 +0200 Subject: First attempt to attach backtraces instead of pasting them into comments --- lib/rhbzpage.js | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 7 deletions(-) (limited to 'lib/rhbzpage.js') diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index 6ee4553..28fba16 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -229,6 +229,34 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) } }; +RHBugzillaPage.prototype.addAttachment = function addAttachment(data) { + var msg = new xrpc.XMLRPCMessage("bugzilla.addAttachment"); + var that = this; + + msg.addParameter(this.bugNo); + msg.addParameter({ + description: "Interesting part of the thread backtrace where crash happened.", + filename: "parsed-backtrace.txt", + contenttype: "text/plain", + data: this.win.btoa(data), + nomail: true + }); + msg.addParameter(this.login); + msg.addParameter(this.password); + + Request({ + url: this.constantData.XMLRPCData[this.hostname].url, + onComplete: function() { + if (this.response.status == 200) { + that.XMLRPCcallback.call(that); + } + }, + content: msg.xml(), + contentType: "text/xml" + }).post(); + this.reqCounter++; +}; + /* Bugzilla functions. */ /** @@ -273,7 +301,9 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() { + x[1]; console.log("attURL = " + attURL); console.log("this.btSnippet = " + this.btSnippet); - if (!this.btSnippet) { + console.log("btparsed = " + this.idContainsWord("cf_devel_whiteboard", 'btparsed')) + if ((!this.btSnippet) && + (!this.idContainsWord("cf_devel_whiteboard", 'btparsed'))) { var that = this; Request({ url: attURL, @@ -281,13 +311,19 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() { if (this.response.status == 200) { that.btSnippet = that.parseBacktrace(this.response.text); if (that.btSnippet) { - that.addStuffToTextBox("comment", that.btSnippet); - that.addStuffToTextBox("status_whiteboard", - "btparsed"); + // FIXME add a button + // we have to create a new acttion addAttachment + // with handling in this.centralCommandDispatch + // + // that.addAttachment.call(that.btSnippet,that); + // that.addStuffToTextBox("status_whiteboard", + // "btparsed"); + // this.reqCounter++; } } } }).get(); + } }, this); } @@ -704,9 +740,10 @@ RHBugzillaPage.prototype.getBugzillaName = function getBugzillaName(URLhostname) * + responseHeaders * + responseText */ -RHBugzillaPage.prototype.fixingMIMECallBack = function fixingMIMECallBack() { +RHBugzillaPage.prototype.XMLRPCcallback = function XMLRPCcallback() { var that = this; - if (--this.reqCounter <= 0) { + this.reqCounter--; + if (this.reqCounter <= 0) { timer.setTimeout(function () { that.win.location.reload(true); }, 1000); @@ -760,7 +797,7 @@ RHBugzillaPage.prototype.fixAttachById = function(id, type, email) { url: this.constantData.XMLRPCData[this.hostname].url, onComplete: function() { if (this.response.status == 200) { - that.fixingMIMECallBack.call(that); + that.XMLRPCcallback.call(that); } }, content: msg.xml(), -- cgit