Bug 757351 - Sync uses deprecated octal literals. r=rnewman
authorAmod Narvekar <amod.narvekar@gmail.com>
Mon, 22 Apr 2013 12:35:07 -0700
changeset 129623 8e70086dd0066b0b8eb5c236439a22506e4ec773
parent 129621 dc39bcc19bd99bb4c269d1a54b7802e766b64650
child 129624 d8202613aaea2d07176f9f3c2a7c61cc5aa37f07
push id24584
push usergszorc@mozilla.com
push dateTue, 23 Apr 2013 22:58:39 +0000
treeherdermozilla-central@d8202613aaea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs757351
milestone23.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 757351 - Sync uses deprecated octal literals. r=rnewman
browser/base/content/sync/utils.js
--- a/browser/base/content/sync/utils.js
+++ b/browser/base/content/sync/utils.js
@@ -1,12 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+// Equivalent to 0600 permissions; used for saved Sync Recovery Key.
+// This constant can be replaced when the equivalent values are available to
+// chrome JS; see Bug 433295 and Bug 757351.
+const PERMISSIONS_RWUSR = 0x180;
+
 // Weave should always exist before before this file gets included.
 let gSyncUtils = {
   get bundle() {
     delete this.bundle;
     return this.bundle = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties");
   },
 
   // opens in a new window if we're in a modal prefwindow world, in a new tab otherwise
@@ -152,17 +157,17 @@ let gSyncUtils = {
     let defaultSaveName = this.bundle.GetStringFromName("save.recoverykey.defaultfilename");
     this._preparePPiframe(elid, function(iframe) {
       let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
       let fpCallback = function fpCallback_done(aResult) {
         if (aResult == Ci.nsIFilePicker.returnOK ||
             aResult == Ci.nsIFilePicker.returnReplace) {
           let stream = Cc["@mozilla.org/network/file-output-stream;1"].
                        createInstance(Ci.nsIFileOutputStream);
-          stream.init(fp.file, -1, 0600, 0);
+          stream.init(fp.file, -1, PERMISSIONS_RWUSR, 0);
 
           let serializer = new XMLSerializer();
           let output = serializer.serializeToString(iframe.contentDocument);
           output = output.replace(/<!DOCTYPE (.|\n)*?]>/,
             '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ' +
             '"DTD/xhtml1-strict.dtd">');
           output = Weave.Utils.encodeUTF8(output);
           stream.write(output, output.length);