From a8d92b4d8ef27e216b33781e014a35f55bf1be42 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 20 Jan 2011 17:51:29 +0100 Subject: First rough removal of objects and transformation on plain functions. TODO: * still this is all around the place * constructors has not been fixed * all require's were just yanked, but they are still used. * functions should be more self-contained ... tons of global variables everywhere. --- lib/main.js | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 3 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index fbabd41..35d7d60 100644 --- a/lib/main.js +++ b/lib/main.js @@ -13,10 +13,11 @@ "use strict"; var logger = require("logger"); var browser = require("tab-browser"); -var selfMod = require("self"); +var self = require("self"); var Request = require("request").Request; var preferences = require("preferences-service"); -var BTSPrefNS = require("bzpage").BTSPrefNS; +var pageMod = require("page-mod"); +// var BTSPrefNS = require("bzpage").BTSPrefNS; // Use my JSON for now before it is fixed for general public var JSONURLDefault = "https://fedorahosted.org/released"+ "/bugzilla-triage-scripts/Config_data.json"; @@ -87,7 +88,7 @@ function initialize(callback) { }, this); } - config.logger = new logger.Logger(JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json"))); + config.logger = new logger.Logger(JSON.parse(self.data.load("bugzillalabelAbbreviations.json"))); config.matches = config.gJSONData.configData.matches; config.skipMatches = config.matches.map(function(x) { @@ -108,6 +109,7 @@ function initialize(callback) { }).get(); } +/* exports.main = function main(options, callbacks) { initialize(function (config) { browser.whenContentLoaded( @@ -132,3 +134,61 @@ exports.main = function main(options, callbacks) { ); }); }; + +*/ +var messageHandler = exports.messageHandler = function messageHandler(worker, msg) { + switch (msg.cmd) { + case "LogMessage": + console.log(msg.data); + break; + case "GetDuplicatorID": + getDuplicatorID(msg.data.host, msg.data.bugID, function (msgObj) { + worker.postMessage(msgObj); + }); + break; + case "GetPassword": + getPassword(msg.data.login, msg.data.hostname, function (pass) { + worker.postMessage(pass); + }); + break; + case "DeDeduplicateQueue": + LoginData = { + queue: msg.data.bugs, + host: msg.data.hostname, + login: msg.data.login, + pass: msg.data.password, + dupID: msg.data.duplicator, + finalCallback: function (msgObj) { + worker.postMessage(msgObj); + } + }; + processReqQueue(); + break; + case "testReady": + // we ignore it here, interesting only in unit test + break; + default: + console.error(msg.toSource()); + } +}; + +var contentScriptLibraries = { + "bugzilla.redhat.com": [ + self.data.url("bzpage.js"), + self.data.url("rhbzpage.js") + ] +}; + +pageMod.PageMod({ + include: [ + "https://bugzilla.redhat.com/show_bug.cgi?id=*" + ], + contentScriptWhen: 'ready', + // contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"], + onAttach: function onAttach(worker, msg) { + console.log("worker: " + worker); + worker.on('message', function (msg) { + messageHandler(worker, msg); + }); + } +}); -- cgit From 83a7d703cbabd6e514a6d8a948b39325b59e9f58 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 28 Jan 2011 02:04:52 +0100 Subject: bzpage.js mostly done Also: * created libbugzilla.js for putting aside most RPCed functions * utils.js and color.js moved to data * tons and tons of restructing to make things work via RPC --- lib/main.js | 104 +++++++++++------------------------------------------------- 1 file changed, 18 insertions(+), 86 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index 35d7d60..cbb3ba6 100644 --- a/lib/main.js +++ b/lib/main.js @@ -11,18 +11,11 @@ // http://ehsanakhgari.org/blog/2010-05-31/my-experience-jetpack-sdk#comment-1253 // "use strict"; -var logger = require("logger"); var browser = require("tab-browser"); var self = require("self"); var Request = require("request").Request; -var preferences = require("preferences-service"); var pageMod = require("page-mod"); -// var BTSPrefNS = require("bzpage").BTSPrefNS; -// Use my JSON for now before it is fixed for general public -var JSONURLDefault = "https://fedorahosted.org/released"+ - "/bugzilla-triage-scripts/Config_data.json"; - -var config = {}; +var libbz = require("libbugzilla"); function isOurPage(window, matchingURLs) { var url = window.location.href; @@ -48,66 +41,6 @@ function skipThisPage(doc) { } } -function initialize(callback) { - var prefName = BTSPrefNS+"JSONURL"; - var urlStr = ""; - - if (preferences.isSet(prefName)) { - urlStr = preferences.get(prefName); - } else { - urlStr = JSONURLDefault; - preferences.set(prefName, JSONURLDefault); - } - - // Randomize URL to avoid caching - // TODO see https://fedorahosted.org/bugzilla-triage-scripts/ticket/21 - // for more thorough discussion and possible further improvement - urlStr += (urlStr.match(/\?/) == null ? "?" : "&") + (new Date()).getTime(); - - Request({ - url: urlStr, - onComplete: function (response) { - if (response.status == 200) { - config.gJSONData = response.json; - - // Get additional tables - if ("downloadJSON" in config.gJSONData.configData) { - var URLsList = config.gJSONData.configData.downloadJSON; - var dwnldObj = ""; - URLsList.forEach(function (arr) { - var title = arr[0]; - var url = arr[1]; - Request({ - url: url, - onComplete: function(response) { - if (response.status == 200) { - config.gJSONData.constantData[title] = response.json; - } - } - }).get(); - }, this); - } - - config.logger = new logger.Logger(JSON.parse(self.data.load("bugzillalabelAbbreviations.json"))); - - config.matches = config.gJSONData.configData.matches; - config.skipMatches = config.matches.map(function(x) { - return x.replace("show_bug.cgi.*","((process|post)_bug|attachment)\.cgi$"); - }); - - config.objConstructor = {}; - var bzType = config.gJSONData.configData.objectStyle; - if (bzType === "RH") { - config.objConstructor = require("rhbzpage").RHBugzillaPage; - } else if (bzType === "MoFo") { - config.objConstructor = require("mozillabzpage").MozillaBugzilla; - } - - callback(config); - } - } - }).get(); -} /* exports.main = function main(options, callbacks) { @@ -141,28 +74,25 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms case "LogMessage": console.log(msg.data); break; - case "GetDuplicatorID": - getDuplicatorID(msg.data.host, msg.data.bugID, function (msgObj) { - worker.postMessage(msgObj); + case "ExecCmd": + libbz.executeCommand(msg.data); + break; + case "GetInstalledPackages": + // send message with packages back + libbz.getInstalledPackages(msg.data, function (pkgsMsg) { + worker.postMessage(pkgsMsg); }); break; - case "GetPassword": - getPassword(msg.data.login, msg.data.hostname, function (pass) { - worker.postMessage(pass); + case "GetClipboard": + libbz.getClipboard(msg.data, function (clipboard) { + worker.postMessage(clipboard); }); break; - case "DeDeduplicateQueue": - LoginData = { - queue: msg.data.bugs, - host: msg.data.hostname, - login: msg.data.login, - pass: msg.data.password, - dupID: msg.data.duplicator, - finalCallback: function (msgObj) { - worker.postMessage(msgObj); - } - }; - processReqQueue(); + case "ChangeJSONURL": + libbz.changeJSONURL(); + break; + case "OpenURLinNewTab": + libbz.openURLinNewTab(msg.data); break; case "testReady": // we ignore it here, interesting only in unit test @@ -174,6 +104,8 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms var contentScriptLibraries = { "bugzilla.redhat.com": [ + self.data.url("util.js"), + self.data.url("color.js"), self.data.url("bzpage.js"), self.data.url("rhbzpage.js") ] -- cgit From 4a0bcc39b1e1b49dcaa0aa2ab674c6f1ba51e9e5 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 28 Jan 2011 16:38:36 +0100 Subject: Tons of fixes, we are almost in state that the primitive run is possible. TOOD: * The most important part is we have to run libbz.initialize() and wait until it is done. --- lib/main.js | 37 ++++++------------------------------- 1 file changed, 6 insertions(+), 31 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index cbb3ba6..0afa67d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -41,35 +41,8 @@ function skipThisPage(doc) { } } - -/* -exports.main = function main(options, callbacks) { - initialize(function (config) { - browser.whenContentLoaded( - function(window) { - // is this good for anything? - if ("window" in window) { window = window.window; } - - if (isOurPage(window, config.matches)) { - try { - var curPage = new config.objConstructor(window, config); - } catch (ex) { - if (ex instanceof require("bzpage").NotLoggedinException) { - return ; // Bail out if the user is not logged in - } else { - throw ex; // rethrow the exception otherwise - } - } - } else if (isOurPage(window, config.skipMatches)) { - skipThisPage(window.document); - } - } - ); - }); -}; - -*/ var messageHandler = exports.messageHandler = function messageHandler(worker, msg) { + console.log("messageHandler: msg = " + msg.toSource()); switch (msg.cmd) { case "LogMessage": console.log(msg.data); @@ -79,6 +52,7 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms break; case "GetInstalledPackages": // send message with packages back + console.log("msg = " + msg.toSource()); libbz.getInstalledPackages(msg.data, function (pkgsMsg) { worker.postMessage(pkgsMsg); }); @@ -106,17 +80,18 @@ var contentScriptLibraries = { "bugzilla.redhat.com": [ self.data.url("util.js"), self.data.url("color.js"), - self.data.url("bzpage.js"), - self.data.url("rhbzpage.js") + self.data.url("bzpage.js") +// self.data.url("rhbzpage.js") ] }; +libbz.initialize(); pageMod.PageMod({ include: [ "https://bugzilla.redhat.com/show_bug.cgi?id=*" ], contentScriptWhen: 'ready', - // contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"], + contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"], onAttach: function onAttach(worker, msg) { console.log("worker: " + worker); worker.on('message', function (msg) { -- cgit From c1ec772b104316530f6737340355205398df33af Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 1 Feb 2011 16:28:51 +0100 Subject: This actually almost looks like working, so much I can file bugs. --- lib/main.js | 47 +++++++++++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 14 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index 0afa67d..bf34514 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,6 +16,10 @@ 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; @@ -50,10 +54,22 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms 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, function (pkgsMsg) { + libbz.getInstalledPackages(msg.data, config, function (pkgsMsg) { worker.postMessage(pkgsMsg); }); break; @@ -85,17 +101,20 @@ var contentScriptLibraries = { ] }; -libbz.initialize(); -pageMod.PageMod({ - include: [ - "https://bugzilla.redhat.com/show_bug.cgi?id=*" - ], - contentScriptWhen: 'ready', - contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"], - onAttach: function onAttach(worker, msg) { - console.log("worker: " + worker); - worker.on('message', function (msg) { - messageHandler(worker, msg); - }); - } +libbz.initialize(config, function () { + pageMod.PageMod({ + include: [ + "https://bugzilla.redhat.com/show_bug.cgi?id=*" + ], + contentScriptWhen: 'ready', + contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"], + onAttach: function onAttach(worker, msg) { + console.log("worker: " + worker); + worker.on('message', function (msg) { + messageHandler(worker, msg); + }); + } + }); }); + +tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=673153"); -- cgit From ba0b4d6110e5b50c15ce722a5a123bcf26bafe3e Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 9 Feb 2011 10:56:33 +0100 Subject: 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 --- lib/main.js | 94 ++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 50 insertions(+), 44 deletions(-) (limited to 'lib/main.js') 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"); -- cgit From 838c1d4abd72bd87dcc8ee41310ca3a8af498c96 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 10 Feb 2011 18:24:18 +0100 Subject: All functions should be (theoretically) either working or commented out. --- lib/main.js | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'lib/main.js') 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"); -- cgit From 04657077ba12e8f23feaa0c3787b590c44446056 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 14 Feb 2011 17:51:53 +0100 Subject: Basic functionality working. Switching to this bug for my day-to-day work. --- lib/main.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index abdc758..be4ff8d 100644 --- a/lib/main.js +++ b/lib/main.js @@ -115,8 +115,8 @@ var contentScriptLibraries = { "bugzilla.redhat.com": [ self.data.url("util.js"), self.data.url("color.js"), + self.data.url("rhbzpage.js"), self.data.url("bzpage.js") -// self.data.url("rhbzpage.js") ] }; @@ -136,4 +136,12 @@ libbz.initialize(libbz.config, function () { }); }); -tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017"); +pageMod.PageMod({ + include: [ + "https://bugzilla.redhat.com/process_bug.cgi" + ], + contentScriptWhen: 'ready', + contentScriptFile: self.data.url("skip-bug.js") +}); + +//tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017"); -- cgit From 10dcf8de5c6965832452c538451d6170b3bafb66 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 15 Feb 2011 00:37:57 +0100 Subject: Bit of reorganization Also add an event handler on changes in assigned_to input box --- lib/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index be4ff8d..0348842 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,6 +16,7 @@ var pageMod = require("page-mod"); var libbz = require("libbugzilla"); var tabs = require("tabs"); var logger = require("logger"); +var Message = require("util").Message; function isOurPage(window, matchingURLs) { var url = window.location.href; @@ -115,7 +116,7 @@ var contentScriptLibraries = { "bugzilla.redhat.com": [ self.data.url("util.js"), self.data.url("color.js"), - self.data.url("rhbzpage.js"), + self.data.url("rhbzpage.js"), self.data.url("bzpage.js") ] }; -- cgit From d448b16f969be780444190d178dad4c8b2347612 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 16 Feb 2011 16:16:33 +0100 Subject: Fix the password recognition. * doh! !== instead of === * also skip attachment.cgi page --- lib/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index 0348842..cd8f259 100644 --- a/lib/main.js +++ b/lib/main.js @@ -139,7 +139,8 @@ libbz.initialize(libbz.config, function () { pageMod.PageMod({ include: [ - "https://bugzilla.redhat.com/process_bug.cgi" + "https://bugzilla.redhat.com/process_bug.cgi", + "https://bugzilla.redhat.com/attachment.cgi" ], contentScriptWhen: 'ready', contentScriptFile: self.data.url("skip-bug.js") -- cgit From 66275e3a326dc771c04cb6fbfdee68f09b66ee6c Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 17 Feb 2011 18:15:57 +0100 Subject: Make queryLocal and XML-RPC generally work again. --- lib/main.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index cd8f259..a169fae 100644 --- a/lib/main.js +++ b/lib/main.js @@ -78,7 +78,7 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms libbz.changeJSONURL(); break; case "OpenURLinPanel": - libbz.openURLinPanel(msg.data); + libbz.openURLInNewPanel(msg.data); break; case "OpenURLinTab": libbz.openURLInNewTab(msg.data); @@ -90,10 +90,7 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms // 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 - }); + worker.postMessage(new Message(msg.data.callRPC, ret)); }); break; case "GetURL": -- cgit From 2abc7e13fe87f92feceafaf348f553cf8b6c9b9e Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Sun, 20 Feb 2011 01:21:39 +0100 Subject: Fix fill-in magic. * changed regexp for parsing driver line, just PCI ID is relevant. * all magic is now in data * eliminated most unnecessary console.logs ... either changed to console.error or just removed. --- lib/main.js | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index a169fae..502d839 100644 --- a/lib/main.js +++ b/lib/main.js @@ -126,7 +126,6 @@ libbz.initialize(libbz.config, function () { contentScriptWhen: 'ready', contentScriptFile: contentScriptLibraries["bugzilla.redhat.com"], onAttach: function onAttach(worker, msg) { - console.log("worker: " + worker); worker.on('message', function (msg) { messageHandler(worker, msg); }); -- cgit From 5b9f263ac1485c0ab18c2d42c5cd18746208bad4 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Wed, 23 Feb 2011 02:50:39 +0100 Subject: Moved .js files from data/ to data/lib/ so that we don't mix data and code. --- lib/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index 502d839..ec94d1e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -111,10 +111,10 @@ var messageHandler = exports.messageHandler = function messageHandler(worker, ms var contentScriptLibraries = { "bugzilla.redhat.com": [ - self.data.url("util.js"), - self.data.url("color.js"), - self.data.url("rhbzpage.js"), - self.data.url("bzpage.js") + self.data.url("lib/util.js"), + self.data.url("lib/color.js"), + self.data.url("lib/rhbzpage.js"), + self.data.url("lib/bzpage.js") ] }; @@ -139,7 +139,7 @@ pageMod.PageMod({ "https://bugzilla.redhat.com/attachment.cgi" ], contentScriptWhen: 'ready', - contentScriptFile: self.data.url("skip-bug.js") + contentScriptFile: self.data.url("lib/skip-bug.js") }); //tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017"); -- cgit From c336792e45b8567746cbb5aa7cf07543aebcd4f7 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 24 Feb 2011 23:49:39 +0100 Subject: Nouveau doesn't dedicated data, so just the Chipset line is parsed. --- lib/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index ec94d1e..022244f 100644 --- a/lib/main.js +++ b/lib/main.js @@ -142,4 +142,4 @@ pageMod.PageMod({ contentScriptFile: self.data.url("lib/skip-bug.js") }); -//tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=595017"); +// tabs.open("https://bugzilla.redhat.com/show_bug.cgi?id=679515"); -- cgit From 5957bf89411f587d6070afadfd33cbacbc173b45 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Tue, 1 Mar 2011 22:52:30 +0100 Subject: Logger at least creates new records. --- lib/main.js | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/main.js') diff --git a/lib/main.js b/lib/main.js index 022244f..accaa0e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -43,7 +43,6 @@ 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); -- cgit