diff options
author | Matěj Cepl <mcepl@redhat.com> | 2012-04-10 20:38:00 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2012-04-10 20:49:13 +0200 |
commit | 0f33ced7ef3e2729c5e31733990dd7c60e0720ad (patch) | |
tree | 6eda81344549dd27471d038ecfe32e0aff66c384 /lib | |
parent | fb662574627c9bc3477ccfaacd4e96bfda1f3e29 (diff) | |
download | bugzilla-triage-0f33ced7ef3e2729c5e31733990dd7c60e0720ad.tar.gz |
Higher versions of Firefox are even more strict about undefined variables.1.6
We cannot apparently add a method to console. Oh well.
Also a general cleanup (Eclipse had some complaints).
Closes #121
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libbugzilla.js | 24 |
1 files changed, 15 insertions, 9 deletions
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); -} +}; |