Refactor freezing of JS objects

- Shallow-freezing of objects is never used in our codebase, so remove
   that code path.
 - Deep-freeze is bugged in recent versions of SpiderMonkey (see bug
   https://bugzilla.mozilla.org/show_bug.cgi?id=1930258). Until a fix
   and/or a better API is provided, reimplement this feature by
   recusively freezing object properties.
 - Add tests for the deepfreeze function.
This commit is contained in:
Itms
2024-11-17 16:25:17 +01:00
committed by Nicolas Auvray
parent e765a2c4ba
commit adcb9755ff
10 changed files with 53 additions and 17 deletions
@@ -73,7 +73,7 @@ template<> void Script::ToJSVal<CParamNode>(const ScriptRequest& rq, JS::Mutabl
// Prevent modifications to the object, so that it's safe to share between
// components and to reconstruct on deserialization
if (ret.isObject())
Script::FreezeObject(rq, ret, true);
Script::DeepFreezeObject(rq, ret);
}
template<> void Script::ToJSVal<const CParamNode*>(const ScriptRequest& rq, JS::MutableHandleValue ret, const CParamNode* const& val)