Bug 880675 - Remove the writable nsIPluginTag.blocklisted property, which is a poorly-constructed cache of the blocklist data, r=jschoenick r=unfocused

--HG--
extra : rebase_source : 04fd347af86d9bb47493ca37455008dedcc570f4
This commit is contained in:
Benjamin Smedberg 2013-06-11 10:58:42 -04:00
parent 61a933f3ec
commit 21b1ee6a24
18 changed files with 237 additions and 282 deletions

View File

@ -318,6 +318,7 @@ _BROWSER_FILES = \
blockPluginVulnerableUpdatable.xml \
blockPluginVulnerableNoUpdate.xml \
blockNoPlugins.xml \
blockPluginHard.xml \
browser_utilityOverlay.js \
browser_bug676619.js \
download_page.html \

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
<emItems>
</emItems>
<pluginItems>
<pluginItem blockID="p9999">
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
<versionRange severity="2"></versionRange>
</pluginItem>
</pluginItems>
</blocklist>

View File

@ -58,12 +58,16 @@ TabOpenListener.prototype = {
function test() {
waitForExplicitFinish();
requestLongerTimeout(2);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
Services.prefs.clearUserPref("plugins.click_to_play");
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
});
Services.prefs.setBoolPref("plugins.click_to_play", false);
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
var plugin = getTestPlugin();
plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
@ -117,7 +121,6 @@ function test1() {
var plugin = getTestPlugin();
ok(plugin, "Should have a test plugin");
plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
plugin.blocklisted = false;
prepareTest(test2, gTestRoot + "plugin_test.html");
}
@ -159,14 +162,19 @@ function test4(tab, win) {
}
function prepareTest5() {
info("prepareTest5");
var plugin = getTestPlugin();
plugin.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
plugin.blocklisted = true;
prepareTest(test5, gTestRoot + "plugin_test.html");
setAndUpdateBlocklist(gHttpTestRoot + "blockPluginHard.xml",
function() {
info("prepareTest5 callback");
prepareTest(test5, gTestRoot + "plugin_test.html");
});
}
// Tests a page with a blocked plugin in it.
function test5() {
info("test5");
var notificationBox = gBrowser.getNotificationBox(gTestBrowser);
ok(!PopupNotifications.getNotification("plugins-not-found", gTestBrowser), "Test 5, Should not have displayed the missing plugin notification");
ok(notificationBox.getNotificationWithValue("blocked-plugins"), "Test 5, Should have displayed the blocked plugin notification");
@ -204,11 +212,12 @@ function test7() {
Services.prefs.setBoolPref("plugins.click_to_play", true);
var plugin = getTestPlugin();
plugin.blocklisted = false;
plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
prepareTest(test8, gTestRoot + "plugin_test.html");
setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
prepareTest(test8, gTestRoot + "plugin_test.html");
});
}
// Tests a page with a working plugin that is click-to-play
@ -533,7 +542,6 @@ function test14() {
Services.prefs.setBoolPref("plugins.click_to_play", true);
var plugin = getTestPlugin();
plugin.blocklisted = false;
plugin.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
prepareTest(test15, gTestRoot + "plugin_alternate_content.html");

View File

@ -17,6 +17,8 @@ MOCHITEST_FILES = \
MOCHITEST_CHROME_FILES = \
test_bug206691.xul \
test_bug391728.html \
blockPluginHard.xml \
blockNoPlugins.xml \
file_bug391728.html \
file_bug391728_2.html \
test_bug421622.xul \

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310001">
<emItems>
</emItems>
<pluginItems>
</pluginItems>
</blocklist>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
<emItems>
</emItems>
<pluginItems>
<pluginItem blockID="p9999">
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
<versionRange severity="2"></versionRange>
</pluginItem>
</pluginItems>
</blocklist>

View File

@ -17,6 +17,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391728
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
const gHttpTestRoot = location.toString().replace("chrome://mochitests/content/", "http://127.0.0.1:8888/").split(/\//).slice(0, -1).join('/') + '/';
Components.utils.import("resource://gre/modules/Services.jsm");
/** Test for Bug 391728 **/
// Plugins that should dispatch error events and have the pseudo classes set
const PLUGIN_COUNT = 11;
@ -46,16 +50,39 @@ function plugin_binding_attached(event) {
}
function init_test() {
// Make sure the blocklist is off for the duration of this test
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.setBoolPref("extensions.blocklist.enabled", false);
if (!PluginUtils.withTestPlugin(start_test))
SimpleTest.finish();
}
function updateBlocklist(aCallback) {
var blocklistNotifier = Components.classes["@mozilla.org/extensions/blocklist;1"]
.getService(Components.interfaces.nsITimerCallback);
var observer = function() {
aCallback();
Services.obs.removeObserver(observer, "blocklist-updated");
};
Services.obs.addObserver(observer, "blocklist-updated", false);
blocklistNotifier.notify(null);
}
var _originalBlocklistURL = null;
function setAndUpdateBlocklist(aURL, aCallback) {
info("Setting blocklist to " + aURL);
if (!_originalBlocklistURL) {
_originalBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
}
Services.prefs.setCharPref("extensions.blocklist.url", aURL);
updateBlocklist(aCallback);
}
function resetBlocklist() {
info("resetting blocklist URL to " + _originalBlocklistURL);
Services.prefs.setCharPref("extensions.blocklist.url", _originalBlocklistURL);
}
function start_test(plugin) {
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
is(plugin.description, "Plug-in for testing purposes.\u2122 " +
"(\u0939\u093f\u0928\u094d\u0926\u0940 " +
"\u4e2d\u6587 " +
@ -71,11 +98,9 @@ function start_test(plugin) {
}
function finish_test(plugin) {
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
resetBlocklist();
plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
plugin.blocklisted = false;
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.clearUserPref("extensions.blocklist.enabled");
SimpleTest.finish();
}
@ -139,8 +164,11 @@ function test_disabled(plugin) {
test_style("dotted");
ok(plugin.disabled, "Plugin lost its disabled status");
plugin.enabledState = Components.interfaces.nsIPluginTag.STATE_ENABLED;
plugin.blocklisted = true;
load_frame(test_blocked, "file_bug391728");
setAndUpdateBlocklist(gHttpTestRoot + "blockPluginHard.xml",
function() {
load_frame(test_blocked, "file_bug391728");
});
}
function test_blocked(plugin) {
@ -159,7 +187,10 @@ function test_unknown(plugin) {
is(gDisabled.length, 0, "Should not have been any disabled plugins");
is(gBlocked.length, 0, "Should not have been any blocked plugins");
test_style("none");
finish_test(plugin);
setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
ok(!plugin.blocklisted, "Plugin shouldn't remain blocklisted");
finish_test(plugin);
});
}
SimpleTest.waitForExplicitFinish();

View File

@ -5,7 +5,7 @@
#include "nsISupports.idl"
[scriptable, uuid(00ea1f72-a57a-49bb-ac57-478902d9228b)]
[scriptable, uuid(0354d96d-3fd3-4365-a0a2-6c807ec1ce95)]
interface nsIPluginTag : nsISupports
{
// enabledState is stored as one of the following as an integer in prefs,
@ -19,7 +19,12 @@ interface nsIPluginTag : nsISupports
readonly attribute AUTF8String fullpath;
readonly attribute AUTF8String version;
readonly attribute AUTF8String name;
attribute boolean blocklisted;
/**
* true only if this plugin is "hardblocked" and cannot be enabled.
*/
readonly attribute boolean blocklisted;
readonly attribute boolean disabled;
readonly attribute boolean clicktoplay;
attribute unsigned long enabledState;

View File

@ -1967,16 +1967,10 @@ nsresult nsPluginHost::ScanPluginsDirectory(nsIFile *pluginsDir,
EmptyString(), &state);
if (NS_SUCCEEDED(rv)) {
// If the blocklist says so, block the plugin.
// If the blocklist says it is risky and we have never seen this
// plugin before, then disable it.
// If the blocklist says this is an outdated plugin, warn about
// outdated plugins.
// If the blocklist says the plugin is one of the click-to-play
// states, set the click-to-play flag.
if (state == nsIBlocklistService::STATE_BLOCKED) {
pluginTag->SetBlocklisted(true);
}
if (state == nsIBlocklistService::STATE_SOFTBLOCKED && !seenBefore) {
pluginTag->SetEnabledState(nsIPluginTag::STATE_DISABLED);
}

View File

@ -11,6 +11,7 @@
#include "nsServiceManagerUtils.h"
#include "nsPluginsDir.h"
#include "nsPluginHost.h"
#include "nsIBlocklistService.h"
#include "nsIUnicodeDecoder.h"
#include "nsIPlatformCharset.h"
#include "nsICharsetConverterManager.h"
@ -30,7 +31,6 @@ using mozilla::TimeStamp;
// no longer used 0x0002 // reuse only if regenerating pluginreg.dat
#define NS_PLUGIN_FLAG_FROMCACHE 0x0004 // this plugintag info was loaded from cache
// no longer used 0x0008 // reuse only if regenerating pluginreg.dat
#define NS_PLUGIN_FLAG_BLOCKLISTED 0x0010 // this is a blocklisted plugin
#define NS_PLUGIN_FLAG_CLICKTOPLAY 0x0020 // this is a click-to-play plugin
inline char* new_str(const char* str)
@ -63,12 +63,6 @@ GetStatePrefNameForPlugin(nsPluginTag* aTag)
return MakePrefNameForPlugin("state", aTag);
}
static nsCString
GetBlocklistedPrefNameForPlugin(nsPluginTag* aTag)
{
return MakePrefNameForPlugin("blocklisted", aTag);
}
NS_IMPL_ISUPPORTS1(DOMMimeTypeImpl, nsIDOMMimeType)
/* nsPluginTag */
@ -332,7 +326,14 @@ nsPluginTag::GetDisabled(bool* aDisabled)
bool
nsPluginTag::IsBlocklisted()
{
return Preferences::GetBool(GetBlocklistedPrefNameForPlugin(this).get(), false);
nsCOMPtr<nsIBlocklistService> bls = do_GetService("@mozilla.org/extensions/blocklist;1");
if (!bls) {
return false;
}
uint32_t state = nsIBlocklistService::STATE_NOT_BLOCKED;
bls->GetPluginBlocklistState(this, EmptyString(), EmptyString(), &state);
return state == nsIBlocklistService::STATE_BLOCKED;
}
NS_IMETHODIMP
@ -342,26 +343,6 @@ nsPluginTag::GetBlocklisted(bool* aBlocklisted)
return NS_OK;
}
NS_IMETHODIMP
nsPluginTag::SetBlocklisted(bool blocklisted)
{
if (blocklisted == IsBlocklisted()) {
return NS_OK;
}
const nsCString pref = GetBlocklistedPrefNameForPlugin(this);
if (blocklisted) {
Preferences::SetBool(pref.get(), true);
} else {
Preferences::ClearUser(pref.get());
}
if (nsRefPtr<nsPluginHost> host = nsPluginHost::GetInst()) {
host->UpdatePluginInfo(this);
}
return NS_OK;
}
bool
nsPluginTag::IsClicktoplay()
{
@ -556,8 +537,4 @@ void nsPluginTag::ImportFlagsToPrefs(uint32_t flags)
if (!(flags & NS_PLUGIN_FLAG_ENABLED)) {
SetPluginState(ePluginState_Disabled);
}
if (flags & NS_PLUGIN_FLAG_BLOCKLISTED) {
Preferences::SetBool(GetBlocklistedPrefNameForPlugin(this).get(), true);
}
}

View File

@ -55,7 +55,6 @@ function run_test() {
const pluginName = file.leafName.substring(0, file.leafName.length - suffix.length).toLowerCase();
const pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
const statePref = "plugin.state." + pluginName;
const blocklistedPref = "plugin.blocklisted." + pluginName;
// write plugin registry data
let registry = "";
@ -83,7 +82,6 @@ function run_test() {
// check that the expected plugin state was loaded correctly from the registry
do_check_true(plugin.disabled);
do_check_false(plugin.blocklisted);
do_check_false(plugin.clicktoplay);
// ... and imported into prefs, with 0 being the disabled state
do_check_eq(0, Services.prefs.getIntPref(statePref));

View File

@ -31,6 +31,7 @@ const PREF_BLOCKLIST_INTERVAL = "extensions.blocklist.interval";
const PREF_BLOCKLIST_LEVEL = "extensions.blocklist.level";
const PREF_BLOCKLIST_PINGCOUNTTOTAL = "extensions.blocklist.pingCountTotal";
const PREF_BLOCKLIST_PINGCOUNTVERSION = "extensions.blocklist.pingCountVersion";
const PREF_BLOCKLIST_SUPPRESSUI = "extensions.blocklist.suppressUI";
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_GENERAL_USERAGENT_LOCALE = "general.useragent.locale";
const PREF_APP_DISTRIBUTION = "distribution.id";
@ -957,7 +958,7 @@ Blocklist.prototype = {
if (state == oldState)
continue;
if (plugin.blocklisted) {
if (oldState == Ci.nsIBlocklistService.STATE_BLOCKED) {
if (state == Ci.nsIBlocklistService.STATE_SOFTBLOCKED)
plugin.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
}
@ -978,7 +979,6 @@ Blocklist.prototype = {
});
}
}
plugin.blocklisted = state == Ci.nsIBlocklistService.STATE_BLOCKED;
}
if (addonList.length == 0) {
@ -1027,7 +1027,12 @@ Blocklist.prototype = {
Services.obs.removeObserver(applyBlocklistChanges, "addon-blocklist-closed");
}
Services.obs.addObserver(applyBlocklistChanges, "addon-blocklist-closed", false)
Services.obs.addObserver(applyBlocklistChanges, "addon-blocklist-closed", false);
if (getPref("getBoolPref", PREF_BLOCKLIST_SUPPRESSUI, false)) {
applyBlocklistChanges();
return;
}
function blocklistUnloadHandler(event) {
if (event.target.location == URI_BLOCKLIST_DIALOG) {

View File

@ -111,6 +111,8 @@ MOCHITEST_BROWSER_RESOURCES = \
plugin_test.html \
redirect.sjs \
releaseNotes.xhtml \
blockNoPlugins.xml \
blockPluginHard.xml \
$(NULL)
MOCHITEST_BROWSER_FILES_PARTS = $(foreach s,MAIN SECONDARY RESOURCES,MOCHITEST_BROWSER_$(s))

View File

@ -0,0 +1,7 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310001">
<emItems>
</emItems>
<pluginItems>
</pluginItems>
</blocklist>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1336406310000">
<emItems>
</emItems>
<pluginItems>
<pluginItem blockID="p9999">
<match name="filename" exp="libnptest\.so|nptest\.dll|Test\.plugin" />
<versionRange severity="2"></versionRange>
</pluginItem>
</pluginItems>
</blocklist>

View File

@ -7,9 +7,34 @@ let gManagerWindow;
let gTestPluginId;
let gPluginBrowser;
function updateBlocklist(aCallback) {
var blocklistNotifier = Cc["@mozilla.org/extensions/blocklist;1"]
.getService(Ci.nsITimerCallback);
var observer = function() {
aCallback();
Services.obs.removeObserver(observer, "blocklist-updated");
};
Services.obs.addObserver(observer, "blocklist-updated", false);
blocklistNotifier.notify(null);
}
var _originalBlocklistURL = null;
function setAndUpdateBlocklist(aURL, aCallback) {
if (!_originalBlocklistURL) {
_originalBlocklistURL = Services.prefs.getCharPref("extensions.blocklist.url");
}
Services.prefs.setCharPref("extensions.blocklist.url", aURL);
updateBlocklist(aCallback);
}
function resetBlocklist(aCallback) {
Services.prefs.setCharPref("extensions.blocklist.url", _originalBlocklistURL);
}
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("plugins.click_to_play", true);
Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true);
let pluginTag = getTestPluginTag();
pluginTag.enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
open_manager("addons://list/plugin", part1);
@ -160,9 +185,13 @@ function part11() {
gBrowser.removeCurrentTab();
let pluginTag = getTestPluginTag();
pluginTag.blocklisted = true; // causes appDisabled to be set
close_manager(gManagerWindow, function() {
open_manager("addons://list/plugin", part12);
// causes appDisabled to be set
setAndUpdateBlocklist(gHttpTestRoot + "blockPluginHard.xml",
function() {
close_manager(gManagerWindow, function() {
open_manager("addons://list/plugin", part12);
});
});
}
@ -182,15 +211,17 @@ function part13() {
let menu = gManagerWindow.document.getElementById("detail-state-menulist");
is_element_hidden(menu, "part13: detail state menu should be hidden");
let pluginTag = getTestPluginTag();
pluginTag.blocklisted = false;
run_next_test();
setAndUpdateBlocklist(gHttpTestRoot + "blockNoPlugins.xml", function() {
run_next_test();
});
}
function end_test() {
Services.prefs.clearUserPref("plugins.click_to_play");
Services.prefs.clearUserPref("extensions.blocklist.suppressUI");
let pluginTag = getTestPluginTag();
pluginTag.enabledState = Ci.nsIPluginTag.STATE_ENABLED;
resetBlocklist();
close_manager(gManagerWindow, function() {
finish();
});

View File

@ -186,182 +186,48 @@ var ADDONS = [{
toolkitBlocks: true
}];
var PLUGINS = [{
name: "test_bug449027_1",
version: "5",
blocklisted: false,
start: false,
appBlocks: false,
toolkitBlocks: false
}, {
name: "test_bug449027_2",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_3",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_4",
version: "5",
blocklisted: false,
start: false,
appBlocks: false,
toolkitBlocks: false
}, {
name: "test_bug449027_5",
version: "5",
blocklisted: false,
start: false,
appBlocks: false,
toolkitBlocks: false
}, {
name: "test_bug449027_6",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_7",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_8",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_9",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_10",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_11",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_12",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_13",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: false
}, {
name: "test_bug449027_14",
version: "5",
blocklisted: false,
start: false,
appBlocks: false,
toolkitBlocks: false
}, {
name: "test_bug449027_15",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_16",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_17",
version: "5",
blocklisted: false,
start: false,
appBlocks: false,
toolkitBlocks: false
}, {
name: "test_bug449027_18",
version: "5",
blocklisted: false,
start: false,
appBlocks: false,
toolkitBlocks: false
}, {
name: "test_bug449027_19",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_20",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_21",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_22",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_23",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_24",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}, {
name: "test_bug449027_25",
version: "5",
blocklisted: false,
start: false,
appBlocks: true,
toolkitBlocks: true
}];
function MockPluginTag(name, version, start, appBlocks, toolkitBlocks)
{
this.name = name;
this.version = version;
this.start = start;
this.appBlocks = appBlocks;
this.toolkitBlocks = toolkitBlocks;
}
Object.defineProperty(MockPluginTag.prototype, "blocklisted", {
get: function MockPluginTag_getBlocklisted() {
let bls = AM_Cc["@mozilla.org/extensions/blocklist;1"].getService(Ci.nsIBlocklistService);
return bls.getPluginBlocklistState(this) == bls.STATE_BLOCKED;
}
});
var PLUGINS = [
new MockPluginTag("test_bug449027_1", "5", false, false, false),
new MockPluginTag("test_bug449027_2", "5", false, true, false),
new MockPluginTag("test_bug449027_3", "5", false, true, false),
new MockPluginTag("test_bug449027_4", "5", false, false, false),
new MockPluginTag("test_bug449027_5", "5", false, false, false),
new MockPluginTag("test_bug449027_6", "5", false, true, false),
new MockPluginTag("test_bug449027_7", "5", false, true, false),
new MockPluginTag("test_bug449027_8", "5", false, true, false),
new MockPluginTag("test_bug449027_9", "5", false, true, false),
new MockPluginTag("test_bug449027_10", "5", false, true, false),
new MockPluginTag("test_bug449027_11", "5", false, true, false),
new MockPluginTag("test_bug449027_12", "5", false, true, false),
new MockPluginTag("test_bug449027_13", "5", false, true, false),
new MockPluginTag("test_bug449027_14", "5", false, false, false),
new MockPluginTag("test_bug449027_15", "5", false, true, true),
new MockPluginTag("test_bug449027_16", "5", false, true, true),
new MockPluginTag("test_bug449027_17", "5", false, false, false),
new MockPluginTag("test_bug449027_18", "5", false, false, false),
new MockPluginTag("test_bug449027_19", "5", false, true, true),
new MockPluginTag("test_bug449027_20", "5", false, true, true),
new MockPluginTag("test_bug449027_21", "5", false, true, true),
new MockPluginTag("test_bug449027_22", "5", false, true, true),
new MockPluginTag("test_bug449027_23", "5", false, true, true),
new MockPluginTag("test_bug449027_24", "5", false, true, true),
new MockPluginTag("test_bug449027_25", "5", false, true, true)
];
var gCallback = null;
var gTestserver = null;

View File

@ -71,49 +71,37 @@ var ADDONS = [{
appVersion: "3"
}];
var PLUGINS = [{
function MockPlugin(name, version, enabledState) {
this.name = name;
this.version = version;
this.enabledState = enabledState;
}
Object.defineProperty(MockPlugin.prototype, "blocklisted", {
get: function MockPlugin_getBlocklisted() {
let bls = Cc["@mozilla.org/extensions/blocklist;1"].getService(Ci.nsIBlocklistService);
return bls.getPluginBlocklistState(this) == bls.STATE_BLOCKED;
}
});
Object.defineProperty(MockPlugin.prototype, "disabled", {
get: function MockPlugin_getDisabled() {
return this.enabledState == Ci.nsIPluginTag.STATE_DISABLED;
}
});
var PLUGINS = [
// Tests how the blocklist affects a disabled plugin
name: "test_bug455906_1",
version: "5",
enabledState : Ci.nsIPluginTag.STATE_DISABLED,
get disabled() this.enabledState == Ci.nsIPluginTag.STATE_DISABLED,
blocklisted: false
}, {
new MockPlugin("test_bug455906_1", "5", Ci.nsIPluginTag.STATE_DISABLED),
// Tests how the blocklist affects an enabled plugin
name: "test_bug455906_2",
version: "5",
enabledState: Ci.nsIPluginTag.STATE_ENABLED,
get disabled() this.enabledState == Ci.nsIPluginTag.STATE_DISABLED,
blocklisted: false
}, {
new MockPlugin("test_bug455906_2", "5", Ci.nsIPluginTag.STATE_ENABLED),
// Tests how the blocklist affects an enabled plugin, to be disabled by the notification
name: "test_bug455906_3",
version: "5",
enabledState: Ci.nsIPluginTag.STATE_ENABLED,
get disabled() this.enabledState == Ci.nsIPluginTag.STATE_DISABLED,
blocklisted: false
}, {
new MockPlugin("test_bug455906_3", "5", Ci.nsIPluginTag.STATE_ENABLED),
// Tests how the blocklist affects a disabled plugin that was already warned about
name: "test_bug455906_4",
version: "5",
enabledState: Ci.nsIPluginTag.STATE_DISABLED,
get disabled() this.enabledState == Ci.nsIPluginTag.STATE_DISABLED,
blocklisted: false
}, {
new MockPlugin("test_bug455906_4", "5", Ci.nsIPluginTag.STATE_DISABLED),
// Tests how the blocklist affects an enabled plugin that was already warned about
name: "test_bug455906_5",
version: "5",
enabledState: Ci.nsIPluginTag.STATE_ENABLED,
get disabled() this.enabledState == Ci.nsIPluginTag.STATE_DISABLED,
blocklisted: false
}, {
new MockPlugin("test_bug455906_5", "5", Ci.nsIPluginTag.STATE_ENABLED),
// Tests how the blocklist affects an already blocked plugin
name: "test_bug455906_6",
version: "5",
enabledState: Ci.nsIPluginTag.STATE_ENABLED,
get disabled() this.enabledState == Ci.nsIPluginTag.STATE_DISABLED,
blocklisted: true
}];
new MockPlugin("test_bug455906_6", "5", Ci.nsIPluginTag.STATE_ENABLED)
];
var gNotificationCheck = null;
var gTestCheck = null;