Better support for SpiderMonkey rooted types in the ScriptInterface.

* Adds additional overloads/specializations which are required when
passing JS::Handle<T>/JS::MutableHandle<T> types to different functions.
* Replaces GetPropertyJS with a GetProperty specialization.
* Allows us to avoid the implementation of ToJSVal specializations for
JS::Value and JS::HandleValue. Such conversions should only happen if
there's no way around it and if you are aware of it.
* Adds test to make sure that all potentially required specializations
with custom implementations are instantiated. This should help prevent
introducing bugs in temporarily unused code.

Refs #2415

This was SVN commit r15567.
This commit is contained in:
Yves
2014-07-26 20:31:29 +00:00
parent 30f7837c44
commit e818b08344
6 changed files with 191 additions and 22 deletions
@@ -1021,15 +1021,6 @@ bool ScriptInterface::SetGlobal_(const char* name, jsval value, bool replace)
return ok;
}
bool ScriptInterface::GetPropertyJS(jsval obj, const char* name, JS::MutableHandleValue out)
{
JSContext* cx = GetContext();
JSAutoRequest rq(cx);
if (! GetProperty_(obj, name, out))
return false;
return true;
}
bool ScriptInterface::SetProperty_(jsval obj, const char* name, jsval value, bool constant, bool enumerate)
{
JSAutoRequest rq(m->m_cx);