Fix bug 345535: crash [@js_GetSlotThreadSafe]. r/sr=brendan.

This commit is contained in:
mhammond%skippinet.com.au 2006-08-06 09:15:43 +00:00
parent f34bf9bf8a
commit a36f9ead4e

View File

@ -81,14 +81,16 @@ nsJSEventListener::nsJSEventListener(nsIScriptContext *aContext,
: nsIJSEventListener(aContext, aScopeObject, aTarget),
mReturnResult(nsReturnResult_eNotSet)
{
// mScopeObject is the "script global" for a context - this
// does not need explicit memory management so long we we don't
// outlive the context - which we don't.
// aScopeObject is the inner window's JS object, which we need to lock
// until we are done with it.
NS_ASSERTION(aScopeObject && aContext,
"EventListener with no context or scope?");
aContext->HoldScriptObject(aScopeObject);
}
nsJSEventListener::~nsJSEventListener()
{
// as above, no need to "drop" our reference...
mContext->DropScriptObject(mScopeObject);
}
NS_INTERFACE_MAP_BEGIN(nsJSEventListener)
@ -201,9 +203,9 @@ nsJSEventListener::HandleEvent(nsIDOMEvent* aEvent)
iargv = do_QueryInterface(tempargv);
}
// XXX [The JSContext inside mContext] doesn't seem like the correct
// context on which to execute the event handler. Might need to get one
// from the JS thread context stack.
// FIXME: bug 347480 - [The JSContext inside mContext] doesn't seem like
// the correct context on which to execute the event handler. Might need to
// get one from the JS thread context stack.
nsCOMPtr<nsIVariant> vrv;
rv = mContext->CallEventHandler(mTarget, mScopeObject, funcval, iargv,
getter_AddRefs(vrv));