aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-02-09 10:56:33 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-02-09 10:56:33 +0100
commitba0b4d6110e5b50c15ce722a5a123bcf26bafe3e (patch)
treef3605fc899db3152068f9c4bfc6f840ea198b11d /lib/main.js
parentcc50408c9661d35a81f921ff6347eee3c1781d0f (diff)
downloadbugzilla-triage-ba0b4d6110e5b50c15ce722a5a123bcf26bafe3e.tar.gz
Mainly add XML-RPC handling
In details: * add libbugzilla.makeXMLRPCCall * rewrite addAttachment and fixAttachById to use it * add RHOnMessageHandler to process RHBZ-specific RPC messages * fix the mess around getting passwords and not-provided passwords (there should be no password in a content script) * add libbugzilla.openURLinPanel and make showAttachment to use it * fix indentation of switch statements * remove JSLint strings, we need to fix the script, no screw up my ones
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js94
1 files changed, 50 insertions, 44 deletions
diff --git a/lib/main.js b/lib/main.js
index bf34514..5ba237d 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -1,4 +1,3 @@
-/*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
//
@@ -48,47 +47,56 @@ function skipThisPage(doc) {
var messageHandler = exports.messageHandler = function messageHandler(worker, msg) {
console.log("messageHandler: msg = " + msg.toSource());
switch (msg.cmd) {
- case "LogMessage":
- console.log(msg.data);
- break;
- case "ExecCmd":
- libbz.executeCommand(msg.data);
- break;
- case "AddLogRecord":
- logger.addLogRecord(msg.data);
- break;
- case "GenerateTS":
- logger.generateTimeSheet();
- break;
- case "ClearTS":
- logger.clearTimeSheet();
- break;
- case "ImportTS":
- logger.importTimeSheet();
- break;
- case "GetInstalledPackages":
- // send message with packages back
- console.log("msg = " + msg.toSource());
- libbz.getInstalledPackages(msg.data, config, function (pkgsMsg) {
- worker.postMessage(pkgsMsg);
- });
- break;
- case "GetClipboard":
- libbz.getClipboard(msg.data, function (clipboard) {
- worker.postMessage(clipboard);
- });
- break;
- case "ChangeJSONURL":
- libbz.changeJSONURL();
- break;
- case "OpenURLinNewTab":
- libbz.openURLinNewTab(msg.data);
- break;
- case "testReady":
- // we ignore it here, interesting only in unit test
- break;
- default:
- console.error(msg.toSource());
+ case "LogMessage":
+ console.log(msg.data);
+ break;
+ case "ExecCmd":
+ libbz.executeCommand(msg.data);
+ break;
+ case "AddLogRecord":
+ logger.addLogRecord(msg.data);
+ break;
+ case "GenerateTS":
+ logger.generateTimeSheet();
+ break;
+ case "ClearTS":
+ logger.clearTimeSheet();
+ break;
+ case "ImportTS":
+ logger.importTimeSheet();
+ break;
+ case "GetInstalledPackages":
+ // send message with packages back
+ libbz.getInstalledPackages(msg.data, config, function (pkgsMsg) {
+ worker.postMessage(pkgsMsg);
+ });
+ break;
+ case "GetClipboard":
+ libbz.getClipboard(msg.data, function (clipboard) {
+ worker.postMessage(clipboard);
+ });
+ break;
+ case "ChangeJSONURL":
+ libbz.changeJSONURL();
+ break;
+ case "OpenURLinPanel":
+ libbz.openURLinPanel(msg.data);
+ break;
+ case "MakeXMLRPCall":
+ // url, login, method, params, callback
+ libbz.makeXMLRPCCall(msg.data.url, msg.data.login, msg.data.method,
+ msg.data.params, function(ret) {
+ worker.postMessage({
+ payback: ret,
+ cbRPC: msg.data.callRPC
+ });
+ });
+ break;
+ case "testReady":
+ // we ignore it here, interesting only in unit test
+ break;
+ default:
+ console.error(msg.toSource());
}
};
@@ -116,5 +124,3 @@ libbz.initialize(config, function () {
}
});
});
-
-tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=673153");