diff options
Diffstat (limited to 'lib/libbugzilla.js')
-rw-r--r-- | lib/libbugzilla.js | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index 1c5f7a2..14fd675 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -60,7 +60,7 @@ function getRealBugNo(bugNo, location, callback) { onComplete: function(response) { if (response.status === 200) { var xmlRepr = parseXMLfromString(response.text); - // TODO this is probably wrong, both XPath and .text attribute + // TODO this probably wrong, both XPath and .text attribute var bugID = parseInt(xmlRepr.bug.bug_id.text, 10); if (isNaN(bugID)) { throw new Error("Cannot get bug no. even from XML representation!"); @@ -77,14 +77,14 @@ exports.getPassword = function getPassword(login, domain, callback) { var switchPrompt = "Do you want to switch off features requiring password completely"; var prefName = BTSPrefNS+"withoutPassowrd"; var domain = window.location.protocol + "//" + window.location.hostname; - + var pass = passUtils.getPassword(login, domain, BTSPassRealm); var retObject = { password: null, withoutPass: false }; - + // pass === null means no appropriate password in the storage if (!preferences.get(prefName,false) && (pass === null)) { passwordText = prompts.promptPassword(passPrompt); @@ -108,13 +108,13 @@ exports.getPassword = function getPassword(login, domain, callback) { exports.changeJSONURL = function changeJSONURL() { var prfNm = BTSPrefNS+"JSONURL"; var url = preferences.get(prfNm,""); - + var reply = prompts.prompt("New location of JSON configuration file", url); if (reply) { preferences.set(prfNm, reply.trim()); // TODO Restartless add-on needs to resolve this. prompts.alert("For now, you should really restart Firefox!"); - } + } }; /** @@ -125,7 +125,7 @@ exports.changeJSONURL = function changeJSONURL() { exports.getInstalledPackages = function getInstalledPackages(location, config, callback) { var installedPackages = {}; var enabledPackages = []; - + if (typeof location == "string") { location = new urlMod.URL(location); } @@ -145,11 +145,10 @@ exports.getInstalledPackages = function getInstalledPackages(location, config, c } } - if ((enabledPackages.length === 1) && (enabledPackages[0] === "all")) { - enabledPackages = []; - for (var key in config.gJSONData.commentPackages) { - enabledPackages.push(key); - } + var allIdx = null; + if ((allIdx = enabledPackages.indexOf("all")) != -1) { + enabledPackages = enabledPackages.splice(allIdx, + config.gJSONData.commentPackages.keys()); } // TODO To be decided, whether we cannot just eliminate packages in @@ -160,7 +159,7 @@ exports.getInstalledPackages = function getInstalledPackages(location, config, c } }); } - + // Expand commentIdx properties into full comments var cmdObj = {}; for (var pkgKey in installedPackages) { @@ -168,11 +167,11 @@ exports.getInstalledPackages = function getInstalledPackages(location, config, c cmdObj = installedPackages[pkgKey][cmdObjKey]; if ("commentIdx" in cmdObj) { cmdObj.comment = config.gJSONData.commentStrings[cmdObj.commentIdx]; - delete cmdObj.commentIdx; + delete cmdObj.commentIdx; } } } - + callback(new Message("CreateButtons", { instPkgs: installedPackages, constData: config.constantData, @@ -253,7 +252,7 @@ exports.initialize = function initialize(config, callback) { // config.objConstructor = require("mozillabzpage").MozillaBugzilla; // callback(config); - + config.constantData = {}; // TODO this is important and missing if ("constantData" in config.gJSONData) { @@ -263,7 +262,7 @@ exports.initialize = function initialize(config, callback) { config.constantData.XMLRPCData = JSON.parse( selfMod.data.load("XMLRPCdata.json")); } - + if ("CCmaintainer" in config.constantData) { config.defBugzillaMaintainerArr = config.constantData.CCmaintainer; } |