1
0
forked from 0ad/0ad

Fix historic lobby kick messages following arbitrary CreateGUIMessage arguments in 9023f4bebb/D2264.

Perform the freezing for historic messages equally.

Differential Revision: https://code.wildfiregames.com/D2282
Tested on: clang 8.0.1, Jenkins

This was SVN commit r22887.
This commit is contained in:
elexis 2019-09-11 10:15:13 +00:00
parent 2233a76e2a
commit f77a3e289c

View File

@ -668,7 +668,13 @@ void XmppClient::CreateGUIMessage(
JSContext* cx = m_ScriptInterface->GetContext();
JSAutoRequest rq(cx);
JS::RootedValue message(cx);
m_ScriptInterface->CreateObject(&message, "type", type, "level", level, "time", static_cast<double>(time));
m_ScriptInterface->CreateObject(
&message,
"type", type,
"level", level,
"historic", false,
"time", static_cast<double>(time));
JS::RootedObject messageObj(cx, message.toObjectOrNull());
SetGUIMessageProperty(cx, messageObj, args...);
m_ScriptInterface->FreezeObject(message, true);
@ -697,6 +703,7 @@ JS::Value XmppClient::GuiPollNewMessage(const ScriptInterface& scriptInterface)
if (JS_StructuredClone(cx, message, &messageCopy, nullptr, nullptr))
{
scriptInterface.SetProperty(messageCopy, "historic", true);
scriptInterface.FreezeObject(messageCopy, true);
m_HistoricGuiMessages.push_back(JS::Heap<JS::Value>(messageCopy));
}
else