зеркало из https://github.com/mozilla/pjs.git
Fix related to regression bug 147811. Make declaring on* functions trigger the event listener registration code so that event handlers get registerd by simply declaring a global (or whatever the scope) function with the name of a event handler. r=caillon@aillon.org, sr=brendan@mozilla.org.
This commit is contained in:
Родитель
b27a94884b
Коммит
188fbccf27
|
@ -3214,9 +3214,11 @@ nsWindowSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
// exception, we must make sure that exception is propagated.
|
// exception, we must make sure that exception is propagated.
|
||||||
|
|
||||||
*_retval = PR_FALSE;
|
*_retval = PR_FALSE;
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return nsEventReceiverSH::AddProperty(wrapper, cx, obj, id, vp, _retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -4502,7 +4504,7 @@ nsNodeSH::AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
doc->AddReference(content, wrapper);
|
doc->AddReference(content, wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return nsEventReceiverSH::AddProperty(wrapper, cx, obj, id, vp, _retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -4615,7 +4617,9 @@ nsEventReceiverSH::NewResolve(nsIXPConnectWrappedNative *wrapper,
|
||||||
JSContext *cx, JSObject *obj, jsval id,
|
JSContext *cx, JSObject *obj, jsval id,
|
||||||
PRUint32 flags, JSObject **objp, PRBool *_retval)
|
PRUint32 flags, JSObject **objp, PRBool *_retval)
|
||||||
{
|
{
|
||||||
if (!JSVAL_IS_STRING(id)) {
|
// If we're assigning to an on* property, we'll register the handler
|
||||||
|
// in our ::SetProperty() hook, so no need to do it here too.
|
||||||
|
if (!JSVAL_IS_STRING(id) || (flags & JSRESOLVE_ASSIGNING)) {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4647,6 +4651,14 @@ nsEventReceiverSH::SetProperty(nsIXPConnectWrappedNative *wrapper,
|
||||||
return RegisterCompileHandler(wrapper, cx, obj, id, PR_FALSE, &did_compile);
|
return RegisterCompileHandler(wrapper, cx, obj, id, PR_FALSE, &did_compile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsEventReceiverSH::AddProperty(nsIXPConnectWrappedNative *wrapper,
|
||||||
|
JSContext *cx, JSObject *obj, jsval id,
|
||||||
|
jsval *vp, PRBool *_retval)
|
||||||
|
{
|
||||||
|
return nsEventReceiverSH::SetProperty(wrapper, cx, obj, id, vp, _retval);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsEventReceiverSH::OnFinalize(...)
|
nsEventReceiverSH::OnFinalize(...)
|
||||||
|
@ -5292,7 +5304,7 @@ nsHTMLDocumentSH::DocumentOpen(JSContext *cx, JSObject *obj, uintN argc,
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
sXPConnect->GetWrappedNativeOfJSObject(cx, obj, getter_AddRefs(wrapper));
|
sXPConnect->GetWrappedNativeOfJSObject(cx, obj, getter_AddRefs(wrapper));
|
||||||
if (NS_FAILED(rv)) {
|
if (NS_FAILED(rv)) {
|
||||||
ThrowJSException(cx, rv);
|
nsDOMClassInfo::ThrowJSException(cx, rv);
|
||||||
|
|
||||||
return JS_FALSE;
|
return JS_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,6 +310,8 @@ public:
|
||||||
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
NS_IMETHOD SetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
JSObject *obj, jsval id, jsval *vp,
|
JSObject *obj, jsval id, jsval *vp,
|
||||||
PRBool *_retval);
|
PRBool *_retval);
|
||||||
|
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||||
|
JSObject *obj, jsval id, jsval *vp, PRBool *_retval);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче