Bug 532369 - Replace octal numbers in httpd.js with manual bit-shifts and bit-ors, to avoid strict warnings. Obvious enough for r=try
authorJeff Walden <jwalden@mit.edu>
Fri, 05 Oct 2012 17:04:12 -0700
changeset 110928 db769c0adc2a52dd6c9e994f47466106a28ceb1d
parent 110927 8a59732f220ef1d15f784397dbd79db52b856b29
child 110929 d5e23f4018c67d62d9c393544fae0c6f8e7c5f8b
push id93
push usernmatsakis@mozilla.com
push dateWed, 31 Oct 2012 21:26:57 +0000
reviewerstry
bugs532369
milestone19.0a1
Bug 532369 - Replace octal numbers in httpd.js with manual bit-shifts and bit-ors, to avoid strict warnings. Obvious enough for r=try
netwerk/test/httpserver/httpd.js
--- a/netwerk/test/httpserver/httpd.js
+++ b/netwerk/test/httpserver/httpd.js
@@ -2106,16 +2106,17 @@ function toInternalPath(path, encoded)
   {
     var comp = comps[i];
     if (comp.charAt(comp.length - 1) == HIDDEN_CHAR)
       comps[i] = comp + HIDDEN_CHAR;
   }
   return comps.join("/");
 }
 
+const PERMS_READONLY = (4 << 6) | (4 << 3) | 4;
 
 /**
  * Adds custom-specified headers for the given file to the given response, if
  * any such headers are specified.
  *
  * @param file
  *   the file on the disk which is to be written
  * @param metadata
@@ -2133,17 +2134,17 @@ function maybeAddHeaders(file, metadata,
 
   var headerFile = file.parent;
   headerFile.append(name + HEADERS_SUFFIX);
 
   if (!headerFile.exists())
     return;
 
   const PR_RDONLY = 0x01;
-  var fis = new FileInputStream(headerFile, PR_RDONLY, 0444,
+  var fis = new FileInputStream(headerFile, PR_RDONLY, PERMS_READONLY,
                                 Ci.nsIFileInputStream.CLOSE_ON_EOF);
 
   try
   {
     var lis = new ConverterInputStream(fis, "UTF-8", 1024, 0x0);
     lis.QueryInterface(Ci.nsIUnicharLineInputStream);
 
     var line = {value: ""};
@@ -2668,17 +2669,17 @@ ServerHandler.prototype =
    */
   _writeFileResponse: function(metadata, file, response, offset, count)
   {
     const PR_RDONLY = 0x01;
 
     var type = this._getTypeFromFile(file);
     if (type === SJS_TYPE)
     {
-      var fis = new FileInputStream(file, PR_RDONLY, 0444,
+      var fis = new FileInputStream(file, PR_RDONLY, PERMS_READONLY,
                                     Ci.nsIFileInputStream.CLOSE_ON_EOF);
 
       try
       {
         var sis = new ScriptableInputStream(fis);
         var s = Cu.Sandbox(gGlobalObject);
         s.importFunction(dump, "dump");
 
@@ -2762,17 +2763,17 @@ ServerHandler.prototype =
                            false);
       }
       catch (e) { /* lastModifiedTime threw, ignore */ }
 
       response.setHeader("Content-Type", type, false);
       maybeAddHeaders(file, metadata, response);
       response.setHeader("Content-Length", "" + count, false);
 
-      var fis = new FileInputStream(file, PR_RDONLY, 0444,
+      var fis = new FileInputStream(file, PR_RDONLY, PERMS_READONLY,
                                     Ci.nsIFileInputStream.CLOSE_ON_EOF);
 
       offset = offset || 0;
       count  = count || file.fileSize;
       NS_ASSERT(offset === 0 || offset < file.fileSize, "bad offset");
       NS_ASSERT(count >= 0, "bad count");
       NS_ASSERT(offset + count <= file.fileSize, "bad total data size");