forked from mirrors/0ad
Enable latest JS language features.
Load GUI scripts as UTF-8. This was SVN commit r7650.
This commit is contained in:
@@ -233,6 +233,8 @@ ScriptInterface_impl::ScriptInterface_impl(const char* nativeScopeName, JSContex
|
||||
| JSOPTION_VAROBJFIX // "recommended" (fixes variable scoping)
|
||||
);
|
||||
|
||||
JS_SetVersion(m_cx, JSVERSION_LATEST);
|
||||
|
||||
JS_SetExtraGCRoots(m_rt, jshook_trace, this);
|
||||
|
||||
// Threadsafe SpiderMonkey requires that we have a request before doing anything much
|
||||
@@ -601,6 +603,15 @@ bool ScriptInterface::Eval_(const wchar_t* code, jsval& rval)
|
||||
return ok ? true : false;
|
||||
}
|
||||
|
||||
std::wstring ScriptInterface::ToString(jsval obj)
|
||||
{
|
||||
if (JSVAL_IS_VOID(obj))
|
||||
return L"(void 0)";
|
||||
std::wstring source = L"(error)";
|
||||
CallFunction(obj, "toSource", source);
|
||||
return source;
|
||||
}
|
||||
|
||||
void ScriptInterface::ReportError(const char* msg)
|
||||
{
|
||||
// JS_ReportError by itself doesn't seem to set a JS-style exception, and so
|
||||
|
||||
Reference in New Issue
Block a user