forked from 0ad/0ad
Don't overwrite JS error reporting by calling JS_ReportError.
Upstream spidermonkey supports JSNative error reporting by returning an explicit failure code. This provides a full stacktrace. Calling JS_ReportError, removed upstream, removes that stacktrace. Instead, we should simply LOGERROR. Based on a patch by: elexis Reviewed By: wraitii Differential Revision: https://code.wildfiregames.com/D2627 This was SVN commit r23773.
This commit is contained in:
parent
e8b3fe81cc
commit
ffd2219200
@ -431,7 +431,7 @@ bool IGUIObject::ScriptEventWithReturn(const CStr& eventName, const JS::HandleVa
|
||||
|
||||
if (!JS_CallFunctionValue(cx, obj, handlerVal, paramData, &result))
|
||||
{
|
||||
JS_ReportError(cx, "Errors executing script event \"%s\"", eventName.c_str());
|
||||
LOGERROR("Errors executing script event \"%s\"", eventName.c_str());
|
||||
return false;
|
||||
}
|
||||
return JS::ToBoolean(result);
|
||||
|
@ -122,7 +122,7 @@ bool JSI_IGUIObject::getProperty(JSContext* cx, JS::HandleObject obj, JS::Handle
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "Property '%s' does not exist!", propName.c_str());
|
||||
LOGERROR("Property '%s' does not exist!", propName.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -159,7 +159,7 @@ bool JSI_IGUIObject::setProperty(JSContext* cx, JS::HandleObject obj, JS::Handle
|
||||
{
|
||||
if (vp.isPrimitive() || vp.isNull() || !JS_ObjectIsFunction(cx, &vp.toObject()))
|
||||
{
|
||||
JS_ReportError(cx, "on- event-handlers must be functions");
|
||||
LOGERROR("on- event-handlers must be functions");
|
||||
return result.fail(JSMSG_NOT_FUNCTION);
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ bool JSI_IGUIObject::setProperty(JSContext* cx, JS::HandleObject obj, JS::Handle
|
||||
if (e->SettingExists(propName))
|
||||
return e->m_Settings[propName]->FromJSVal(cx, vp, true) ? result.succeed() : result.fail(JSMSG_TYPE_ERR_BAD_ARGS);
|
||||
|
||||
JS_ReportError(cx, "Property '%s' does not exist!", propName.c_str());
|
||||
LOGERROR("Property '%s' does not exist!", propName.c_str());
|
||||
return result.fail(JSMSG_UNDEFINED_PROP);
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ bool JSI_IGUIObject::deleteProperty(JSContext* cx, JS::HandleObject obj, JS::Han
|
||||
return result.succeed();
|
||||
}
|
||||
|
||||
JS_ReportError(cx, "Only event handlers can be deleted from GUI objects!");
|
||||
LOGERROR("Only event handlers can be deleted from GUI objects!");
|
||||
return result.fail(JSMSG_UNDEFINED_PROP);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user