diff --git a/source/simulation2/serialization/BinarySerializer.cpp b/source/simulation2/serialization/BinarySerializer.cpp index 2f8616d13c..467b991bba 100644 --- a/source/simulation2/serialization/BinarySerializer.cpp +++ b/source/simulation2/serialization/BinarySerializer.cpp @@ -232,28 +232,28 @@ void CBinarySerializerScriptImpl::HandleScriptVal(JS::HandleValue val) } else if (protokey == JSProto_Map) { - // TODO: There's no C++ API (yet) to work with maps. This code relies on the internal - // structure of the Iterator object returned by Map.entries(). This is not ideal - // because the structure could change in the future (and actually does change with v31). - // Change this code if SpiderMonkey gets such an API. - u32 mapSize; - m_ScriptInterface.GetProperty(val, "size", mapSize); - m_Serializer.NumberU8_Unbounded("type", SCRIPT_TYPE_OBJECT_MAP); - m_Serializer.NumberU32_Unbounded("map size", mapSize); + m_Serializer.NumberU32_Unbounded("map size", JS::MapSize(cx, obj)); JS::RootedValue keyValueIterator(cx); - m_ScriptInterface.CallFunction(val, "entries", &keyValueIterator); - for (u32 i=0; i