From 4136b2f6f79dcc0b235bc576d67d72e604bd9973 Mon Sep 17 00:00:00 2001 From: Ralph Sennhauser Date: Fri, 29 Aug 2025 06:33:56 +0200 Subject: [PATCH] Clone InitAttributes for serialization test Commit 8b11f6a151 requires InitAttributes to be available, which isn't the case for the secondary context in serialization test. So clone InitAttributes to make it available. ``` ERROR: JavaScript error: simulation/helpers/Commands.js line 89 InitAttributes is not defined reveal-map@simulation/helpers/Commands.js:89:7 ProcessCommand@simulation/helpers/Commands.js:932:23 ERROR: Failed to call ProcessCommand() global script function ``` Reported-by: phosit Signed-off-by: Ralph Sennhauser --- source/simulation2/Simulation2.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/simulation2/Simulation2.cpp b/source/simulation2/Simulation2.cpp index 26f740b016..eeb85ca5ee 100644 --- a/source/simulation2/Simulation2.cpp +++ b/source/simulation2/Simulation2.cpp @@ -430,6 +430,13 @@ void CSimulation2Impl::Update(int turnLength, const std::vectorGetScriptInterface()); + const JS::RootedValue initAttributesCloned(rq2.cx, Script::CloneValueFromOtherCompartment(m_SecondaryComponentManager->GetScriptInterface(), scriptInterface, m_InitAttributes)); + m_SecondaryComponentManager->GetScriptInterface().SetGlobal("InitAttributes", initAttributesCloned, true, true, true); + } + // Load the trigger scripts after we have loaded the simulation. { ScriptRequest rq2(m_SecondaryComponentManager->GetScriptInterface());