diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libbugzilla.js | 11 | ||||
-rw-r--r-- | lib/main.js | 18 |
2 files changed, 11 insertions, 18 deletions
diff --git a/lib/libbugzilla.js b/lib/libbugzilla.js index c6f1adb..46356cc 100644 --- a/lib/libbugzilla.js +++ b/lib/libbugzilla.js @@ -238,17 +238,6 @@ exports.setClipboard = function setClipboard(stuff) { clipboard.set(stuff, "text"); }; -exports.getURL = function getURL(url, callback) { - Request({ - url: url, - onComplete: function(response) { - if (response.status == 200) { - callback(response.text); - } - } - }).get(); -}; - exports.openStringInNewPanel = function openStringInNewPanel(inHTMLStr) { openURLInNewPanel("data:text/html;charset=utf-8," + inHTMLStr); diff --git a/lib/main.js b/lib/main.js index 9c42166..b7ac152 100644 --- a/lib/main.js +++ b/lib/main.js @@ -74,12 +74,15 @@ var messageHandler = exports.messageHandler = function messageHandler( case "ChangeJSONURL": libbz.changeJSONURL(); break; + // Needed because Panel is add-on module case "OpenURLinPanel": libbz.openURLInNewPanel(msg.data); break; + // Needed because of tabs.open() case "OpenURLinTab": libbz.openURLInNewTab(msg.data); break; + // Needed because Panel is add-on module case "OpenStringInPanel": libbz.openStringInNewPanel(msg.data); break; @@ -113,13 +116,7 @@ var messageHandler = exports.messageHandler = function messageHandler( }); } break; - case "GetURL": - libbz.getURL(msg.data.url, - function(stuff) { - worker.postMessage(new Message(msg.data.backMessage, - stuff)); - }); - break; + // Needed because creating additional page-mods on remote bugzilla case "OpenBugUpstream": libbz.createUpstreamBug(msg.data.url, msg.data.subject, msg.data.comment); @@ -170,6 +167,13 @@ libbz.initialize(libbz.config, function() { worker.on('message', function(msg) { messageHandler(worker, msg); }); + worker.port.on('GetURL', function (command) { + libbz.getURL(command.url, + function(stuff) { + worker.port.emit(command.backMessage, + stuff); + }); + }); } }); }); |