mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-11-09 05:20:09 +00:00
Exact stack rooting for ScriptInterface::FreezeObject.
Refs #2415 This was SVN commit r15622.
This commit is contained in:
1 parent
7471662ddc
commit
9872f5741f
3 files changed
+8
-6
No files matched your search
@@ -1135,16 +1135,18 @@ bool ScriptInterface::SetPrototype(JS::HandleValue obj, JS::HandleValue proto)
|
||||
return JS_SetPrototype(m->m_cx, &obj.toObject(), &proto.toObject());
|
||||
}
|
||||
|
||||
bool ScriptInterface::FreezeObject(jsval obj, bool deep)
|
||||
bool ScriptInterface::FreezeObject(JS::HandleValue objVal, bool deep)
|
||||
{
|
||||
JSAutoRequest rq(m->m_cx);
|
||||
if (!obj.isObject())
|
||||
if (!objVal.isObject())
|
||||
return false;
|
||||
|
||||
JS::RootedObject obj(m->m_cx, &objVal.toObject());
|
||||
|
||||
if (deep)
|
||||
return JS_DeepFreezeObject(m->m_cx, &obj.toObject());
|
||||
return JS_DeepFreezeObject(m->m_cx, obj);
|
||||
else
|
||||
return JS_FreezeObject(m->m_cx, &obj.toObject());
|
||||
return JS_FreezeObject(m->m_cx, obj);
|
||||
}
|
||||
|
||||
bool ScriptInterface::LoadScript(const VfsPath& filename, const std::string& code)
|
||||
|
||||
Reference in new issue
Block a user