Merge mozilla-inbound to mozilla-central. a=merge
authorCosmin Sabou <csabou@mozilla.com>
Mon, 20 Aug 2018 00:49:12 +0300
changeset 432305 93d0e291f45883765df384c070e56e4e0517db4b
parent 432304 bac4139e4ff9b3071e1ce17113ac65ed1d8e8598 (current diff)
parent 432294 9f9bb31175a814856eeef5939196fa485ca03143 (diff)
child 432306 b16c258543bf941e8d4264b2fa9c41117e9065c7
child 432314 eaf6867923b99cd189d501cd3dd131f73c0e533c
push id106691
push usercsabou@mozilla.com
push dateSun, 19 Aug 2018 21:53:17 +0000
treeherdermozilla-inbound@b16c258543bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone63.0a1
first release with
nightly linux32
93d0e291f458 / 63.0a1 / 20180819221915 / files
nightly linux64
93d0e291f458 / 63.0a1 / 20180819221915 / files
nightly mac
93d0e291f458 / 63.0a1 / 20180819221915 / files
nightly win32
93d0e291f458 / 63.0a1 / 20180819221915 / files
nightly win64
93d0e291f458 / 63.0a1 / 20180819221915 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-inbound to mozilla-central. a=merge
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -514,17 +514,17 @@ struct JSStructuredCloneWriter {
     bool writeString(uint32_t tag, JSString* str);
     bool writeArrayBuffer(HandleObject obj);
     bool writeTypedArray(HandleObject obj);
     bool writeDataView(HandleObject obj);
     bool writeSharedArrayBuffer(HandleObject obj);
     bool writeSharedWasmMemory(HandleObject obj);
     bool startObject(HandleObject obj, bool* backref);
     bool startWrite(HandleValue v);
-    bool traverseObject(HandleObject obj);
+    bool traverseObject(HandleObject obj, ESClass cls);
     bool traverseMap(HandleObject obj);
     bool traverseSet(HandleObject obj);
     bool traverseSavedFrame(HandleObject obj);
 
 #ifdef ENABLE_BIGINT
     bool writeBigInt(uint32_t tag, BigInt* bi);
 #endif
 
@@ -1371,17 +1371,17 @@ JSStructuredCloneWriter::startObject(Han
                                   "object graph to serialize");
         return false;
     }
 
     return true;
 }
 
 bool
-JSStructuredCloneWriter::traverseObject(HandleObject obj)
+JSStructuredCloneWriter::traverseObject(HandleObject obj, ESClass cls)
 {
     // Get enumerable property ids and put them in reverse order so that they
     // will come off the stack in forward order.
     AutoIdVector properties(context());
     if (!GetPropertyKeys(context(), obj, JSITER_OWNONLY, &properties))
         return false;
 
     for (size_t i = properties.length(); i > 0; --i) {
@@ -1392,21 +1392,24 @@ JSStructuredCloneWriter::traverseObject(
     }
 
     // Push obj and count to the stack.
     if (!objs.append(ObjectValue(*obj)) || !counts.append(properties.length()))
         return false;
 
     checkStack();
 
+#if DEBUG
+    ESClass cls2;
+    if (!GetBuiltinClass(context(), obj, &cls2))
+        return false;
+    MOZ_ASSERT(cls2 == cls);
+#endif
+
     // Write the header for obj.
-    ESClass cls;
-    if (!GetBuiltinClass(context(), obj, &cls))
-        return false;
-
     if (cls == ESClass::Array) {
         uint32_t length = 0;
         if (!JS_GetArrayLength(context(), obj, &length))
             return false;
 
         return out.writePair(SCTAG_ARRAY_OBJECT, NativeEndian::swapToLittleEndian(length));
     }
 
@@ -1609,17 +1612,17 @@ JSStructuredCloneWriter::startWrite(Hand
 
         ESClass cls;
         if (!GetBuiltinClass(context(), obj, &cls))
             return false;
 
         switch (cls) {
           case ESClass::Object:
           case ESClass::Array:
-            return traverseObject(obj);
+            return traverseObject(obj, cls);
           case ESClass::Number: {
             RootedValue unboxed(context());
             if (!Unbox(context(), obj, &unboxed))
                 return false;
             return out.writePair(SCTAG_NUMBER_OBJECT, 0) && out.writeDouble(unboxed.toNumber());
           }
           case ESClass::String: {
             RootedValue unboxed(context());