aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-09-01 11:15:44 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-09-01 11:27:29 +0200
commit2b4ce1c26b5eee5d4864d088657119c58b97e856 (patch)
treed7e879efe52ec4b3a17f417e73344895dacf00fd
parent5efc52cf5cec2b9b5f75351da8e473c2f90266b5 (diff)
downloadbugzilla-triage-2b4ce1c26b5eee5d4864d088657119c58b97e856.tar.gz
Use regular expressions instead of long long array of URLs.
Yes, I know https://groups.google.com/d/topic/alt.religion.emacs/DR057Srw5-c/discussion (actually, also http://regex.info/blog/2006-09-15/247 :))
-rw-r--r--lib/main.js26
1 files changed, 6 insertions, 20 deletions
diff --git a/lib/main.js b/lib/main.js
index 1d97e81..3ca736e 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -123,15 +123,12 @@ var contentScriptLibraries = [
self.data.url("lib/bzpage.js")
];
+var mainPMRE = new RegExp("http[s]?:\\/\\/bug(zilla|s)\\.[^\\/]*?" +
+ "\\/show_bug.cgi\\?id=.*");
libbz.initialize(libbz.config, function() {
pageMod.PageMod({
- include : [
- "https://bugzilla.redhat.com/show_bug.cgi?id=*",
- "https://bugzilla.mozilla.org/show_bug.cgi?id=*",
- "https://bugs.freedesktop.org/show_bug.cgi?id=*",
- "https://bugzilla.gnome.org/show_bug.cgi?id=*"
- ],
+ include : [ mainPMRE ],
contentScriptWhen : 'ready',
contentScriptFile : contentScriptLibraries,
onAttach : function onAttach(worker, msg) {
@@ -149,22 +146,11 @@ libbz.initialize(libbz.config, function() {
});
});
+var skipPGRE = new RegExp("http[s]?:\\/\\/bug(zilla|s)\\.[^\\/]*?" +
+ "\\/(process_bug|post_bug|attachment).cgi");
pageMod.PageMod({
- include : [
- "https://bugzilla.redhat.com/process_bug.cgi",
- "https://bugzilla.redhat.com/post_bug.cgi",
- "https://bugzilla.redhat.com/attachment.cgi",
- "https://bugs.freedesktop.org/process_bug.cgi",
- "https://bugs.freedesktop.org/post_bug.cgi",
- "https://bugs.freedesktop.org/attachment.cgi",
- "https://bugzilla.mozilla.org/process_bug.cgi",
- "https://bugzilla.mozilla.org/post_bug.cgi",
- "https://bugzilla.mozilla.org/attachment.cgi",
- "https://bugzilla.gnome.org/process_bug.cgi",
- "https://bugzilla.gnome.org/post_bug.cgi",
- "https://bugzilla.gnome.org/attachment.cgi"
- ],
+ include : [ skipPGRE ],
contentScriptWhen : 'ready',
contentScriptFile : self.data.url("lib/skip-bug.js")
});