aboutsummaryrefslogtreecommitdiffstats
path: root/lib/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/main.js')
-rw-r--r--lib/main.js20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/main.js b/lib/main.js
index a8bae4c..25498d6 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -39,15 +39,13 @@ function isOurPage(window, matchingURLs) {
*/
function skipThisPage(doc) {
var stemURL = "https://HOSTNAME/show_bug.cgi?id=";
- var titleStr = doc.getElementsByTagName("title")[0].textContent;
+ var titleElems = doc.getElementsByTagName("title");
+ console.log("titleElems.length = " + titleElems.length);
+ var titleStr = titleElems[0].textContent;
var REArr = new RegExp("[bB]ug\\s+([0-9]+)").exec(titleStr);
var hostname = doc.location.hostname;
if (REArr) {
var bugNo = REArr[1];
- var emailsSent = doc.
- querySelector("#bugzilla-body > dl:nth-of-type(1)").textContent;
- emailsSent = emailsSent.replace(/^(\s*)$/mg,"");
- prompts.notification(emailsSent);
doc.location = stemURL.replace("HOSTNAME",hostname) + bugNo;
}
}
@@ -102,7 +100,7 @@ function initialize(callback) {
config.matches = config.gJSONData.configData.matches;
config.skipMatches = config.matches.map(function(x) {
- return x.replace("show_bug.cgi.*","(process|post)_bug.cgi");
+ return x.replace("show_bug.cgi.*","((process|post)_bug|attachment)\.cgi$");
});
callback(config);
@@ -126,7 +124,15 @@ exports.main = function main(options, callbacks) {
construct = require("mozillabzpage").MozillaBugzilla;
}
if (isOurPage(window, config.matches)) {
- var curPage = new construct(window, config);
+ try {
+ var curPage = new construct(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);
}