Bug 698390 - Make nsIScriptContext::CallEventHandler take a JSObject handler parameter; r=sicking

This commit is contained in:
Ms2ger 2011-11-26 11:09:20 +01:00
parent b6ae58dbc7
commit 1404baaf43
3 changed files with 8 additions and 7 deletions

View File

@ -74,8 +74,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
NS_ISCRIPTCONTEXTPRINCIPAL_IID) NS_ISCRIPTCONTEXTPRINCIPAL_IID)
#define NS_ISCRIPTCONTEXT_IID \ #define NS_ISCRIPTCONTEXT_IID \
{ 0x67493f96, 0x304c, 0x4bd6, \ { 0x1843adb8, 0xd646, 0x4103, \
{ 0xac, 0xe7, 0xca, 0xeb, 0x85, 0xd1, 0x0b, 0x9d } } { 0x8d, 0xa3, 0xc5, 0x12, 0xb9, 0xca, 0xfb, 0xcd } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't /* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */ know what language we have is a little silly... */
@ -221,7 +221,7 @@ public:
* @param rval out parameter returning result * @param rval out parameter returning result
**/ **/
virtual nsresult CallEventHandler(nsISupports* aTarget, virtual nsresult CallEventHandler(nsISupports* aTarget,
JSObject* aScope, void* aHandler, JSObject* aScope, JSObject* aHandler,
nsIArray *argv, nsIVariant **rval) = 0; nsIArray *argv, nsIVariant **rval) = 0;
/** /**

View File

@ -1848,7 +1848,8 @@ nsJSContext::CompileFunction(JSObject* aTarget,
nsresult nsresult
nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope, nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
void *aHandler, nsIArray *aargv, nsIVariant **arv) JSObject* aHandler, nsIArray* aargv,
nsIVariant** arv)
{ {
NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED); NS_ENSURE_TRUE(mIsInitialized, NS_ERROR_NOT_INITIALIZED);
@ -1858,7 +1859,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
#ifdef NS_FUNCTION_TIMER #ifdef NS_FUNCTION_TIMER
{ {
JSObject *obj = static_cast<JSObject *>(aHandler); JSObject *obj = aHandler;
if (js::IsFunctionProxy(obj)) if (js::IsFunctionProxy(obj))
obj = js::UnwrapObject(obj); obj = js::UnwrapObject(obj);
JSString *id = JS_GetFunctionId(static_cast<JSFunction *>(JS_GetPrivate(mContext, obj))); JSString *id = JS_GetFunctionId(static_cast<JSFunction *>(JS_GetPrivate(mContext, obj)));
@ -1895,7 +1896,7 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, JSObject* aScope,
PRUint32 argc = 0; PRUint32 argc = 0;
jsval *argv = nsnull; jsval *argv = nsnull;
JSObject *funobj = static_cast<JSObject *>(aHandler); JSObject *funobj = aHandler;
nsCOMPtr<nsIPrincipal> principal; nsCOMPtr<nsIPrincipal> principal;
rv = sSecurityManager->GetObjectPrincipal(mContext, funobj, rv = sSecurityManager->GetObjectPrincipal(mContext, funobj,
getter_AddRefs(principal)); getter_AddRefs(principal));

View File

@ -109,7 +109,7 @@ public:
PRUint32 aVersion, PRUint32 aVersion,
nsScriptObjectHolder &aHandler); nsScriptObjectHolder &aHandler);
virtual nsresult CallEventHandler(nsISupports* aTarget, JSObject* aScope, virtual nsresult CallEventHandler(nsISupports* aTarget, JSObject* aScope,
void* aHandler, JSObject* aHandler,
nsIArray *argv, nsIVariant **rv); nsIArray *argv, nsIVariant **rv);
virtual nsresult BindCompiledEventHandler(nsISupports *aTarget, virtual nsresult BindCompiledEventHandler(nsISupports *aTarget,
JSObject *aScope, JSObject *aScope,