aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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