When the XMPP client (via gloox) receives some information, such as a chat message or user presence update, then it creates a struct and puts that on a std::vector.
This is extremely limiting, because it means that the struct has to have members that serve every GUI message type.
But every GUI message type has distinct properties.
For example a chat message has chat text, but the other types don't have text.
A role update has two nicknames.
A status update has a nickname and a presence status type.
Initially only few types were supported, so it wasn't noticed so much.
But everytime a new message type was added, the function had to be adapted, generic strings were added with default empty values.
Then it still wasn't enough, the bug described at #4877 needs a third set of optional generic strings.
So the better option is clearly to construct the JS object directly and removing the struct.
Initially (22 months ago, 2017 November, https://trac.wildfiregames.com/attachment/ticket/4877/xmpp%20struct%20nuke_v3) I thought this would require creating a new ScriptInterface.
But this seems to have been a fallacy, because SpiderMonkey only requires JS::Values to be rooted correctly when used.
JS::Heap and JS::PersistentRooted and the GUIManagers ScriptInterface serve all the issues.