Bug 696665 - Give nsJSContext::JSObjectFromInterface a JSObject scope parameter; r=volkmar

This commit is contained in:
Ms2ger 2011-10-29 22:17:00 +02:00
Родитель 354b9702e2
Коммит 069814d95b
2 изменённых файлов: 9 добавлений и 8 удалений

Просмотреть файл

@ -1698,20 +1698,19 @@ AtomIsEventHandlerName(nsIAtom *aName)
// Helper function to find the JSObject associated with a (presumably DOM)
// interface.
nsresult
nsJSContext::JSObjectFromInterface(nsISupports* aTarget, void *aScope, JSObject **aRet)
nsJSContext::JSObjectFromInterface(nsISupports* aTarget, JSObject* aScope, JSObject** aRet)
{
// It is legal to specify a null target.
if (!aTarget) {
*aRet = nsnull;
return NS_OK;
*aRet = nsnull;
return NS_OK;
}
// Get the jsobject associated with this target
// We don't wrap here because we trust the JS engine to wrap the target
// later.
nsresult rv;
jsval v;
rv = nsContentUtils::WrapNative(mContext, (JSObject *)aScope, aTarget, &v);
nsresult rv = nsContentUtils::WrapNative(mContext, aScope, aTarget, &v);
NS_ENSURE_SUCCESS(rv, rv);
#ifdef NS_DEBUG
@ -1876,7 +1875,8 @@ nsJSContext::CallEventHandler(nsISupports* aTarget, void *aScope, void *aHandler
JSAutoRequest ar(mContext);
JSObject* target = nsnull;
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
nsresult rv = JSObjectFromInterface(aTarget, static_cast<JSObject*>(aScope),
&target);
NS_ENSURE_SUCCESS(rv, rv);
js::AutoObjectRooter targetVal(mContext, target);
@ -1981,7 +1981,8 @@ nsJSContext::BindCompiledEventHandler(nsISupports* aTarget, void *aScope,
// Get the jsobject associated with this target
JSObject *target = nsnull;
nsresult rv = JSObjectFromInterface(aTarget, aScope, &target);
nsresult rv = JSObjectFromInterface(aTarget, static_cast<JSObject*>(aScope),
&target);
NS_ENSURE_SUCCESS(rv, rv);
JSObject *funobj = (JSObject*) aHandler;

Просмотреть файл

@ -209,7 +209,7 @@ protected:
// given an nsISupports object (presumably an event target or some other
// DOM object), get (or create) the JSObject wrapping it.
nsresult JSObjectFromInterface(nsISupports *aSup, void *aScript,
nsresult JSObjectFromInterface(nsISupports *aSup, JSObject *aScript,
JSObject **aRet);
// Report the pending exception on our mContext, if any. This