Bug 1200567 - ensure shipped blocklist.xml doesn't affect the test_cert_blocklist.js. r=dkeeler

Caused comm-central TEST-UNEXPECTED-FAIL | security/manager/ssl/tests/unit/test_cert_blocklist.js | - revocations.txt should be as expected
This commit is contained in:
Magnus Melin 2015-12-10 19:08:09 +02:00
Родитель 0b4d1f0b39
Коммит b3dba24f5a
1 изменённых файлов: 21 добавлений и 5 удалений

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

@ -60,15 +60,32 @@ var XULAppInfoFactory = {
}
};
// we need to ensure we setup revocation data before certDB, or we'll start with
// no revocation.txt in the profile
var profile = do_get_profile();
// Write out an empty blocklist.xml file to the profile to ensure nothing
// is blocklisted by default
var blockFile = profile.clone();
blockFile.append("blocklist.xml");
var stream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(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 registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
const XULAPPINFO_CONTRACTID = "@mozilla.org/xre/app-info;1";
const XULAPPINFO_CID = Components.ID("{c763b610-9d49-455a-bbd2-ede71682a1ac}");
registrar.registerFactory(XULAPPINFO_CID, "XULAppInfo",
XULAPPINFO_CONTRACTID, XULAppInfoFactory);
// we need to ensure we setup revocation data before certDB, or we'll start with
// no revocation.txt in the profile
var profile = do_get_profile();
var revocations = profile.clone();
revocations.append("revocations.txt");
if (!revocations.exists()) {
@ -135,7 +152,7 @@ function serveResponse(request, response) {
response.write(blocklists[request.path]);
}
for (path in blocklists) {
for (var path in blocklists) {
testserver.registerPathHandler(path, serveResponse);
}
@ -220,7 +237,6 @@ function check_revocations_txt_contents(expected) {
hasmore = inputStream.readLine(line);
contents = contents + (contents.length == 0 ? "" : "\n") + line.value;
} while (hasmore);
equal(contents, expected, "revocations.txt should be as expected");
}