Use StructuredClone in m_GuiMessageQueue

The elements have to be cloned either way. Now they don't have to be
traced when they are in the queue.
This commit is contained in:
phosit
2024-11-10 18:18:40 +01:00
parent 2a2d5de350
commit f23dde2f73
3 changed files with 11 additions and 34 deletions
@@ -196,16 +196,14 @@ CStr GetPlayerGUID()
return g_NetClient->GetGUID();
}
JS::Value PollNetworkClient(const ScriptInterface& guiInterface)
JS::Value PollNetworkClient(const ScriptRequest& rq)
{
if (!g_NetClient)
return JS::UndefinedValue();
// Convert from net client context to GUI script context
ScriptRequest rqNet(g_NetClient->GetScriptInterface());
JS::RootedValue pollNet(rqNet.cx);
g_NetClient->GuiPoll(&pollNet);
return Script::CloneValueFromOtherCompartment(guiInterface, g_NetClient->GetScriptInterface(), pollNet);
JS::RootedValue message{rq.cx};
g_NetClient->GuiPoll(rq, &message);
return message;
}
void SendGameSetupMessage(const ScriptInterface& scriptInterface, JS::HandleValue attribs1)