aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/bzpage.js2
-rw-r--r--lib/main.js52
-rw-r--r--lib/rhbzpage.js54
3 files changed, 59 insertions, 49 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 981b641..5e81a74 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -1,4 +1,4 @@
-/*jslint forin: true, rhino: true, onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
+/*jslint forin: true, rhino: true, onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false, strict: true */
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
diff --git a/lib/main.js b/lib/main.js
index 4b35d26..43fa87d 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -1,4 +1,4 @@
-/*jslint rhino: true, forin: true, onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
+/*jslint rhino: true, forin: true, onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: false, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
//
@@ -76,33 +76,37 @@ function initialize(callback) {
Request({
url: urlStr,
onComplete: function () {
- config.gJSONData = this.response.json;
+ if (this.response.status == 200) {
+ config.gJSONData = this.response.json;
- // Get additional tables
- if ("downloadJSON" in config.gJSONData.configData) {
- var URLsList = config.gJSONData.configData.downloadJSON;
- var dwnldObj = "";
- URLsList.forEach(function (arr) {
- var title = arr[0];
- var url = arr[1];
- Request({
- url: url,
- onComplete: function() {
- config.gJSONData.constantData[title] = this.response.json;
- }
- }).get();
- }, this);
- }
+ // Get additional tables
+ if ("downloadJSON" in config.gJSONData.configData) {
+ var URLsList = config.gJSONData.configData.downloadJSON;
+ var dwnldObj = "";
+ URLsList.forEach(function (arr) {
+ var title = arr[0];
+ var url = arr[1];
+ Request({
+ url: url,
+ onComplete: function() {
+ if (this.response.status == 200) {
+ config.gJSONData.constantData[title] = this.response.json;
+ }
+ }
+ }).get();
+ }, this);
+ }
- if (!myStorage.logs) {
- myStorage.logs = {};
- }
+ if (!myStorage.logs) {
+ myStorage.logs = {};
+ }
- var logConstructor = logger.Logger;
- config.logger = new logConstructor(myStorage.logs,
- JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json")));
+ var logConstructor = logger.Logger;
+ config.logger = new logConstructor(myStorage.logs,
+ JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json")));
- callback(config);
+ callback(config);
+ }
}
}).get();
}
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 8819d48..f19d13b 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -1,4 +1,4 @@
-/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: true, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
+/*jslint onevar: false, browser: true, evil: true, laxbreak: true, undef: true, nomen: true, eqeqeq: false, bitwise: true, maxerr: 1000, immed: false, white: false, plusplus: false, regexp: false, undef: false */
// Released under the MIT/X11 license
// http://www.opensource.org/licenses/mit-license.php
"use strict";
@@ -294,11 +294,13 @@ RHBugzillaPage.prototype.pasteBacktraceInComments = function() {
Request({
url: attURL,
onComplete: function() {
- that.btSnippet = that.parseBacktrace(this.response.text);
- if (that.btSnippet) {
- that.addStuffToTextBox("comment", that.btSnippet);
- that.addStuffToTextBox("status_whiteboard",
- "btparsed");
+ 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");
+ }
}
}
}).get();
@@ -596,21 +598,23 @@ RHBugzillaPage.prototype.fillInChipMagic = function fillInChipMagic() {
Request({
url: attURL,
onComplete: function () {
- var interestingLineArr = this.response.text.split("\n").
- filter(function (v,i,a) {
- return that.RE.Chipset.test(v);
- });
- if (interestingLineArr.length >0) {
- // TODO we are parsing only the first found line; is it alright?
- interestingArray = that.RE.Chipset.exec(interestingLineArr[0]);
- interestingLine = interestingArray[2].
- replace(/[\s"]+/g," ").trim();
- // Persuade createNewButton to have mercy and to actually add
- // non-default button
- that.constantData.chipMagicTrigger = true;
- that.packages["rh-xorg"].chipMagic.chipMagic = interestingLine+"\t"+interestingArray[1]
- .toUpperCase();
- that.createNewButton("status_whiteboard", true, "rh-xorg", "chipMagic");
+ if (this.response.status == 200) {
+ var interestingLineArr = this.response.text.split("\n").
+ filter(function (v,i,a) {
+ return that.RE.Chipset.test(v);
+ });
+ if (interestingLineArr.length >0) {
+ // TODO we are parsing only the first found line; is it alright?
+ interestingArray = that.RE.Chipset.exec(interestingLineArr[0]);
+ interestingLine = interestingArray[2].
+ replace(/[\s"]+/g," ").trim();
+ // Persuade createNewButton to have mercy and to actually add
+ // non-default button
+ that.constantData.chipMagicTrigger = true;
+ that.packages["rh-xorg"].chipMagic.chipMagic = interestingLine+"\t"+interestingArray[1]
+ .toUpperCase();
+ that.createNewButton("status_whiteboard", true, "rh-xorg", "chipMagic");
+ }
}
}
}).get();
@@ -767,7 +771,9 @@ RHBugzillaPage.prototype.fixAttachById = function(id, type, email) {
Request({
url: this.constantData.XMLRPCData[this.hostname].url,
onComplete: function() {
- that.fixingMIMECallBack.call(that);
+ if (this.response.status == 200) {
+ that.fixingMIMECallBack.call(that);
+ }
},
content: msg.xml(),
contentType: "text/xml"
@@ -832,8 +838,8 @@ RHBugzillaPage.prototype.addClosingUpstream = function() {
"external_id");
if (inputBox.value.match(/^http.*/)) {
- var wholeURL= new url.URL(inputBox.value);
- var externalBugID = util.getBugNo(wholeURL);
+ wholeURL= new url.URL(inputBox.value);
+ externalBugID = util.getBugNo(wholeURL);
if (externalBugID) {
inputBox.value = externalBugID;
}