зеркало из https://github.com/mozilla/gecko-dev.git
Bug 637413 - Always use a blank blocklist.xml file in the addon manager tests so we aren't broken by blocklist file updates. r=mossop a=blocker
This commit is contained in:
Родитель
13df36f1ff
Коммит
68b2239829
|
@ -1062,6 +1062,21 @@ gTmpD.append("temp");
|
||||||
gTmpD.create(AM_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
|
gTmpD.create(AM_Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
|
||||||
registerDirectory("TmpD", gTmpD);
|
registerDirectory("TmpD", gTmpD);
|
||||||
|
|
||||||
|
// Write out an empty blocklist.xml file to the profile to ensure nothing
|
||||||
|
// is blocklisted by default
|
||||||
|
var blockFile = gProfD.clone();
|
||||||
|
blockFile.append("blocklist.xml");
|
||||||
|
var stream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
|
||||||
|
createInstance(AM_Ci.nsIFileOutputStream);
|
||||||
|
stream.init(blockFile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE,
|
||||||
|
FileUtils.PERMS_FILE, 0);
|
||||||
|
|
||||||
|
var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
||||||
|
"<blocklist xmlns=\"http://www.mozilla.org/2006/addons-blocklist\">\n" +
|
||||||
|
"</blocklist>\n";
|
||||||
|
stream.write(data, data.length);
|
||||||
|
stream.close();
|
||||||
|
|
||||||
do_register_cleanup(function() {
|
do_register_cleanup(function() {
|
||||||
// Check that the temporary directory is empty
|
// Check that the temporary directory is empty
|
||||||
var dirEntries = gTmpD.directoryEntries
|
var dirEntries = gTmpD.directoryEntries
|
||||||
|
|
|
@ -40,6 +40,10 @@ function run_test() {
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||||
|
|
||||||
// We cannot force the blocklist to update so just copy our test list to the profile
|
// We cannot force the blocklist to update so just copy our test list to the profile
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var source = do_get_file("data/test_bug393285.xml");
|
var source = do_get_file("data/test_bug393285.xml");
|
||||||
source.copyTo(gProfD, "blocklist.xml");
|
source.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,10 @@ function run_test() {
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||||
|
|
||||||
// We cannot force the blocklist to update so just copy our test list to the profile
|
// We cannot force the blocklist to update so just copy our test list to the profile
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var source = do_get_file("data/test_bug393285.xml");
|
var source = do_get_file("data/test_bug393285.xml");
|
||||||
source.copyTo(gProfD, "blocklist.xml");
|
source.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
|
|
@ -117,21 +117,6 @@ function pathHandler(metadata, response) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
// Write out an empty blocklist.xml file to the profile to ensure nothing
|
|
||||||
// is blocklisted by default
|
|
||||||
var blockFile = gProfD.clone();
|
|
||||||
blockFile.append("blocklist.xml");
|
|
||||||
var stream = AM_Cc["@mozilla.org/network/file-output-stream;1"].
|
|
||||||
createInstance(AM_Ci.nsIFileOutputStream);
|
|
||||||
stream.init(blockFile, FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE,
|
|
||||||
FileUtils.PERMS_FILE, 0);
|
|
||||||
|
|
||||||
var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
|
|
||||||
"<blocklist xmlns=\"http://www.mozilla.org/2006/addons-blocklist\">\n" +
|
|
||||||
"</blocklist>\n";
|
|
||||||
stream.write(data, data.length);
|
|
||||||
stream.close();
|
|
||||||
|
|
||||||
var osVersion;
|
var osVersion;
|
||||||
var sysInfo = Components.classes["@mozilla.org/system-info;1"]
|
var sysInfo = Components.classes["@mozilla.org/system-info;1"]
|
||||||
.getService(Components.interfaces.nsIPropertyBag2);
|
.getService(Components.interfaces.nsIPropertyBag2);
|
||||||
|
|
|
@ -257,6 +257,10 @@ function run_test() {
|
||||||
|
|
||||||
// Copy the initial blocklist into the profile to check add-ons start in the
|
// Copy the initial blocklist into the profile to check add-ons start in the
|
||||||
// right state.
|
// right state.
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var blocklist = do_get_file("data/bug455906_start.xml")
|
var blocklist = do_get_file("data/bug455906_start.xml")
|
||||||
blocklist.copyTo(gProfD, "blocklist.xml");
|
blocklist.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,10 @@ function run_test() {
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||||
|
|
||||||
// We cannot force the blocklist to update so just copy our test list to the profile
|
// We cannot force the blocklist to update so just copy our test list to the profile
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var source = do_get_file("data/test_bug468528.xml");
|
var source = do_get_file("data/test_bug468528.xml");
|
||||||
source.copyTo(gProfD, "blocklist.xml");
|
source.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
@ -89,4 +93,4 @@ function run_test() {
|
||||||
// not blocked - the previous invalid regexp shouldn't act as a wildcard
|
// not blocked - the previous invalid regexp shouldn't act as a wildcard
|
||||||
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
|
do_check_true(blocklist.getPluginBlocklistState(PLUGINS[3], "1", "1.9") == nsIBLS.STATE_NOT_BLOCKED);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,10 @@ var PLUGINS = [{
|
||||||
function run_test() {
|
function run_test() {
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||||
|
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var source = do_get_file("data/test_bug514327_1.xml");
|
var source = do_get_file("data/test_bug514327_1.xml");
|
||||||
source.copyTo(gProfD, "blocklist.xml");
|
source.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,10 @@ function get_test_plugintag() {
|
||||||
function run_test() {
|
function run_test() {
|
||||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9");
|
||||||
|
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var source = do_get_file("data/test_bug514327_2.xml");
|
var source = do_get_file("data/test_bug514327_2.xml");
|
||||||
source.copyTo(gProfD, "blocklist.xml");
|
source.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,10 @@ function run_test() {
|
||||||
|
|
||||||
|
|
||||||
// initialize the blocklist with no entries
|
// initialize the blocklist with no entries
|
||||||
|
var blocklistFile = gProfD.clone();
|
||||||
|
blocklistFile.append("blocklist.xml");
|
||||||
|
if (blocklistFile.exists())
|
||||||
|
blocklistFile.remove(false);
|
||||||
var source = do_get_file("data/test_bug514327_3_empty.xml");
|
var source = do_get_file("data/test_bug514327_3_empty.xml");
|
||||||
source.copyTo(gProfD, "blocklist.xml");
|
source.copyTo(gProfD, "blocklist.xml");
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче