aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-10-25 23:52:31 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-10-25 23:52:31 +0200
commitf4b2d74740a25a23a7e16597e2a1f0dcf9fb732d (patch)
tree21189ae39af414e6e6067a3c829f541b2ff65ef6 /lib/main.js
parentf22d97c2bc0f5c04b69eaee3ad15f7cdd594f3db (diff)
downloadbugzilla-triage-f4b2d74740a25a23a7e16597e2a1f0dcf9fb732d.tar.gz
Move choice of particular content script objects to initialize().
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/main.js b/lib/main.js
index 8e8aeaa..fbabd41 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -94,6 +94,14 @@ function initialize(callback) {
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);
}
}
@@ -107,16 +115,9 @@ exports.main = function main(options, callbacks) {
// is this good for anything?
if ("window" in window) { window = window.window; }
- var construct = {};
- var bzType = config.gJSONData.configData.objectStyle;
- if (bzType === "RH") {
- construct = require("rhbzpage").RHBugzillaPage;
- } else if (bzType === "MoFo") {
- construct = require("mozillabzpage").MozillaBugzilla;
- }
if (isOurPage(window, config.matches)) {
try {
- var curPage = new construct(window, config);
+ 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