aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/lib/bzpage.js88
-rw-r--r--data/lib/rpcutils.js4
-rw-r--r--data/lib/util.js6
-rw-r--r--lib/libbugzilla.js24
-rw-r--r--package.json2
-rw-r--r--update.rdf15
6 files changed, 81 insertions, 58 deletions
diff --git a/data/lib/bzpage.js b/data/lib/bzpage.js
index 4bba873..8d7606f 100644
--- a/data/lib/bzpage.js
+++ b/data/lib/bzpage.js
@@ -22,7 +22,7 @@ var equivalentComponents = null;
* central handler processing messages from the main script.
*/
self.on('message', function onMessage(msg) {
- console.myDebug("onMessage - incoming : msg.cmd = " + msg.cmd);
+ myDebug("onMessage - incoming : msg.cmd = " + msg.cmd);
switch (msg.cmd) {
case "ReloadThePage":
document.location.reload(true);
@@ -84,7 +84,7 @@ function executeCommand(cmdObj) {
* Object with the appropriate parameters for the command
*/
function centralCommandDispatch (cmdLabel, cmdParams) {
- console.myDebug("centralCommandDispatch : cmdLabel = " + cmdLabel);
+ myDebug("centralCommandDispatch : cmdLabel = " + cmdLabel);
switch (cmdLabel) {
case "name":
case "position":
@@ -362,53 +362,55 @@ function startup() {
var logoutLink = Array.some(document.links, function (x) {
return x.search === "?logout=1" ;
});
- if (document.getElementById("brElementPlace_location")) {
- console.error("Hit multiple firing protection!")
- return null; // This should just finish whole content script without
- // doing any harm to anybody.
- }
- else {
- console.myDebug("Didn't hit multiple firing protection!");
- }
+ if (logoutLink) {
+ if (document.getElementById("brElementPlace_location")) {
+ console.error("Hit multiple firing protection!")
+ return null; // This should just finish whole content script without
+ // doing any harm to anybody.
+ }
+ else {
+ myDebug("Didn't hit multiple firing protection!");
+ }
- // Prepare for query buttons
- // element ID brElementPlace_location is later used in JSON files
- // Stay with this add_comment element even if RH BZ upgrades, this seems
- // to be generally much more stable (even with other bugzillas, e.g.
- // b.gnome.org)
- // then some getElementById.
- var commentArea = document.getElementsByClassName("bz_section_additional_comments")[0];
- if (commentArea) {
- var brElementPlacer = commentArea.getElementsByTagName("br");
- brElementPlacer = brElementPlacer[0];
- if (brElementPlacer) {
- brElementPlacer.setAttribute("id","brElementPlacer_location");
- brElementPlacer.parentNode.insertBefore(document.createElement("br"),
- brElementPlacer);
+ // Prepare for query buttons
+ // element ID brElementPlace_location is later used in JSON files
+ // Stay with this add_comment element even if RH BZ upgrades, this seems
+ // to be generally much more stable (even with other bugzillas, e.g.
+ // b.gnome.org)
+ // then some getElementById.
+ var commentArea = document.getElementsByClassName("bz_section_additional_comments")[0];
+ if (commentArea) {
+ var brElementPlacer = commentArea.getElementsByTagName("br");
+ brElementPlacer = brElementPlacer[0];
+ if (brElementPlacer) {
+ brElementPlacer.setAttribute("id","brElementPlacer_location");
+ brElementPlacer.parentNode.insertBefore(document.createElement("br"),
+ brElementPlacer);
+ }
}
- }
- // Prepare for adding external bugs
- var a0Elements = document.getElementsByName("a0");
- if (a0Elements.length > 0) {
- var extBugsHeadline = a0Elements[a0Elements.length - 1];
- extBugsHeadline.setAttribute("id", "external_bugs_headline");
- }
+ // Prepare for adding external bugs
+ var a0Elements = document.getElementsByName("a0");
+ if (a0Elements.length > 0) {
+ var extBugsHeadline = a0Elements[a0Elements.length - 1];
+ extBugsHeadline.setAttribute("id", "external_bugs_headline");
+ }
- // TODO Probably could be ignored ... used only once on line 973 of
- // rhbzpage.js
- // if (parseAbrtBacktraces && this.RE.Abrt.test(getSummary())) {
- // title = document.getElementById("short_desc_nonedit_display").textContent;
+ // TODO Probably could be ignored ... used only once on line 973 of
+ // rhbzpage.js
+ // if (parseAbrtBacktraces && this.RE.Abrt.test(getSummary())) {
+ // title = document.getElementById("short_desc_nonedit_display").textContent;
- // So, now we know we are logged in, so we can get to
- // the real work.
- setConfigurationButton();
- submitHandlerInstalled = false;
+ // So, now we know we are logged in, so we can get to
+ // the real work.
+ setConfigurationButton();
+ submitHandlerInstalled = false;
- self.postMessage(new Message("GetInstalledPackages", {
- location: window.location.href,
- login: getLogin()
- }));
+ self.postMessage(new Message("GetInstalledPackages", {
+ location: window.location.href,
+ login: getLogin()
+ }));
+ }
}
startup();
diff --git a/data/lib/rpcutils.js b/data/lib/rpcutils.js
index ee8804a..74b3ded 100644
--- a/data/lib/rpcutils.js
+++ b/data/lib/rpcutils.js
@@ -13,7 +13,7 @@ function makeJSONRPCCall(method, params, callback) {
"params": params
};
- console.myDebug("makeJSONRPCCall(" + method +
+ myDebug("makeJSONRPCCall(" + method +
"): out = " + JSON.stringify(msg));
var req = new XMLHttpRequest();
@@ -21,7 +21,7 @@ function makeJSONRPCCall(method, params, callback) {
req.onreadystatechange = function (aEvt) {
if (req.readyState == 4) {
if(req.status == 200) {
- console.myDebug("makeJSONRPCCall (" + method +
+ myDebug("makeJSONRPCCall (" + method +
"): in = " + req.responseText);
var JSONresponse = JSON.parse(req.responseText);
if ("error" in JSONresponse) {
diff --git a/data/lib/util.js b/data/lib/util.js
index 35150d5..2782f0c 100644
--- a/data/lib/util.js
+++ b/data/lib/util.js
@@ -224,7 +224,7 @@ function getISODate(dateStr) {
*/
function ISODateString(d) {
function pad(n) {
- return n<10 ? '0'+n : n
+ return (n<10 ? '0'+n : n);
}
return d.getUTCFullYear()+'-'
@@ -401,10 +401,10 @@ NotLoggedinException.prototype.toString = function () {
return this.name + ': "' + this.message + '"';
};
-console.myDebug = function myDebug(str) {
+function myDebug(str) {
if (typeof config !== "undefined") {
if (config.debuggingVerbose) {
console.log(str);
}
}
-};
+} \ No newline at end of file
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js
index 7ab1029..e5d6e25 100644
--- a/lib/libbugzilla.js
+++ b/lib/libbugzilla.js
@@ -76,7 +76,7 @@ function getRealBugNoSlow(bugNo, location, callback) {
throw new Error("Cannot get bug no. even from XML representation!");
}
debug("The real bug no. is " + bugID);
- callback(bugID)
+ callback(bugID);
}
}
}).get();
@@ -87,7 +87,7 @@ function getPassword(login, domain, callback) {
"for accessing JSONRPC services";
var switchPrompt = "Do you want to switch off XML-RPC " +
"for domain ";
- var prefName = BTSPrefNS+"withoutPassowrd", prefValue = [];
+ var prefName = BTSPrefNS + "withoutPassowrd", prefValue = [];
var retObject = {
password: null, // password string or null if no password provided
withoutPass: [] // whether user doesn't want to use password at all
@@ -109,7 +109,11 @@ function getPassword(login, domain, callback) {
username: login,
url: domain,
realm: BTSPassRealm,
- onComplete: function onComplete([credential]) {
+ onComplete: function onComplete(credList) {
+ var credential = [];
+ if (credList) {
+ credential = credList[0];
+ }
if (credential) {
// We found the password, just go ahead and use it
retObject.password = credential.password;
@@ -302,7 +306,7 @@ function processPageModeREs() {
function loginToAllBugzillas(callback) {
- var loginCallsCounter = 0, bugzilla = "";
+ var loginCallsCounter = 0;
// This is not a good place to run this, but I do not have currently
// better place where all execution paths in this module meets in the
@@ -320,17 +324,19 @@ function loginToAllBugzillas(callback) {
// (we can have more than one set of credentials per bugzilla;
// well, theoretically)
debug("loginToAllBugzillas: credentials found:\n" +
- credentials.toSource());
+ credentials.toSource());
credentials.forEach(function(credential) {
// ... login!
+ debug("Logging as " + credential.username + " to " + credential.url);
makeJSONRPCCall(credential.url + "/jsonrpc.cgi",
"User.login", {
login: credential.username,
password: credential.password,
remember: false
}, function(logResult) {
- debug("Logging as " + credential.username + " to " + credential.url);
+ debug("logResult = " + logResult.toSource());
loginCallsCounter--;
+ debug("after decrease loginCallsCounter = " + loginCallsCounter);
// When we complete all logins, execute the callback
if (loginCallsCounter <= 0) {
debug("All logins done!");
@@ -339,6 +345,7 @@ function loginToAllBugzillas(callback) {
});
// Increment call counter
loginCallsCounter++;
+ debug("after increase loginCallsCounter = " + loginCallsCounter);
});
if (loginCallsCounter == 0) {
debug("No credentials!");
@@ -448,7 +455,7 @@ function processConfigJSON(rawJSON) {
replace("show_bug.cgi.*", part + ".cgi"));
});
});
- }
+ };
}
config.constantData = {};
@@ -489,7 +496,6 @@ ConfigurationLoadError.constructor = ConfigurationLoadError;
function fetchConfigurationJSON(url, callback) {
debug("Fetching configuration JSON from " + url);
- var retValue = null;
Request({
url: url,
onComplete: function (response) {
@@ -516,4 +522,4 @@ exports.initialize = function initialize(callback) {
debug("Starting initialize!");
fetchConfigurationJSON(urlStr, callback);
-}
+};
diff --git a/package.json b/package.json
index ea3a06c..9f0e1c5 100644
--- a/package.json
+++ b/package.json
@@ -7,7 +7,7 @@
"description": "Additional buttons and other function helping in the triage on bugzilla",
"author": "Matej Cepl (http://matej.ceplovi.cz)",
"license": "MIT/X11 (http://opensource.org/licenses/mit-license.php) and MPL",
- "version": "1.5.2",
+ "version": "1.6",
"contributors": [
"Ehsan Akhgari (http://ehsanakhgari.org/) <ehsan@mozilla.com>",
"Johnathan Nightingale (http://johnath.com) <johnath@mozilla.com>",
diff --git a/update.rdf b/update.rdf
index 47ab4bd..d61ed59 100644
--- a/update.rdf
+++ b/update.rdf
@@ -247,6 +247,21 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
</em:targetApplication>
</Description>
</li>
+ <li>
+ <Description>
+ <em:version>1.6</em:version>
+ <em:targetApplication>
+ <Description>
+ <em:id>
+ {ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>11.0</em:minVersion>
+ <em:maxVersion>14.0a1</em:maxVersion>
+ <em:updateLink>
+ https://fedorahosted.org/released/bugzilla-triage-scripts/bugzilla-triage-1.6.xpi</em:updateLink>
+ </Description>
+ </em:targetApplication>
+ </Description>
+ </li>
</Seq>
</em:updates>
</Description>