Fixing bug 226617. Don't tell XPConnect that there are pending exceptions when there aren't any. r=caillon@aillon.org, sr=brendan@mozilla.org, a=brendan@mozilla.org.
git-svn-id: svn://10.0.0.236/trunk@149938 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -384,8 +384,12 @@ LocaleCompare(JSContext *cx, JSString *src1, JSString *src2, jsval *rval)
|
||||
}
|
||||
|
||||
static void
|
||||
SetXPCExceptionWasThrown()
|
||||
NotifyXPCIfExceptionPending(JSContext *cx)
|
||||
{
|
||||
if (!::JS_IsExceptionPending(cx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpc(do_GetService(nsIXPConnect::GetCID()));
|
||||
|
||||
if (xpc) {
|
||||
@@ -714,11 +718,11 @@ nsJSContext::EvaluateStringWithValue(const nsAString& aScript,
|
||||
::JS_SetVersion(mContext, oldVersion);
|
||||
|
||||
if (!ok) {
|
||||
// Tell XPConnect that an exception was thrown. This is needed
|
||||
// Tell XPConnect about any pending exceptions. This is needed
|
||||
// to avoid dropping JS exceptions in case we got here through
|
||||
// nested calls through XPConnect.
|
||||
|
||||
SetXPCExceptionWasThrown();
|
||||
NotifyXPCIfExceptionPending(mContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -785,10 +789,11 @@ JSValueToAString(JSContext *cx, jsval val, nsAString *result,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Tell XPConnect that an exception was thrown. This is needed to
|
||||
// Tell XPConnect about any pending exceptions. This is needed to
|
||||
// avoid dropping JS exceptions in case we got here through nested
|
||||
// calls through XPConnect.
|
||||
SetXPCExceptionWasThrown();
|
||||
|
||||
NotifyXPCIfExceptionPending(cx);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@@ -893,7 +898,11 @@ nsJSContext::EvaluateString(const nsAString& aScript,
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
SetXPCExceptionWasThrown();
|
||||
// Tell XPConnect about any pending exceptions. This is needed
|
||||
// to avoid dropping JS exceptions in case we got here through
|
||||
// nested calls through XPConnect.
|
||||
|
||||
NotifyXPCIfExceptionPending(mContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1052,10 +1061,11 @@ nsJSContext::ExecuteScript(void* aScriptObject,
|
||||
aRetValue->Truncate();
|
||||
}
|
||||
|
||||
// Tell XPConnect that an exception was thrown. This is needed to
|
||||
// Tell XPConnect about any pending exceptions. This is needed to
|
||||
// avoid dropping JS exceptions in case we got here through nested
|
||||
// calls through XPConnect.
|
||||
SetXPCExceptionWasThrown();
|
||||
|
||||
NotifyXPCIfExceptionPending(mContext);
|
||||
}
|
||||
|
||||
ScriptEvaluated(PR_TRUE);
|
||||
@@ -1251,8 +1261,11 @@ nsJSContext::CallEventHandler(void *aTarget, void *aHandler, PRUint32 argc,
|
||||
ScriptEvaluated(PR_TRUE);
|
||||
|
||||
if (!ok) {
|
||||
// Tell XPConnect that something went wrong.
|
||||
SetXPCExceptionWasThrown();
|
||||
// Tell XPConnect about any pending exceptions. This is needed
|
||||
// to avoid dropping JS exceptions in case we got here through
|
||||
// nested calls through XPConnect.
|
||||
|
||||
NotifyXPCIfExceptionPending(mContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1263,7 +1276,8 @@ nsJSContext::CallEventHandler(void *aTarget, void *aHandler, PRUint32 argc,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsJSContext::BindCompiledEventHandler(void *aTarget, nsIAtom *aName, void *aHandler)
|
||||
nsJSContext::BindCompiledEventHandler(void *aTarget, nsIAtom *aName,
|
||||
void *aHandler)
|
||||
{
|
||||
const char *charName = AtomToEventHandlerName(aName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user