mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 03:06:29 +00:00
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 <phosit@autistici.org>
Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
@@ -430,6 +430,13 @@ void CSimulation2Impl::Update(int turnLength, const std::vector<SimulationComman
|
||||
|
||||
ScriptRequest rq(scriptInterface);
|
||||
|
||||
// Clone InitAttributes.
|
||||
{
|
||||
const ScriptRequest rq2(m_SecondaryComponentManager->GetScriptInterface());
|
||||
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());
|
||||
|
||||
Reference in New Issue
Block a user