diff options
Diffstat (limited to 'lib/main.js')
-rw-r--r-- | lib/main.js | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/main.js b/lib/main.js index 5ba237d..abdc758 100644 --- a/lib/main.js +++ b/lib/main.js @@ -12,14 +12,11 @@ "use strict"; var browser = require("tab-browser"); var self = require("self"); -var Request = require("request").Request; var pageMod = require("page-mod"); var libbz = require("libbugzilla"); var tabs = require("tabs"); var logger = require("logger"); -var config = {}; - function isOurPage(window, matchingURLs) { var url = window.location.href; @@ -67,13 +64,13 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms break; case "GetInstalledPackages": // send message with packages back - libbz.getInstalledPackages(msg.data, config, function (pkgsMsg) { + libbz.getInstalledPackages(msg.data, function (pkgsMsg) { worker.postMessage(pkgsMsg); }); break; case "GetClipboard": - libbz.getClipboard(msg.data, function (clipboard) { - worker.postMessage(clipboard); + libbz.getClipboard(function (clipboard) { + worker.postMessage(new Message(msg.data, clipboard)); }); break; case "ChangeJSONURL": @@ -82,6 +79,12 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms case "OpenURLinPanel": libbz.openURLinPanel(msg.data); break; + case "OpenURLinTab": + libbz.openURLInNewTab(msg.data); + break; + case "OpenStringInPanel": + libbz.openStringInNewPanel(msg.data); + break; case "MakeXMLRPCall": // url, login, method, params, callback libbz.makeXMLRPCCall(msg.data.url, msg.data.login, msg.data.method, @@ -92,6 +95,14 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms }); }); break; + case "GetURL": + libbz.getURL(msg.data.url, function(stuff) { + worker.postMessage(new Message(msg.data.backMessage, stuff)); + }); + break; + case "OpenBugUpstream": + libbz.createUpstreamBug(msg.data.url, msg.data.subject, msg.data.comment); + break; case "testReady": // we ignore it here, interesting only in unit test break; @@ -109,7 +120,7 @@ var contentScriptLibraries = { ] }; -libbz.initialize(config, function () { +libbz.initialize(libbz.config, function () { pageMod.PageMod({ include: [ "https://bugzilla.redhat.com/show_bug.cgi?id=*" @@ -124,3 +135,5 @@ libbz.initialize(config, function () { } }); }); + +tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017"); |