aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--data/lib/otherButtons.js2
-rw-r--r--data/rhlib/fixingAttMIME.js1
-rw-r--r--jsons/Config_data.json3
-rw-r--r--lib/libbugzilla.js67
-rw-r--r--lib/main.js24
-rw-r--r--package.json2
-rw-r--r--update.rdf30
7 files changed, 94 insertions, 35 deletions
diff --git a/data/lib/otherButtons.js b/data/lib/otherButtons.js
index 6bcc043..6fa48e0 100644
--- a/data/lib/otherButtons.js
+++ b/data/lib/otherButtons.js
@@ -113,7 +113,7 @@ function addingEmbelishments(list) {
}
// TODO Get compiz bugs as well
- if ((new Boolean(constantData.chipNames)) && (list[0].length > 0)
+ if ((new Boolean(constantData.chipNames)) && (list.length > 0)
&& (!FillMagicDoneRE.test(getSummary()))
&& (maintCCAddr == "xgl-maint@redhat.com")) {
// Add find chip magic button
diff --git a/data/rhlib/fixingAttMIME.js b/data/rhlib/fixingAttMIME.js
index c2adde4..ada6974 100644
--- a/data/rhlib/fixingAttMIME.js
+++ b/data/rhlib/fixingAttMIME.js
@@ -64,6 +64,7 @@ function fixAttachById(id, XMLRPCURL, type, email) {
self.postMessage(new Message("MakeJSONRPCall", {
url : XMLRPCURL.replace("xmlrpc.cgi","jsonrpc.cgi"),
method : "bugzilla.updateAttachMimeType",
+ login: getLogin(),
params : params,
callRPC : "FixAttachmentMIMECallback"
}));
diff --git a/jsons/Config_data.json b/jsons/Config_data.json
index 8db7b27..8f2f6e2 100644
--- a/jsons/Config_data.json
+++ b/jsons/Config_data.json
@@ -112,8 +112,7 @@
"objectStyle":"RH",
"matches":[
"https://bugzilla.redhat.com/show_bug.cgi.*",
- "https://bugzilla.mozilla.org/show_bug.cgi.*",
- "https://bugzilla.gnome.org/show_bug.cgi.*"
+ "https://bugzilla.mozilla.org/show_bug.cgi.*"
],
"enabledPackages":{
"bugzilla.redhat.com":"all"
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js
index 990c759..ae4ea01 100644
--- a/lib/libbugzilla.js
+++ b/lib/libbugzilla.js
@@ -26,6 +26,7 @@ var copiedAttributes = [ "queryButton", "upstreamButton", "parseAbrtBacktraces",
var passwords = {}; // hash of passwords indexed by a hostname
var config = exports.config = {};
+var debugOption = false;
function Message(cmd, data) {
console.log("Message: cmd = " + cmd + ", data = " + data);
@@ -37,6 +38,12 @@ function log(msg) {
postMessage(new Message("LogMessage", msg));
}
+function debug(str) {
+ if (debugOption) {
+ console.log(str);
+ }
+}
+
/**
* parse XML object out of string working around various bugs in Gecko
* implementation see https://developer.mozilla.org/en/E4X for more information
@@ -61,7 +68,7 @@ function parseXMLfromString (inStuff) {
* This is a slow variant for bugs other than actual window
*/
function getRealBugNoSlow(bugNo, location, callback) {
- console.log("We have to deal with bug aliased as " + this.bugNo);
+ debug("We have to deal with bug aliased as " + this.bugNo);
// https://bugzilla.redhat.com/show_bug.cgi?ctype=xml&id=serialWacom
Request({
url: location.href+"&ctype=xml",
@@ -73,7 +80,7 @@ function getRealBugNoSlow(bugNo, location, callback) {
if (isNaN(bugID)) {
throw new Error("Cannot get bug no. even from XML representation!");
}
- console.log("The real bug no. is " + bugID);
+ debug("The real bug no. is " + bugID);
callback(bugID)
}
}
@@ -133,7 +140,7 @@ function getPassword(login, domain, callback) {
exports.changeJSONURL = function changeJSONURL() {
var prfNm = BTSPrefNS+"JSONURL";
- var url = preferences.get(prfNm,"");
+ var url = preferences.get(prfNm, JSONURLDefault);
var reply = prompts.prompt("New location of JSON configuration file", url);
if (reply && (reply != url)) {
@@ -287,7 +294,7 @@ exports.createUpstreamBug = function createUpstreamBug(urlStr, subject, comment)
exports.makeXMLRPCCall = function makeXMLRPCCall(url, login, method, params, callback) {
var urlObj = urlMod.URL(url);
getPassword(login,
- urlObj.schema + "://" + urlObj.host,
+ urlObj.scheme + "://" + urlObj.host,
function (passwObj) {
if (!passwObj.password) {
// TODO this should happen, only when user presses Escape in password
@@ -317,25 +324,46 @@ exports.makeXMLRPCCall = function makeXMLRPCCall(url, login, method, params, cal
);
};
+exports.makeJSONRPCCallWithLogin = function makeJSONRPCCallWithLogin(url, method, params,
+ login, callback) {
+ var urlObj = urlMod.URL(url);
+ getPassword(login,
+ urlObj.scheme + "://" + urlObj.host,
+ function (passObj) {
+ if (!passObj.password) {
+ return;
+ }
+
+ makeJSONRPCCall(url, "User.login", {
+ login: login,
+ password: passObj.password,
+ remember: false
+ }, function(logResult) {
+ console.log("logResult = " + logResult.toSource());
+ makeJSONRPCCall(url, method, params, callback);
+ });
+ }
+ );
+};
+
// Make a JSONL-RPC call ... most of the business logic should stay in the
// content script
// http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html
-exports.makeJSONRPCCall = function makeJSONRPCCall(url, method, params, callback) {
+var makeJSONRPCCall = exports.makeJSONRPCCall = function makeJSONRPCCall(url, method, params, callback) {
-// {"version":"1.1", "method":"Bug.history", "params":{ "ids":[12345] } }
var msg = {
"version": "1.1",
"method": method,
"params": params
};
-// console.log("makeJSONRPCCall: out = " + JSON.stringify(msg));
+ debug("makeJSONRPCCall: out = " + JSON.stringify(msg));
Request({
url: url,
onComplete: function(response) {
if (response.status == 200) {
-// console.log("makeJSONRPCCall: in = " + response.text);
+ debug("makeJSONRPCCall: in = " + response.text);
callback(response.json.result);
}
},
@@ -346,24 +374,13 @@ exports.makeJSONRPCCall = function makeJSONRPCCall(url, method, params, callback
exports.initialize = function initialize(config, callback) {
var prefJSONURLName = BTSPrefNS+"JSONURL";
- var prefDebugName = BTSPrefNS+"debug";
- var urlStr = "",
- debugOption = false; // should we spit out a lot of debugging output
+ var urlStr = preferences.get(prefJSONURLName, JSONURLDefault);
+ preferences.set(prefJSONURLName, urlStr);
- if (preferences.isSet(prefJSONURLName)) {
- urlStr = preferences.get(prefJSONURLName);
- }
- else {
- urlStr = JSONURLDefault;
- preferences.set(prefJSONURLName, JSONURLDefault);
- }
-
- if (preferences.isSet(prefDebugName)) {
- debugOption = preferences.get(prefDebugName);
- }
- else {
- preferences.set(prefDebugName, debugOption);
- }
+ // should we spit out a lot of debugging output
+ var prefDebugName = BTSPrefNS+"debug";
+ debugOption = preferences.get(prefDebugName, false);
+ preferences.set(prefDebugName, debugOption);
// Randomize URL to avoid caching
// TODO see https://fedorahosted.org/bugzilla-triage-scripts/ticket/21
diff --git a/lib/main.js b/lib/main.js
index 302dda8..431ffe6 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -101,12 +101,24 @@ var messageHandler = exports.messageHandler = function messageHandler(
break;
case "MakeJSONRPCall":
// url, login, method, params, callback
- libbz
- .makeJSONRPCCall(msg.data.url, msg.data.method,
- msg.data.params, function(ret) {
- worker.postMessage(new Message(msg.data.callRPC,
- ret));
- });
+ if (msg.data.login) {
+ libbz
+ .makeJSONRPCCallWithLogin(msg.data.url, msg.data.method,
+ msg.data.params, msg.data.login, function(ret) {
+ worker.postMessage(new Message(msg.data.callRPC,
+ ret));
+ }
+ );
+ }
+ else {
+ libbz
+ .makeJSONRPCCall(msg.data.url, msg.data.method,
+ msg.data.params, function(ret) {
+ worker.postMessage(new Message(msg.data.callRPC,
+ ret));
+ }
+ );
+ }
break;
case "GetURL":
libbz.getURL(msg.data.url,
diff --git a/package.json b/package.json
index 03324dc..c13962a 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": "0.100",
+ "version": "0.102",
"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 f47e944..6aa724b 100644
--- a/update.rdf
+++ b/update.rdf
@@ -397,6 +397,36 @@ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
</em:targetApplication>
</Description>
</li>
+ <li>
+ <Description>
+ <em:version>0.101</em:version>
+ <em:targetApplication>
+ <Description>
+ <em:id>
+ {ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>4.0b7</em:minVersion>
+ <em:maxVersion>6.0a1</em:maxVersion>
+ <em:updateLink>
+ https://fedorahosted.org/released/bugzilla-triage-scripts/bugzilla-triage-0.101.xpi</em:updateLink>
+ </Description>
+ </em:targetApplication>
+ </Description>
+ </li>
+ <li>
+ <Description>
+ <em:version>0.102</em:version>
+ <em:targetApplication>
+ <Description>
+ <em:id>
+ {ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>4.0b7</em:minVersion>
+ <em:maxVersion>6.0a1</em:maxVersion>
+ <em:updateLink>
+ https://fedorahosted.org/released/bugzilla-triage-scripts/bugzilla-triage-0.102.xpi</em:updateLink>
+ </Description>
+ </em:targetApplication>
+ </Description>
+ </li>
</Seq>
</em:updates>
</Description>