Backout fdb7c9649a07 (bug 805967), 72003517a631 (bug 806538), 354250ed1e72 (bug 770538), ea6edd3749ce (bug 770538) for bustage on a CLOSED TREE
authorEd Morley <emorley@mozilla.com>
Tue, 30 Oct 2012 17:56:20 +0000
changeset 112144 553fb59b9ca0a1815b27092a36c1e3114e2ce0a2
parent 112143 ad1d720d82b7f84d3c7e50f4b02b7c3201662ddb
child 112145 67cb43bb8865ecbcb79c2ea04a0494fd223cc69d
child 112266 bed18790882febf4419e5ae3e968e8e137a69452
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
bugs805967, 806538, 770538
milestone19.0a1
backs outfdb7c9649a074475d1bab49fcf6209bd78a1a615
Backout fdb7c9649a07 (bug 805967), 72003517a631 (bug 806538), 354250ed1e72 (bug 770538), ea6edd3749ce (bug 770538) for bustage on a CLOSED TREE
dom/apps/src/Webapps.jsm
dom/system/OSFileConstants.cpp
mfbt/double-conversion/double-conversion.cc
mfbt/double-conversion/fast-dtoa.cc
mfbt/double-conversion/more-architectures.patch
mfbt/double-conversion/strtod.cc
mfbt/double-conversion/update.sh
toolkit/components/osfile/osfile_unix_back.jsm
toolkit/components/osfile/osfile_unix_front.jsm
toolkit/components/osfile/tests/mochi/worker_test_osfile_front.js
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -241,49 +241,19 @@ let DOMApplicationRegistry = {
         }
         aNext();
       }).bind(this));
     } else {
       aNext();
     }
   },
 
