Bug 611843 - Don't fsync extensions.ini. r=mossop
authorMarco Castelluccio <mar.castelluccio@studenti.unina.it>
Sat, 14 Apr 2012 09:03:02 -0400
changeset 95001 99f3fe5ff9c4470572d08d9f1653e595c8da6afc
parent 95000 dfa2bf38f209bca2db35bca81452713e716a6109
child 95002 04ddd85d3d134f5aeefa6fc48ee1ad636d705ce5
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmossop
bugs611843
milestone14.0a1
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 611843 - Don't fsync extensions.ini. r=mossop
toolkit/mozapps/extensions/XPIProvider.jsm
--- a/toolkit/mozapps/extensions/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/XPIProvider.jsm
@@ -5636,19 +5636,23 @@ var XPIDatabase = {
         text += "Extension" + (count++) + "=" + row.descriptor + "\r\n";
         enabledAddons.push(row.id + ":" + row.version);
       }
       fullCount += count;
     }
 
     if (fullCount > 0) {
       LOG("Writing add-ons list");
-      var fos = FileUtils.openSafeFileOutputStream(addonsList);
+
+      let addonsListTmp = FileUtils.getFile(KEY_PROFILEDIR, [FILE_XPI_ADDONS_LIST + ".tmp"],
+                                            true);
+      var fos = FileUtils.openFileOutputStream(addonsListTmp);
       fos.write(text, text.length);
-      FileUtils.closeSafeFileOutputStream(fos);
+      fos.close();
+      addonsListTmp.moveTo(addonsListTmp.parent, FILE_XPI_ADDONS_LIST);
 
       Services.prefs.setCharPref(PREF_EM_ENABLED_ADDONS, enabledAddons.join(","));
     }
     else {
       if (addonsList.exists()) {
         LOG("Deleting add-ons list");
         addonsList.remove(false);
       }