Bug 420356: Ship blocklist.xml with Firefox. r=gavin.sharp

This commit is contained in:
dtownsend@oxymoronical.com 2008-03-19 15:35:03 -07:00
Родитель 86afe74b5b
Коммит baec3b5286
5 изменённых файлов: 42 добавлений и 2 удалений

Просмотреть файл

@ -363,6 +363,9 @@ libs::
libs:: $(srcdir)/profile/prefs.js
$(INSTALL) $^ $(DIST)/bin/defaults/profile
libs:: $(srcdir)/blocklist.xml
$(INSTALL) $^ $(DIST)/bin
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
APP_NAME = $(MOZ_APP_DISPLAYNAME)

19
browser/app/blocklist.xml Normal file
Просмотреть файл

@ -0,0 +1,19 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
<emItem id="fdm_ffext@freedownloadmanager.org">
<versionRange minVersion="1.0" maxVersion="1.3.1">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
<emItem id="mozilla_cc@internetdownloadmanager.com">
<versionRange minVersion="2.1" maxVersion="3.3">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
<versionRange minVersion="3.0a1" maxVersion="*"/>
</targetApplication>
</versionRange>
</emItem>
</emItems>
</blocklist>

Просмотреть файл

@ -51,6 +51,7 @@ bin/run-mozilla.sh
bin/plugins/libnullplugin.so
bin/libsqlite3.so
bin/README.txt
bin/blocklist.xml
; [Components]
bin/components/alerts.xpt

Просмотреть файл

@ -60,6 +60,7 @@ bin\plugins\npnul32.dll
bin\LICENSE
bin\README.txt
bin\sqlite3.dll
bin\blocklist.xml
; [Components]
bin\components\alerts.xpt

Просмотреть файл

@ -47,6 +47,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const TOOLKIT_ID = "toolkit@mozilla.org"
const KEY_PROFILEDIR = "ProfD";
const KEY_APPDIR = "XCurProcD";
const FILE_BLOCKLIST = "blocklist.xml";
const PREF_BLOCKLIST_URL = "extensions.blocklist.url";
const PREF_BLOCKLIST_ENABLED = "extensions.blocklist.enabled";
@ -275,7 +276,7 @@ Blocklist.prototype = {
isAddonBlocklisted: function(id, version, appVersion, toolkitVersion) {
if (!this._addonEntries)
this._loadBlocklistFromFile(getFile(KEY_PROFILEDIR, [FILE_BLOCKLIST]));
this._loadBlocklist();
if (!appVersion)
appVersion = gApp.version;
if (!toolkitVersion)
@ -398,6 +399,21 @@ Blocklist.prototype = {
statusText);
},
/**
* Finds the newest blocklist file from the application and the profile and
* load it or does nothing if neither exist.
*/
_loadBlocklist: function() {
var profFile = getFile(KEY_PROFILEDIR, [FILE_BLOCKLIST]);
if (profFile.exists()) {
this._loadBlocklistFromFile(profFile);
return;
}
var appFile = getFile(KEY_APPDIR, [FILE_BLOCKLIST]);
if (appFile.exists())
this._loadBlocklistFromFile(appFile);
},
/**
# The blocklist XML file looks something like this:
#
@ -581,7 +597,7 @@ Blocklist.prototype = {
_checkPluginsList: function() {
if (!this._addonEntries)
this._loadBlocklistFromFile(getFile(KEY_PROFILEDIR, [FILE_BLOCKLIST]));
this._loadBlocklist();
var phs = Cc["@mozilla.org/plugin/host;1"].
getService(Ci.nsIPluginHost);
phs.getPluginTags({ }).forEach(this._checkPlugin, this);