Don't leave an exception just hangin' out on the JSContext. Bug 422009,
r+sr=jst, a=shaver git-svn-id: svn://10.0.0.236/trunk@248233 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
c5c3ead997
commit
75f1b92fe5
@ -816,6 +816,7 @@ nsEventListenerManager::AddScriptEventListener(nsISupports *aObject,
|
||||
handler);
|
||||
if (rv == NS_ERROR_ILLEGAL_VALUE) {
|
||||
NS_WARNING("Probably a syntax error in the event handler!");
|
||||
context->ReportPendingException();
|
||||
return NS_SUCCESS_LOSS_OF_INSIGNIFICANT_DATA;
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -57,9 +57,9 @@ class nsScriptObjectHolder;
|
||||
typedef void (*nsScriptTerminationFunc)(nsISupports* aRef);
|
||||
|
||||
#define NS_ISCRIPTCONTEXT_IID \
|
||||
{ /* {09316a0e-8d05-4d26-9efd-8f907a7c79d2} */ \
|
||||
0x09316a0e, 0x8d05, 0x4d26, \
|
||||
{ 0x9e, 0xfd, 0x8f, 0x90, 0x7a, 0x7c, 0x79, 0xd2 } }
|
||||
{ /* {e7b9871d-3adc-4bf7-850d-7fb9554886bf} */ \
|
||||
0xe7b9871d, 0x3adc, 0x4bf7, \
|
||||
{ 0x85, 0x0d, 0x7f, 0xb9, 0x55, 0x48, 0x86, 0xbf } }
|
||||
|
||||
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
|
||||
know what language we have is a little silly... */
|
||||
@ -451,6 +451,9 @@ public:
|
||||
*/
|
||||
virtual nsresult DropScriptObject(void *object) = 0;
|
||||
virtual nsresult HoldScriptObject(void *object) = 0;
|
||||
|
||||
/* Report a pending exception if there is one on the native context */
|
||||
virtual void ReportPendingException() = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContext, NS_ISCRIPTCONTEXT_IID)
|
||||
|
||||
@ -3549,6 +3549,14 @@ nsJSContext::DropScriptObject(void* aScriptObject)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsJSContext::ReportPendingException()
|
||||
{
|
||||
if (mIsInitialized && ::JS_IsExceptionPending(mContext)) {
|
||||
::JS_ReportPendingException(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* nsJSRuntime implementation
|
||||
*********************************************************************/
|
||||
|
||||
@ -166,6 +166,8 @@ public:
|
||||
virtual nsresult DropScriptObject(void *object);
|
||||
virtual nsresult HoldScriptObject(void *object);
|
||||
|
||||
virtual void ReportPendingException();
|
||||
|
||||
NS_DECL_NSIXPCSCRIPTNOTIFY
|
||||
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
@ -933,3 +933,9 @@ nsPythonContext::HoldScriptObject(void *object)
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
nsPythonContext::ReportPendingException()
|
||||
{
|
||||
// Not sure there's anything to do here
|
||||
}
|
||||
|
||||
@ -213,6 +213,8 @@ public:
|
||||
virtual nsresult HoldScriptObject(void *object);
|
||||
virtual nsresult DropScriptObject(void *object);
|
||||
|
||||
virtual void ReportPendingException();
|
||||
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
PyObject *PyObject_FromInterface(nsISupports *target,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user