-  fixIndexedDb: function fixIndexedDb() {
-    debug("Fixing indexedDb folder names");
-    let idbDir = FileUtils.getDir("indexedDBPDir", ["indexedDB"]);
-
-    if (!idbDir.isDirectory()) {
-      return;
-    }
-
-    let re = /^(\d+)\+(.*)\+(f|t)$/;
-
-    let entries = idbDir.directoryEntries;
-    while (entries.hasMoreElements()) {
-      let entry = entries.getNext().QueryInterface(Ci.nsIFile);
-      if (!entry.isDirectory()) {
-        continue;
-      }
-
-      let newName = entry.leafName.replace(re, "$1+$3+$2");
-      if (newName != entry.leafName) {
-        try {
-          entry.moveTo(idbDir, newName);
-        } catch(e) { }
-      }
-    }
-  },
-
   loadAndUpdateApps: function loadAndUpdateApps() {
     let runUpdate = AppsUtils.isFirstRun(Services.prefs);
 
-    if (runUpdate) {
-      this.fixIndexedDb();
-    }
-
     let onAppsLoaded = (function onAppsLoaded() {
       if (runUpdate) {
         // At first run, set up the permissions
         for (let id in this.webapps) {
           this.updatePermissionsForApp(id);
           this.updateOfflineCacheForApp(id);
         }
       }
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -375,23 +375,16 @@ static dom::ConstantSpec gLibcProperties
 
 #if defined(DT_UNKNOWN)
   // Position of field |d_type| in |dirent|
   // Not strictly posix, but seems defined on all platforms
   // except mingw32.
   { "OSFILE_OFFSETOF_DIRENT_D_TYPE", INT_TO_JSVAL(offsetof (struct dirent, d_type)) },
 #endif // defined(DT_UNKNOWN)
 
-  // Under MacOS X, |dirfd| is a macro rather than a function, so we
-  // need a little help to get it to work
-#if defined(dirfd)
-  { "OSFILE_SIZEOF_DIR", INT_TO_JSVAL(sizeof (DIR)) },
-
-  { "OSFILE_OFFSETOF_DIR_DD_FD", INT_TO_JSVAL(offsetof (DIR, __dd_fd)) },
-#endif
 
   // Defining |stat|
 
   { "OSFILE_SIZEOF_STAT", INT_TO_JSVAL(sizeof (struct stat)) },
 
   { "OSFILE_OFFSETOF_STAT_ST_MODE", INT_TO_JSVAL(offsetof (struct stat, st_mode)) },
   { "OSFILE_OFFSETOF_STAT_ST_UID", INT_TO_JSVAL(offsetof (struct stat, st_uid)) },
   { "OSFILE_OFFSETOF_STAT_ST_GID", INT_TO_JSVAL(offsetof (struct stat, st_gid)) },
--- a/mfbt/double-conversion/double-conversion.cc
+++ b/mfbt/double-conversion/double-conversion.cc
@@ -157,17 +157,17 @@ void DoubleToStringConverter::CreateDeci
   }
 }
 
 
 bool DoubleToStringConverter::ToShortestIeeeNumber(
     double value,
     StringBuilder* result_builder,
     DoubleToStringConverter::DtoaMode mode) const {
-  ASSERT(mode == SHORTEST || mode == SHORTEST_SINGLE);
+  assert(mode == SHORTEST || mode == SHORTEST_SINGLE);
   if (Double(value).IsSpecial()) {
     return HandleSpecialValues(value, result_builder);
   }
 
   int decimal_point;
   bool sign;
   const int kDecimalRepCapacity = kBase10MaximalLength + 1;
   char decimal_rep[kDecimalRepCapacity];
--- a/mfbt/double-conversion/fast-dtoa.cc
+++ b/mfbt/double-conversion/fast-dtoa.cc
@@ -524,17 +524,17 @@ static bool Grisu3(double v,
   // boundary_minus and boundary_plus are the boundaries between v and its
   // closest floating-point neighbors. Any number strictly between
   // boundary_minus and boundary_plus will round to v when convert to a double.
   // Grisu3 will never output representations that lie exactly on a boundary.
   DiyFp boundary_minus, boundary_plus;
   if (mode == FAST_DTOA_SHORTEST) {
     Double(v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
   } else {
-    ASSERT(mode == FAST_DTOA_SHORTEST_SINGLE);
+    assert(mode == FAST_DTOA_SHORTEST_SINGLE);
     float single_v = static_cast<float>(v);
     Single(single_v).NormalizedBoundaries(&boundary_minus, &boundary_plus);
   }
   ASSERT(boundary_plus.e() == w.e());
   DiyFp ten_mk;  // Cached power of ten: 10^-k
   int mk;        // -k
   int ten_mk_minimal_binary_exponent =
      kMinimalTargetExponent - (w.e() + DiyFp::kSignificandSize);
new file mode 100644
--- /dev/null
+++ b/mfbt/double-conversion/more-architectures.patch
@@ -0,0 +1,30 @@
+diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
+--- a/mfbt/double-conversion/utils.h
++++ b/mfbt/double-conversion/utils.h
+@@ -48,20 +48,24 @@
+ // An easy way to test if the floating-point operations are correct is to
+ // evaluate: 89255.0/1e22. If the floating-point stack is 64 bits wide then
+ // the result is equal to 89255e-22.
+ // The best way to test this, is to create a division-function and to compare
+ // the output of the division with the expected result. (Inlining must be
+ // disabled.)
+ // On Linux,x86 89255e-22 != Div_double(89255.0/1e22)
+ #if defined(_M_X64) || defined(__x86_64__) || \
+-    defined(__ARMEL__) || \
++    defined(__ARMEL__) || defined(__avr32__) || \
++    defined(__hppa__) || defined(__ia64__) || \
++    defined(__mips__) || defined(__powerpc__) || \
++    defined(__sparc__) || defined(__sparc) || defined(__s390__) || \
++    defined(__SH4__) || defined(__alpha__) || \
+     defined(_MIPS_ARCH_MIPS32R2)
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+-#elif defined(_M_IX86) || defined(__i386__)
++#elif defined(_M_IX86) || defined(__i386__) || defined(__i386)
+ #if defined(_WIN32)
+ // Windows uses a 64bit wide floating point stack.
+ #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1
+ #else
+ #undef DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS
+ #endif  // _WIN32
+ #else
+ #error Target architecture was not detected as supported by Double-Conversion.
--- a/mfbt/double-conversion/strtod.cc
+++ b/mfbt/double-conversion/strtod.cc
@@ -510,25 +510,25 @@ float Strtof(Vector<const char> buffer, 
   float f3 = static_cast<float>(double_next);
   float f4;
   if (is_correct) {
     f4 = f3;
   } else {
     double double_next2 = Double(double_next).NextDouble();
     f4 = static_cast<float>(double_next2);
   }
-  ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4);
+  assert(f1 <= f2 && f2 <= f3 && f3 <= f4);
 
   // If the guess doesn't lie near a single-precision boundary we can simply
   // return its float-value.
-  if (f1 == f4) {
+  if ((f1 == f4)) {
     return float_guess;
   }
 
-  ASSERT((f1 != f2 && f2 == f3 && f3 == f4) ||
+  assert((f1 != f2 && f2 == f3 && f3 == f4) ||
          (f1 == f2 && f2 != f3 && f3 == f4) ||
          (f1 == f2 && f2 == f3 && f3 != f4));
 
   // guess and next are the two possible canditates (in the same way that
   // double_guess was the lower candidate for a double-precision guess).
   float guess = f1;
   float next = f4;
   DiyFp upper_boundary;
--- a/mfbt/double-conversion/update.sh
+++ b/mfbt/double-conversion/update.sh
@@ -1,20 +1,17 @@
 # Usage: ./update.sh <double-conversion-src-directory>
 #
 # Copies the needed files from a directory containing the original
 # double-conversion source that we need.
 
-# This was last updated with git rev e5b34421b763f7bf7e4f9081403db417d5a55a36.
-
-set -e
-
 cp $1/LICENSE ./
 cp $1/README ./
 
 # Includes
 cp $1/src/*.h ./
 
 # Source
 cp $1/src/*.cc ./
 
 patch -p3 < add-mfbt-api-markers.patch
 patch -p3 < use-StandardInteger.patch
+patch -p3 < more-architectures.patch
--- a/toolkit/components/osfile/osfile_unix_back.jsm
+++ b/toolkit/components/osfile/osfile_unix_back.jsm
@@ -103,16 +103,29 @@
          Types.intn_t(OS.Constants.libc.OSFILE_SIZEOF_GID_T).withName("gid_t");
 
        /**
         * Type |time_t|
         */
        Types.time_t =
          Types.intn_t(OS.Constants.libc.OSFILE_SIZEOF_TIME_T).withName("time_t");
 
+       Types.DIR =
+         new Type("DIR",
+                  ctypes.StructType("DIR"));
+
+       Types.null_or_DIR_ptr =
+         Types.DIR.out_ptr.withName("null_or_DIR*");
+       Types.null_or_DIR_ptr.importFromC = function importFromC(dir) {
+         if (dir == null || dir.isNull()) {
+           return null;
+         }
+         return ctypes.CDataFinalizer(dir, _close_dir);
+       };
+
        // Structure |dirent|
        // Building this type is rather complicated, as its layout varies between
        // variants of Unix. For this reason, we rely on a number of constants
        // (computed in C from the C data structures) that give us the layout.
        // The structure we compute looks like
        //  { int8_t[...] before_d_type; // ignored content
        //    int8_t      d_type       ;
        //    int8_t[...] before_d_name; // ignored content
@@ -157,47 +170,16 @@
          stat.add_field_at(OS.Constants.libc.OSFILE_OFFSETOF_STAT_ST_CTIME,
                           "st_ctime", Types.time_t.implementation);
 
          stat.add_field_at(OS.Constants.libc.OSFILE_OFFSETOF_STAT_ST_SIZE,
                         "st_size", Types.size_t.implementation);
          Types.stat = stat.getType();
        }
 
-       // Structure |DIR|
-       if ("OSFILE_SIZEOF_DIR" in OS.Constants.libc) {
-         // On platforms for which we need to access the fields of DIR
-         // directly (e.g. because certain functions are implemented
-         // as macros), we need to define DIR as a hollow structure.
-         let DIR = new OS.Shared.HollowStructure(
-           "DIR",
-           OS.Constants.libc.OSFILE_SIZEOF_DIR);
-
-         DIR.add_field_at(
-           OS.Constants.libc.OSFILE_OFFSETOF_DIR_DD_FD,
-           "dd_fd",
-           Types.fd.implementation);
-
-         Types.DIR = DIR.getType();
-       } else {
-         // On other platforms, we keep DIR as a blackbox
-         Types.DIR =
-           new Type("DIR",
-             ctypes.StructType("DIR"));
-       }
-
-       Types.null_or_DIR_ptr =
-         Types.DIR.out_ptr.withName("null_or_DIR*");
-       Types.null_or_DIR_ptr.importFromC = function importFromC(dir) {
-         if (dir == null || dir.isNull()) {
-           return null;
-         }
-         return ctypes.CDataFinalizer(dir, _close_dir);
-       };
-
        // Declare libc functions as functions of |OS.Unix.File|
 
        // Finalizer-related functions
        let _close = UnixFile._close =
          libc.declare("close", ctypes.default_abi,
                         /*return */ctypes.int,
                         /*fd*/     ctypes.int);
 
@@ -254,30 +236,16 @@
                     /*state*/  Types.void_t.in_ptr, // Ignored atm
                     /*flags*/  Types.uint32_t);
 
        UnixFile.dup =
          declareFFI("dup", ctypes.default_abi,
                     /*return*/ Types.negativeone_or_fd,
                     /*fd*/     Types.fd);
 
-       if ("OSFILE_SIZEOF_DIR" in OS.Constants.libc) {
-         // On platforms for which |dirfd| is a macro
-         UnixFile.dirfd =
-           function dirfd(DIRp) {
-             return Types.DIR.in_ptr.implementation(DIRp).contents.dd_fd;
-           };
-       } else {
-         // On platforms for which |dirfd| is a function
-         UnixFile.dirfd =
-           declareFFI("dirfd", ctypes.default_abi,
-                      /*return*/ Types.negativeone_or_fd,
-                      /*dir*/    Types.DIR.in_ptr);
-       }
-
        UnixFile.chdir =
          declareFFI("chdir", ctypes.default_abi,
                     /*return*/ Types.negativeone_or_nothing,
                     /*path*/   Types.path);
 
        UnixFile.fchdir =
          declareFFI("fchdir", ctypes.default_abi,
                     /*return*/ Types.negativeone_or_nothing,
--- a/toolkit/components/osfile/osfile_unix_front.jsm
+++ b/toolkit/components/osfile/osfile_unix_front.jsm
@@ -646,24 +646,16 @@
       */
      File.DirectoryIterator.prototype.close = function close() {
        if (!this._dir) return;
        UnixFile.closedir(this._dir);
        this._dir = null;
      };
 
      /**
-      * Return directory as |File|
-      */
-     File.DirectoryIterator.prototype.unixAsFile = function unixAsFile() {
-       if (!this._dir) throw File.Error.closed();
-       return error_or_file(UnixFile.dirfd(this._dir));
-     };
-
-     /**
       * An entry in a directory.
       */
      File.DirectoryIterator.Entry = function Entry(unix_entry, parent) {
        // Copy the relevant part of |unix_entry| to ensure that
        // our data is not overwritten prematurely.
        this._d_type = unix_entry.d_type;
        this._name = unix_entry.d_name.readString();
        this._parent = parent;
--- a/toolkit/components/osfile/tests/mochi/worker_test_osfile_front.js
+++ b/toolkit/components/osfile/tests/mochi/worker_test_osfile_front.js
@@ -548,38 +548,16 @@ function test_iter_dir()
         iterator.close();
       } else {
         ok(false, "test_iter_dir: Checking that forEach can be stopped early");
       }
       ++index;
   });
   iterator.close();
 
-  //test for prototype |OS.File.DirectoryIterator.unixAsFile|
-  if ("unixAsFile" in OS.File.DirectoryIterator.prototype) {
-    ok(true, "testing property unixAsFile");
-    let path = OS.Path.join("chrome", "toolkit", "components", "osfile", "tests", "mochi");
-    iterator = new OS.File.DirectoryIterator(path);
-
-    let dir_file = iterator.unixAsFile();// return |File|
-    let stat0 = dir_file.stat();
-    let stat1 = OS.File.stat(path);
-
-    let unix_info_to_string = function unix_info_to_string(info) {
-      return "| " + info.unixMode + " | " + info.unixOwner + " | " + info.unixGroup + " | " + info.creationDate + " | " + info.lastModificationDate + " | " + info.lastAccessDate + " | " + info.size + " |";
-    };
-
-    let s0_string = unix_info_to_string(stat0);
-    let s1_string = unix_info_to_string(stat1);
-
-    ok(stat0.isDir, "unixAsFile returned a directory");
-    is(s0_string, s1_string, "unixAsFile returned the correct file");
-    dir_file.close();
-    iterator.close();
-  }
   ok(true, "test_iter_dir: Complete");
 }
 
 function test_position() {
   ok(true, "test_position: Starting");
 
   ok("POS_START" in OS.File, "test_position: POS_START exists");
   ok("POS_CURRENT" in OS.File, "test_position: POS_CURRENT exists");