Bug 639318 - Port relevant parts from Bug 634666 [File streams perform disk I/O when being initialized]. r=Neil
authorMisak Khachatryan <misak.bugzilla@gmail.com>
Mon, 07 Mar 2011 00:40:40 +0400
changeset 7262 d090538194d3576c089038848bd8550413524908
parent 7261 f7d1c7c1f70234369cb7e53d5c5ad17037646ce7
child 7263 c40723287a1c084487a268bd9b146489e4124162
push idunknown
push userunknown
push dateunknown
reviewersNeil
bugs639318, 634666
Bug 639318 - Port relevant parts from Bug 634666 [File streams perform disk I/O when being initialized]. r=Neil
suite/common/src/nsSessionStore.js
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -3624,17 +3624,17 @@ SessionStoreService.prototype = {
    *        nsIFile
    * @param aData
    *        String data
    */
   _writeFile: function sss_writeFile(aFile, aData) {
     // Initialize the file output stream.
     var ostream = Components.classes["@mozilla.org/network/safe-file-output-stream;1"]
                             .createInstance(Components.interfaces.nsIFileOutputStream);
-    ostream.init(aFile, 0x02 | 0x08 | 0x20, 0600, 0);
+    ostream.init(aFile, 0x02 | 0x08 | 0x20, 0600, ostream.DEFER_OPEN);
 
     // Obtain a converter to convert our data to a UTF-8 encoded input stream.
     var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"]
                               .createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
     converter.charset = "UTF-8";
 
     // Asynchronously copy the data to the file.
     var istream = converter.convertToInputStream(aData);