Bug 614868: Blocklist test assumes that nothing on the system is blocked by the default blocklist. r=robstrong, a=tests
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 02 Dec 2010 09:31:13 -0800
changeset 58515 b8388f11a366e330abe24c6991db9549210fadd4
parent 58514 7ff5dc0e487bd341affdf21603cdf576578bb15e
child 58516 929dfea2e61a39a4b994d8f299cd8366d03458ba
push id17332
push userdtownsend@mozilla.com
push dateFri, 03 Dec 2010 00:04:17 +0000
treeherdermozilla-central@3f004b291c65 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrobstrong, tests
bugs614868
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 614868: Blocklist test assumes that nothing on the system is blocked by the default blocklist. r=robstrong, a=tests
toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug430120.js
@@ -112,16 +112,31 @@ function pathHandler(metadata, response)
               "XPCShell_" + ABI + "&locale&updatechannel&" +
               gOSVersion + "&1.9&distribution&distribution-version");
   gBlocklist.observe(null, "quit-application", "");
   gBlocklist.observe(null, "xpcom-shutdown", "");
   testserver.stop(do_test_finished);
 }
 
 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 sysInfo = Components.classes["@mozilla.org/system-info;1"]
                           .getService(Components.interfaces.nsIPropertyBag2);
   try {
     osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
     if (osVersion) {
       try {
         osVersion += " (" + sysInfo.getProperty("secondaryLibrary") + ")";