diff options
-rw-r--r-- | data/bugzillalabelAbbreviations.json | 7 | ||||
-rw-r--r-- | data/bugzillalabelNames.json | 7 | ||||
-rw-r--r-- | data/matches.json | 15 | ||||
-rw-r--r-- | data/newUpstreamBug.json | 18 | ||||
-rw-r--r-- | data/queryUpstreamBug.json | 10 | ||||
-rw-r--r-- | docs/xhr.md | 82 | ||||
-rwxr-xr-x | jsons/drm_pciids.awk | 93 | ||||
-rw-r--r-- | jsons/drm_pciids.json | 407 | ||||
-rw-r--r-- | lib/main.js | 40 | ||||
-rw-r--r-- | lib/rhbzpage.js | 12 | ||||
-rw-r--r-- | lib/xmlrpc.js | 2 |
11 files changed, 166 insertions, 527 deletions
diff --git a/data/bugzillalabelAbbreviations.json b/data/bugzillalabelAbbreviations.json new file mode 100644 index 0000000..4a53cd1 --- /dev/null +++ b/data/bugzillalabelAbbreviations.json @@ -0,0 +1,7 @@ +{ + "bugzilla.mozilla.org": "MoFo", + "bugs.freedesktop.org": "FDo", + "bugs.eclipse.org": "Eclipse", + "bugzilla.gnome.org": "bgo", + "bugzilla.redhat.com": "RH" +}
\ No newline at end of file diff --git a/data/bugzillalabelNames.json b/data/bugzillalabelNames.json new file mode 100644 index 0000000..c079443 --- /dev/null +++ b/data/bugzillalabelNames.json @@ -0,0 +1,7 @@ +{ + "bugzilla.mozilla.org": "Mozilla Foundation", + "bugs.freedesktop.org": "FreeDesktop.org", + "bugs.eclipse.org": "Eclipse Project", + "bugzilla.gnome.org": "GNOME Desktop", + "bugzilla.redhat.com": "Red Hat" +}
\ No newline at end of file diff --git a/data/matches.json b/data/matches.json new file mode 100644 index 0000000..25329d6 --- /dev/null +++ b/data/matches.json @@ -0,0 +1,15 @@ +{ + "matches": [ + "https://bugzilla.redhat.com/show_bug.cgi", + "https://bz-web2-test.devel.redhat.com/show_bug.cgi", + "https://bugs.freedesktop.org/show_bug.cgi", + "https://bugzilla.mozilla.org/show_bug.cgi" + ], + "skipMatches": [ + "https://bugzilla.redhat.com/(process|post)_bug.cgi", + "https://bz-web2-test.devel.redhat.com/(process|post)_bug.cgi", + "https://bugzilla.mozilla.org/post_bug.cgi", + "https://bugzilla.mozilla.org/process_bug.cgi", + "https://bugzilla.(redhat.com|mozilla.org)/attachment.cgi$" + ] +}
\ No newline at end of file diff --git a/data/newUpstreamBug.json b/data/newUpstreamBug.json new file mode 100644 index 0000000..c4ace83 --- /dev/null +++ b/data/newUpstreamBug.json @@ -0,0 +1,18 @@ +[ + { + "regexp": "thunderbird", + "addr": "https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird" + }, + { + "regexp": "firefox", + "addr": "https://bugzilla.mozilla.org/enter_bug.cgi?product=Firefox" + }, + { + "regexp": "xulrunner", + "addr": "https://bugzilla.mozilla.org/enter_bug.cgi?product=Core" + }, + { + "regexp": "xorg-x11.*", + "addr": "https://bugs.freedesktop.org/enter_bug.cgi?product=xorg" + } +]
\ No newline at end of file diff --git a/data/queryUpstreamBug.json b/data/queryUpstreamBug.json new file mode 100644 index 0000000..3de67d0 --- /dev/null +++ b/data/queryUpstreamBug.json @@ -0,0 +1,10 @@ +[ + { + "regexp": "thunderbird|firefox|xulrunner", + "addr": "https://bugzilla.mozilla.org/buglist.cgi?quicksearch=" + }, + { + "regexp": "xorg-x11.*", + "addr": "https://bugs.freedesktop.org/buglist.cgi?quicksearch=product%3Axorg+" + } +]
\ No newline at end of file diff --git a/docs/xhr.md b/docs/xhr.md new file mode 100644 index 0000000..ea21c80 --- /dev/null +++ b/docs/xhr.md @@ -0,0 +1,82 @@ +The `xhr` module provides access to `XMLHttpRequest` +functionality, also known as AJAX. + +## Exports ## + +<code>xhr.**XMLHttpRequest**()</code> + +Creates an `XMLHttpRequest`. This is a constructor, so its use +should always be preceded by the `new` operator. For more information, +see the MDC page on [Using XMLHttpRequest]. + +<code>xhr.**getRequestCount**()</code> + +Returns the number of `XMLHttpRequest` objects that are alive +(i.e., currently active or about to be). + +## Limitations ## + +The `XMLHttpRequest` object is currently fairly limited, and does not +yet implement the `addEventListener()` or `removeEventListener()` +methods. It also doesn't yet implement the `upload` property. + +Furthermore, the `XMLHttpRequest` object does not currently support +the `mozBackgroundRequest` property. All security UI, such as +username/password prompts, are automatically suppressed, so if +required authentication information isn't passed to the `open()` +method, the request will fail. + +## Resource Use ## + +Whenever this module is unloaded, all in-progress requests are immediately +aborted. + +## Security Concerns ## + +By default, the `XMLHttpRequest` object grants full access to any +protocol scheme, which means that it can be used to read from (but not +write to) the host system's entire filesystem. It also has unfettered +access to any local area networks, VPNs, and the internet. + +### Threat Model ### + +The `XMLHttpRequest` object can be used by an extension to "phone +home" and transmit potentially sensitive user data to third +parties. + +If access to the filesystem isn't prevented, it could easily be used +to access sensitive user data, though this may be inconsequential if +the client can't access the network. + +If access to local area networks isn't prevented, malicious Jetpack +code could access sensitive data. + +If transmission of cookies isn't prevented, malicious Jetpack code +could access sensitive data. + +Attenuating access based on a regular expression may be ineffective if +it's easy to write a regular expression that *looks* safe but contains +a special character or two that makes it far less secure than it seems +at first glance. + +### Possible Attenuations ### + +<span class="aside"> +We may also want to consider attenuating further based on domain name +and possibly even restricting the protocol to `https:` only, to reduce +risk. +</span> + +Before being exposed to unprivileged Jetpack code, this object needs +to be attenuated in such a way that, at the very least, it can't +access the user's filesystem. This can probably be done most securely +by white-listing the protocols that can be used in the URL passed to +the `open()` method, and limiting them to `http:`, `https:`, and +possibly a special scheme that can be used to access the Jetpack +extension's packaged, read-only resources. + +Finally, we need to also consider attenuating http/https requests such +that they're "sandboxed" and don't communicate potentially sensitive +cookie information. + + [Using XMLHttpRequest]: https://developer.mozilla.org/En/Using_XMLHttpRequest diff --git a/jsons/drm_pciids.awk b/jsons/drm_pciids.awk deleted file mode 100755 index dea8fd2..0000000 --- a/jsons/drm_pciids.awk +++ /dev/null @@ -1,93 +0,0 @@ -#!/usr/bin/gawk -f - -BEGIN { - FS=", " - - # NOTE: please edit flags template as well - flag_letter["RADEON_IS_MOBILITY"] = "m" - flag_letter["RADEON_NEW_MEMMAP"] = "M" - flag_letter["RADEON_IS_IGP"] = "i" - flag_letter["RADEON_IS_IGPGART"] = "I" - flag_letter["RADEON_SINGLE_CRTC"] = "c" - flags_template = "mMiIc" - first_line = "" - printf("{\n") -} - -function error(f, s1, s2) { - printf("%s:%d: " f "\n", FILENAME, NR, s1, s2) >"/dev/stderr" - error_code = 1 -} - -function flag_to_letter(f_name) -{ - if (f_name in flag_letter) { - return flag_letter[f_name] - } else { - error("unknown flag %s%s", f_name) - return f_name - } -} - -function format_flags(f_code, i, n, l, out) { - n = length(flags_template) - for (i=1; i<=n; i++) { - l = substr(flags_template, i, 1) - out = out f_code[l] - delete f_code[l] - } - for (l in f_code) { - out = out f_code[l] - if (length(l)==1) - error("flag \"%s\" missing from flags_template", l, "") - } - if (length(out)>0) { - out = ",\"" out "\"" - } - return out -} - -/^[[:blank:]]+{0x/ { - sub(/^[[:blank:]]+{/,"") - sub(/},[[:blank:]]*\\$/,"") - - id_vendor = $1; sub(/^0x/, "", id_vendor) - id_type = $2; sub(/^0x/, "", id_type) - - flags = $7 - - if (flags == "0") - next - - n_flag_arr = split(flags, flag_arr, "|") - first_flag = flag_arr[1] - delete f_code - for (i=2; i<=n_flag_arr; i++) { - l = flag_to_letter(flag_arr[i]) - f_code[l] = l - } - - formatted_flags = format_flags(f_code) - - # second param to gensub is the replacement text: - chip_type = tolower(gensub(/^CHIP_/, "", "", first_flag)) - - if (length(first_line) > 0) { - printf(",\n") - } else { - first_line = "TRUE" - } - if ((chip_type in types) && types[chip_type] != first_flag) - error("chip name collision: %s vs. %s", \ - types[chip_type], first_flag) - - types[chip_type] = first_flag - - printf("\t\"%s,%s\":[\"%s\"%s]", toupper(id_vendor), toupper(id_type),\ - chip_type, formatted_flags) -} - -END { - printf("\n}\n") - exit error_code -} diff --git a/jsons/drm_pciids.json b/jsons/drm_pciids.json deleted file mode 100644 index ee45add..0000000 --- a/jsons/drm_pciids.json +++ /dev/null @@ -1,407 +0,0 @@ -{ - "1002,3150":["rv380","m"], - "1002,3152":["rv380","mM"], - "1002,3154":["rv380","mM"], - "1002,3E50":["rv380","M"], - "1002,3E54":["rv380","M"], - "1002,4136":["rs100","i"], - "1002,4137":["rs200","i"], - "1002,4144":["r300"], - "1002,4145":["r300"], - "1002,4146":["r300"], - "1002,4147":["r300"], - "1002,4148":["r350"], - "1002,4149":["r350"], - "1002,414A":["r350"], - "1002,414B":["r350"], - "1002,4150":["rv350"], - "1002,4151":["rv350"], - "1002,4152":["rv350"], - "1002,4153":["rv350"], - "1002,4154":["rv350"], - "1002,4155":["rv350"], - "1002,4156":["rv350"], - "1002,4237":["rs200","i"], - "1002,4242":["r200"], - "1002,4243":["r200"], - "1002,4336":["rs100","mi"], - "1002,4337":["rs200","mi"], - "1002,4437":["rs200","mi"], - "1002,4966":["rv250"], - "1002,4967":["rv250"], - "1002,4A48":["r420","M"], - "1002,4A49":["r420","M"], - "1002,4A4A":["r420","M"], - "1002,4A4B":["r420","M"], - "1002,4A4C":["r420","M"], - "1002,4A4D":["r420","M"], - "1002,4A4E":["r420","mM"], - "1002,4A4F":["r420","M"], - "1002,4A50":["r420","M"], - "1002,4A54":["r420","M"], - "1002,4B48":["r420","M"], - "1002,4B49":["r420","M"], - "1002,4B4A":["r420","M"], - "1002,4B4B":["r420","M"], - "1002,4B4C":["r420","M"], - "1002,4C57":["rv200","m"], - "1002,4C58":["rv200","m"], - "1002,4C59":["rv100","m"], - "1002,4C5A":["rv100","m"], - "1002,4C64":["rv250","m"], - "1002,4C66":["rv250","m"], - "1002,4C67":["rv250","m"], - "1002,4E44":["r300"], - "1002,4E45":["r300"], - "1002,4E46":["r300"], - "1002,4E47":["r300"], - "1002,4E48":["r350"], - "1002,4E49":["r350"], - "1002,4E4A":["r350"], - "1002,4E4B":["r350"], - "1002,4E50":["rv350","m"], - "1002,4E51":["rv350","m"], - "1002,4E52":["rv350","m"], - "1002,4E53":["rv350","m"], - "1002,4E54":["rv350","m"], - "1002,4E56":["rv350","m"], - "1002,5144":["r100","c"], - "1002,5145":["r100","c"], - "1002,5146":["r100","c"], - "1002,5147":["r100","c"], - "1002,5148":["r200"], - "1002,514C":["r200"], - "1002,514D":["r200"], - "1002,5157":["rv200"], - "1002,5158":["rv200"], - "1002,5159":["rv100"], - "1002,515A":["rv100"], - "1002,515E":["rv100","c"], - "1002,5460":["rv380","m"], - "1002,5462":["rv380","m"], - "1002,5464":["rv380","m"], - "1002,5657":["rv380","M"], - "1002,5548":["r423","M"], - "1002,5549":["r423","M"], - "1002,554A":["r423","M"], - "1002,554B":["r423","M"], - "1002,554C":["r423","M"], - "1002,554D":["r423","M"], - "1002,554E":["r423","M"], - "1002,554F":["r423","M"], - "1002,5550":["r423","M"], - "1002,5551":["r423","M"], - "1002,5552":["r423","M"], - "1002,5554":["r423","M"], - "1002,564A":["rv410","mM"], - "1002,564B":["rv410","mM"], - "1002,564F":["rv410","mM"], - "1002,5652":["rv410","mM"], - "1002,5653":["rv410","mM"], - "1002,5834":["rs300","i"], - "1002,5835":["rs300","mi"], - "1002,5954":["rs480","miI"], - "1002,5955":["rs480","miI"], - "1002,5974":["rs480","miI"], - "1002,5975":["rs480","miI"], - "1002,5960":["rv280"], - "1002,5961":["rv280"], - "1002,5962":["rv280"], - "1002,5964":["rv280"], - "1002,5965":["rv280"], - "1002,5969":["rv100","c"], - "1002,5A41":["rs400","iI"], - "1002,5A42":["rs400","miI"], - "1002,5A61":["rs400","iI"], - "1002,5A62":["rs400","miI"], - "1002,5B60":["rv380","M"], - "1002,5B62":["rv380","M"], - "1002,5B63":["rv380","M"], - "1002,5B64":["rv380","M"], - "1002,5B65":["rv380","M"], - "1002,5C61":["rv280","m"], - "1002,5C63":["rv280","m"], - "1002,5D48":["r423","mM"], - "1002,5D49":["r423","mM"], - "1002,5D4A":["r423","mM"], - "1002,5D4C":["r423","M"], - "1002,5D4D":["r423","M"], - "1002,5D4E":["r423","M"], - "1002,5D4F":["r423","M"], - "1002,5D50":["r423","M"], - "1002,5D52":["r423","M"], - "1002,5D57":["r423","M"], - "1002,5E48":["rv410","M"], - "1002,5E4A":["rv410","M"], - "1002,5E4B":["rv410","M"], - "1002,5E4C":["rv410","M"], - "1002,5E4D":["rv410","M"], - "1002,5E4F":["rv410","M"], - "1002,7100":["r520","M"], - "1002,7101":["r520","mM"], - "1002,7102":["r520","mM"], - "1002,7103":["r520","mM"], - "1002,7104":["r520","M"], - "1002,7105":["r520","M"], - "1002,7106":["r520","mM"], - "1002,7108":["r520","M"], - "1002,7109":["r520","M"], - "1002,710A":["r520","M"], - "1002,710B":["r520","M"], - "1002,710C":["r520","M"], - "1002,710E":["r520","M"], - "1002,710F":["r520","M"], - "1002,7140":["rv515","M"], - "1002,7141":["rv515","M"], - "1002,7142":["rv515","M"], - "1002,7143":["rv515","M"], - "1002,7144":["rv515","mM"], - "1002,7145":["rv515","mM"], - "1002,7146":["rv515","M"], - "1002,7147":["rv515","M"], - "1002,7149":["rv515","mM"], - "1002,714A":["rv515","mM"], - "1002,714B":["rv515","mM"], - "1002,714C":["rv515","mM"], - "1002,714D":["rv515","M"], - "1002,714E":["rv515","M"], - "1002,714F":["rv515","M"], - "1002,7151":["rv515","M"], - "1002,7152":["rv515","M"], - "1002,7153":["rv515","M"], - "1002,715E":["rv515","M"], - "1002,715F":["rv515","M"], - "1002,7180":["rv515","M"], - "1002,7181":["rv515","M"], - "1002,7183":["rv515","M"], - "1002,7186":["rv515","mM"], - "1002,7187":["rv515","M"], - "1002,7188":["rv515","mM"], - "1002,718A":["rv515","mM"], - "1002,718B":["rv515","mM"], - "1002,718C":["rv515","mM"], - "1002,718D":["rv515","mM"], - "1002,718F":["rv515","M"], - "1002,7193":["rv515","M"], - "1002,7196":["rv515","mM"], - "1002,719B":["rv515","M"], - "1002,719F":["rv515","M"], - "1002,71C0":["rv530","M"], - "1002,71C1":["rv530","M"], - "1002,71C2":["rv530","M"], - "1002,71C3":["rv530","M"], - "1002,71C4":["rv530","mM"], - "1002,71C5":["rv530","mM"], - "1002,71C6":["rv530","M"], - "1002,71C7":["rv530","M"], - "1002,71CD":["rv530","M"], - "1002,71CE":["rv530","M"], - "1002,71D2":["rv530","M"], - "1002,71D4":["rv530","mM"], - "1002,71D5":["rv530","mM"], - "1002,71D6":["rv530","mM"], - "1002,71DA":["rv530","M"], - "1002,71DE":["rv530","mM"], - "1002,7200":["rv515","M"], - "1002,7210":["rv515","mM"], - "1002,7211":["rv515","mM"], - "1002,7240":["r580","M"], - "1002,7243":["r580","M"], - "1002,7244":["r580","M"], - "1002,7245":["r580","M"], - "1002,7246":["r580","M"], - "1002,7247":["r580","M"], - "1002,7248":["r580","M"], - "1002,7249":["r580","M"], - "1002,724A":["r580","M"], - "1002,724B":["r580","M"], - "1002,724C":["r580","M"], - "1002,724D":["r580","M"], - "1002,724E":["r580","M"], - "1002,724F":["r580","M"], - "1002,7280":["rv570","M"], - "1002,7281":["rv560","M"], - "1002,7283":["rv560","M"], - "1002,7284":["r580","mM"], - "1002,7287":["rv560","M"], - "1002,7288":["rv570","M"], - "1002,7289":["rv570","M"], - "1002,728B":["rv570","M"], - "1002,728C":["rv570","M"], - "1002,7290":["rv560","M"], - "1002,7291":["rv560","M"], - "1002,7293":["rv560","M"], - "1002,7297":["rv560","M"], - "1002,7834":["rs300","Mi"], - "1002,7835":["rs300","mMi"], - "1002,791E":["rs690","MiI"], - "1002,791F":["rs690","MiI"], - "1002,793F":["rs600","Mi"], - "1002,7941":["rs600","Mi"], - "1002,7942":["rs600","Mi"], - "1002,796C":["rs740","MiI"], - "1002,796D":["rs740","MiI"], - "1002,796E":["rs740","MiI"], - "1002,796F":["rs740","MiI"], - "1002,9400":["r600","M"], - "1002,9401":["r600","M"], - "1002,9402":["r600","M"], - "1002,9403":["r600","M"], - "1002,9405":["r600","M"], - "1002,940A":["r600","M"], - "1002,940B":["r600","M"], - "1002,940F":["r600","M"], - "1002,94A0":["rv740","mM"], - "1002,94A1":["rv740","mM"], - "1002,94A3":["rv740","mM"], - "1002,94B1":["rv740","M"], - "1002,94B3":["rv740","M"], - "1002,94B4":["rv740","M"], - "1002,94B5":["rv740","M"], - "1002,94B9":["rv740","mM"], - "1002,9440":["rv770","M"], - "1002,9441":["rv770","M"], - "1002,9442":["rv770","M"], - "1002,9443":["rv770","M"], - "1002,9444":["rv770","M"], - "1002,9446":["rv770","M"], - "1002,944A":["rv770","mM"], - "1002,944B":["rv770","mM"], - "1002,944C":["rv770","M"], - "1002,944E":["rv770","M"], - "1002,9450":["rv770","M"], - "1002,9452":["rv770","M"], - "1002,9456":["rv770","M"], - "1002,945A":["rv770","mM"], - "1002,945B":["rv770","mM"], - "1002,9460":["rv770","M"], - "1002,9462":["rv770","M"], - "1002,946A":["rv770","mM"], - "1002,946B":["rv770","mM"], - "1002,947A":["rv770","mM"], - "1002,947B":["rv770","mM"], - "1002,9480":["rv730","mM"], - "1002,9487":["rv730","M"], - "1002,9488":["rv730","mM"], - "1002,9489":["rv730","mM"], - "1002,948F":["rv730","M"], - "1002,9490":["rv730","M"], - "1002,9491":["rv730","mM"], - "1002,9495":["rv730","M"], - "1002,9498":["rv730","M"], - "1002,949C":["rv730","M"], - "1002,949E":["rv730","M"], - "1002,949F":["rv730","M"], - "1002,94C0":["rv610","M"], - "1002,94C1":["rv610","M"], - "1002,94C3":["rv610","M"], - "1002,94C4":["rv610","M"], - "1002,94C5":["rv610","M"], - "1002,94C6":["rv610","M"], - "1002,94C7":["rv610","M"], - "1002,94C8":["rv610","mM"], - "1002,94C9":["rv610","mM"], - "1002,94CB":["rv610","mM"], - "1002,94CC":["rv610","M"], - "1002,94CD":["rv610","M"], - "1002,9500":["rv670","M"], - "1002,9501":["rv670","M"], - "1002,9504":["rv670","mM"], - "1002,9505":["rv670","M"], - "1002,9506":["rv670","mM"], - "1002,9507":["rv670","M"], - "1002,9508":["rv670","mM"], - "1002,9509":["rv670","mM"], - "1002,950F":["rv670","M"], - "1002,9511":["rv670","M"], - "1002,9515":["rv670","M"], - "1002,9517":["rv670","M"], - "1002,9519":["rv670","M"], - "1002,9540":["rv710","M"], - "1002,9541":["rv710","M"], - "1002,9542":["rv710","M"], - "1002,954E":["rv710","M"], - "1002,954F":["rv710","M"], - "1002,9552":["rv710","mM"], - "1002,9553":["rv710","mM"], - "1002,9555":["rv710","mM"], - "1002,9557":["rv710","mM"], - "1002,9580":["rv630","M"], - "1002,9581":["rv630","mM"], - "1002,9583":["rv630","mM"], - "1002,9586":["rv630","M"], - "1002,9587":["rv630","M"], - "1002,9588":["rv630","M"], - "1002,9589":["rv630","M"], - "1002,958A":["rv630","M"], - "1002,958B":["rv630","mM"], - "1002,958C":["rv630","M"], - "1002,958D":["rv630","M"], - "1002,958E":["rv630","M"], - "1002,958F":["rv630","mM"], - "1002,9590":["rv635","M"], - "1002,9591":["rv635","mM"], - "1002,9593":["rv635","mM"], - "1002,9595":["rv635","mM"], - "1002,9596":["rv635","M"], - "1002,9597":["rv635","M"], - "1002,9598":["rv635","M"], - "1002,9599":["rv635","M"], - "1002,959B":["rv635","mM"], - "1002,95C0":["rv620","M"], - "1002,95C2":["rv620","mM"], - "1002,95C4":["rv620","mM"], - "1002,95C5":["rv620","M"], - "1002,95C6":["rv620","M"], - "1002,95C7":["rv620","M"], - "1002,95C9":["rv620","M"], - "1002,95CC":["rv620","M"], - "1002,95CD":["rv620","M"], - "1002,95CE":["rv620","M"], - "1002,95CF":["rv620","M"], - "1002,9610":["rs780","Mi"], - "1002,9611":["rs780","Mi"], - "1002,9612":["rs780","Mi"], - "1002,9613":["rs780","Mi"], - "1002,9614":["rs780","Mi"], - "1002,9615":["rs780","Mi"], - "1002,9616":["rs780","Mi"], - "1002,9710":["rs880","Mi"], - "1002,9711":["rs880","Mi"], - "1002,9712":["rs880","mMi"], - "1002,9713":["rs880","mMi"], - "1002,9714":["rs880","Mi"], - "102B,0520":["mga_card_type_g200"], - "102B,0521":["mga_card_type_g200"], - "102B,0525":["mga_card_type_g400"], - "102B,2527":["mga_card_type_g550"], - "1039,6330":["sis_chip_315"], - "18CA,0040":["sis_chip_315"], - "18CA,0042":["sis_chip_315"], - "1106,3118":["via_pro_group_a"], - "1106,3230":["via_dx9_0"], - "1106,3157":["via_pro_group_a"], - "5333,8A20":["s3_savage3d"], - "5333,8A21":["s3_savage3d"], - "5333,8A22":["s3_savage4"], - "5333,8A23":["s3_savage4"], - "5333,8C10":["s3_savage_mx"], - "5333,8C11":["s3_savage_mx"], - "5333,8C12":["s3_savage_mx"], - "5333,8C13":["s3_savage_mx"], - "5333,8C22":["s3_supersavage"], - "5333,8C24":["s3_supersavage"], - "5333,8C26":["s3_supersavage"], - "5333,8C2A":["s3_supersavage"], - "5333,8C2B":["s3_supersavage"], - "5333,8C2C":["s3_supersavage"], - "5333,8C2D":["s3_supersavage"], - "5333,8C2E":["s3_supersavage"], - "5333,8C2F":["s3_supersavage"], - "5333,8A25":["s3_prosavage"], - "5333,8A26":["s3_prosavage"], - "5333,8D01":["s3_twister"], - "5333,8D02":["s3_twister"], - "5333,8D03":["s3_prosavageddr"], - "5333,8D04":["s3_prosavageddr"] -} diff --git a/lib/main.js b/lib/main.js index f40dcd1..3d59d6e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,6 +16,7 @@ var logger = require("logger"); var myStorage = require("simple-storage").storage; var browser = require("tab-browser"); var urlMod = require("url"); +var selfMod = require("self"); var preferences = require("preferences-service"); var BSTPrefNS = require("bzpage").BSTPrefNS; // Use my JSON for now before it is fixed for general public @@ -26,21 +27,12 @@ var NumberOfFrames = 7; var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi"; var config = {}; -config.matches = [ - "https://bugzilla.redhat.com/show_bug.cgi", - "https://bz-web2-test.devel.redhat.com/show_bug.cgi", - "https://bugs.freedesktop.org/show_bug.cgi", - "https://bugzilla.mozilla.org/show_bug.cgi" -]; - -config.skipMatches = [ - "https://bugzilla.redhat.com/(process|post)_bug.cgi", - "https://bz-web2-test.devel.redhat.com/(process|post)_bug.cgi", - "https://bugzilla.mozilla.org/post_bug.cgi", - "https://bugzilla.mozilla.org/process_bug.cgi", - "https://bugzilla.(redhat.com|mozilla.org)/attachment.cgi$" -]; - +(function (){ + var matchesAll = JSON.parse(selfMod.data.load("matches.json")); + config.matches = matchesAll.matches; + config.skipMatches = matchesAll.skipMatches; +})(); +console.log("config.matches = " + config.matches.toSource()); // ============================================================== // https://wiki.mozilla.org/Labs/Jetpack/JEP/24 var WillBemanifest = { @@ -114,11 +106,17 @@ function initialize(callback) { console.log("loaded JSON object keys: " + keys); // Get card translation table - if ("PCIIDsURL" in config.gJSONData.configData) { - util.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) { - config.PCI_ID_Array = response; - }); - } + if ("downloadJSON" in config.gJSONData.configData) { + var URLsList = config.gJSONData.configData.downloadJSON; + for (var dwnldObj in URLsList) { + console.log("Downloading " + + dwnldObj + " from URL " + + URLsList[dwnldObj] + "."); + util.loadJSON(URLsList[dwnldObj],function(response){ + config[dwnldObj] = response; + }); + } + }; if (!myStorage.logs) { console.log("myStorage.logs empty!"); @@ -127,7 +125,7 @@ function initialize(callback) { var logConstructor = logger.Logger; config.logger = new logConstructor(myStorage.logs, - config.gJSONData.constantData.bugzillalabelAbbreviations); + JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json"))); callback(config); }, this); diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js index ef28175..f61a88b 100644 --- a/lib/rhbzpage.js +++ b/lib/rhbzpage.js @@ -6,6 +6,7 @@ var util = require("util"); var xrpc = require("xmlrpc"); var apiUtils = require("api-utils"); var xhr = require("xhr"); +var self = require("self"); var clip = require("clipboard"); var Color = require("color").Color; var BZPage = require("bzpage").BZPage; @@ -410,7 +411,7 @@ RHBugzillaPage.prototype.fillInWhiteBoard = function(iLine, driverStr) { var that = this; function groupIDs(manStr, cardStrID) { - var outStr = util.filterByRegexp(chipIDsGroupings, manStr + "," + cardStrID); + var outStr = util.filterByRegexp(config.chipIDsGroupings, manStr + "," + cardStrID); if (outStr.length === 0) { outStr = "UNGROUPED_" + manStr + "/" + cardStrID; } @@ -597,7 +598,7 @@ RHBugzillaPage.prototype.queryUpstream = function() { var text = this.getSelectionOrClipboard(); if (text) { text = encodeURIComponent(text.trim()); - var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug; + var queryUpstreamBugsURLArray = self.data.load("queryUpstreamBug.json"); var urlBase = util.filterByRegexp(queryUpstreamBugsURLArray, this.component); tabs.open({ url: urlBase + text, @@ -614,7 +615,7 @@ RHBugzillaPage.prototype.queryUpstream = function() { */ RHBugzillaPage.prototype.sendBugUpstream = function() { var that = this; - var urlStr = util.filterByRegexp(this.constantData.newUpstreamBug, this + var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this .getOptionValue("component")); var ret = tabs.open({ @@ -692,8 +693,9 @@ RHBugzillaPage.prototype.fixElement = function(elem, beforeText, accKey, afterTe */ RHBugzillaPage.prototype.getBugzillaName = function(URLhostname) { var bugzillaID = ""; - if (this.constantData.bugzillalabelNames[URLhostname]) { - bugzillaID = this.constantData.bugzillalabelNames[URLhostname]; + var bzLabelNames = JSON.parse(self.data.load("bugzillalabelNames.json")); + if (bzLabelNames[URLhostname]) { + bugzillaID = bzLabelNames[URLhostname]; } else { bugzillaID = ""; } diff --git a/lib/xmlrpc.js b/lib/xmlrpc.js index 7ae622c..9163089 100644 --- a/lib/xmlrpc.js +++ b/lib/xmlrpc.js @@ -1,4 +1,4 @@ -// Released under the MIT/X11 license +// Modification of Matěj Cepl released under the MIT/X11 license // http://www.opensource.org/licenses/mit-license.php "use strict"; /* |