From 2aef62d65fa079793dcfcd7ef486d1e938c817eb Mon Sep 17 00:00:00 2001 From: leper Date: Sun, 30 Aug 2015 04:51:16 +0000 Subject: [PATCH] Handle backrefs properly for maps and sets. Fixes #3374. Allocate the tag for the backreference before deserializing the content, to match the order of serializing. This was SVN commit r16959. --- .../serialization/StdDeserializer.cpp | 10 ++++- source/simulation2/tests/test_Serializer.h | 42 +++++++++++++++++++ 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/source/simulation2/serialization/StdDeserializer.cpp b/source/simulation2/serialization/StdDeserializer.cpp index e4e6b233f4..f3d7335d24 100644 --- a/source/simulation2/serialization/StdDeserializer.cpp +++ b/source/simulation2/serialization/StdDeserializer.cpp @@ -410,6 +410,9 @@ jsval CStdDeserializer::ReadScriptVal(const char* UNUSED(name), JS::HandleObject NumberU32_Unbounded("map size", mapSize); JS::RootedValue mapVal(cx); m_ScriptInterface.Eval("(new Map())", &mapVal); + + // To match the serializer order, we reserve the map's backref tag here + u32 mapTag = ReserveScriptBackref(); for (u32 i=0; i