Bug 729212. (Av1a) abTrees.js: Use a safe-file-output-stream. r+moa=mnyromyr.
authorSerge Gautherie <sgautherie.bz@free.fr>
Wed, 07 Mar 2012 22:32:07 +0100
changeset 11025 329a4f21d57431f1754bf7be032e7899007c4149
parent 11024 cbfab6350b17f4874f1f602046e9356d90840c45
child 11026 1bb9b9a58eeae9ef2f94ed9796e643d95a6ff8d5
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs729212
Bug 729212. (Av1a) abTrees.js: Use a safe-file-output-stream. r+moa=mnyromyr.
suite/mailnews/addrbook/abTrees.js
--- a/suite/mailnews/addrbook/abTrees.js
+++ b/suite/mailnews/addrbook/abTrees.js
@@ -158,21 +158,21 @@ directoryTreeView.prototype =
     if (aJSONFile)
     {
       // Write out our json file...
       let data = JSON.stringify(this._persistOpenMap);
       let file = Components.classes["@mozilla.org/file/directory_service;1"]
                            .getService(Components.interfaces.nsIProperties)
                            .get("ProfD", Components.interfaces.nsIFile);
       file.append(aJSONFile);
-      let foStream = Components.classes["@mozilla.org/network/file-output-stream;1"]
+      let foStream = Components.classes["@mozilla.org/network/safe-file-output-stream;1"]
                                .createInstance(Components.interfaces.nsIFileOutputStream);
-
       foStream.init(file, 0x02 | 0x08 | 0x20, 0666, 0);
       foStream.write(data, data.length);
+      foStream.QueryInterface(Components.interfaces.nsISafeOutputStream).finish();
       foStream.close();
     }
   },
 
   // Override the dnd methods for those functions in abDragDrop.js
   canDrop: function dtv_canDrop(aIndex, aOrientation)
   {
     return abDirTreeObserver.canDrop(aIndex, aOrientation);