From d045258c293eb7e14636930d75b6d49043024fdd Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sun, 27 Feb 2011 17:57:32 +0000 Subject: [PATCH] Let exceptions in GUI script events triggered by script setters propagate out of the setter, so error messages aren't useless. This was SVN commit r8997. --- source/gui/IGUIObject.cpp | 3 ++- source/gui/scripting/JSInterface_IGUIObject.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/source/gui/IGUIObject.cpp b/source/gui/IGUIObject.cpp index bf0681a643..bf94d9cdc8 100644 --- a/source/gui/IGUIObject.cpp +++ b/source/gui/IGUIObject.cpp @@ -516,7 +516,8 @@ void IGUIObject::ScriptEvent(const CStr& Action) JSBool ok = JS_CallFunctionValue(g_ScriptingHost.getContext(), GetJSObject(), OBJECT_TO_JSVAL(*it->second), ARRAY_SIZE(paramData), paramData, &result); if (!ok) { - JS_ReportError(g_ScriptingHost.getContext(), "Errors executing script action \"%s\"", Action.c_str()); + // We have no way to propagate the script exception, so just ignore it + // and hope the caller checks JS_IsExceptionPending } } diff --git a/source/gui/scripting/JSInterface_IGUIObject.cpp b/source/gui/scripting/JSInterface_IGUIObject.cpp index 442ab0856a..cbab227113 100644 --- a/source/gui/scripting/JSInterface_IGUIObject.cpp +++ b/source/gui/scripting/JSInterface_IGUIObject.cpp @@ -578,7 +578,7 @@ JSBool JSI_IGUIObject::setProperty(JSContext* cx, JSObject* obj, jsid id, jsval* break; } - return JS_TRUE; + return !JS_IsExceptionPending(cx); }