Bug 634666 - Use DEFER_OPEN in m-b [r=mfinkle]
authorAlon Zakai <azakai@mozilla.com>
Fri, 04 Mar 2011 16:51:48 -0800
changeset 67473 e5f360ab151b91277608bd5b29825580e0c1d970
parent 67472 58781b1a38264588593e7f55678f8fdffa3f0550
child 67474 370a2d4855742e836f88d27c86358be5299fef76
push idunknown
push userunknown
push dateunknown
reviewersmfinkle
bugs634666
Bug 634666 - Use DEFER_OPEN in m-b [r=mfinkle]
mobile/components/AddonUpdateService.js
mobile/components/AutoCompleteCache.js
mobile/components/SessionStore.js
--- a/mobile/components/AddonUpdateService.js
+++ b/mobile/components/AddonUpdateService.js
@@ -169,17 +169,17 @@ var RecommendedSearchResults = {
     if (!aData)
       return;
 
     let stateString = Cc["@mozilla.org/supports-string;1"].createInstance(Ci.nsISupportsString);
     stateString.data = aData;
 
     // Initialize the file output stream.
     let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"].createInstance(Ci.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.
     let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
     converter.charset = "UTF-8";
 
     // Asynchronously copy the data to the file.
     let istream = converter.convertToInputStream(aData);
     NetUtil.asyncCopy(istream, ostream, function(rc) {
--- a/mobile/components/AutoCompleteCache.js
+++ b/mobile/components/AutoCompleteCache.js
@@ -174,17 +174,17 @@ var AutoCompleteUtils = {
 
     cache.result = copy;
 
     // Convert to json to save to disk..
     let ostream = Cc["@mozilla.org/network/file-output-stream;1"].createInstance(Ci.nsIFileOutputStream);
     let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
 
     try {
-      ostream.init(this.cacheFile, (MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE), PERMS_FILE, 0);
+      ostream.init(this.cacheFile, (MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE), PERMS_FILE, ostream.DEFER_OPEN);
       converter.charset = "UTF-8";
       let data = converter.convertToInputStream(JSON.stringify(cache));
 
       // Write to the cache file asynchronously
       NetUtil.asyncCopy(data, ostream, function(rv) {
         if (!Components.isSuccessCode(rv))
           Cu.reportError("AutoCompleteUtils: failure during asyncCopy: " + rv);
         else
--- a/mobile/components/SessionStore.js
+++ b/mobile/components/SessionStore.js
@@ -492,17 +492,17 @@ SessionStore.prototype = {
     Services.obs.notifyObservers(stateString, "sessionstore-state-write", "");
 
     // Don't touch the file if an observer has deleted all state data
     if (!stateString.data)
       return;
 
     // Initialize the file output stream.
     let ostream = Cc["@mozilla.org/network/safe-file-output-stream;1"].createInstance(Ci.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.
     let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"].createInstance(Ci.nsIScriptableUnicodeConverter);
     converter.charset = "UTF-8";
 
     // Asynchronously copy the data to the file.
     let istream = converter.convertToInputStream(aData);
     NetUtil.asyncCopy(istream, ostream, function(rc) {