зеркало из https://github.com/mozilla/gecko-dev.git
Bug 192281 - Error calling IDispatch.setCallback on active-x control. This patch turns on wrapping of JS objects by an IDispatch interface. All changes are outside of Mozilla build. r=adamlock, sr=jst, a=dbaron
This commit is contained in:
Родитель
5cae1f1bc7
Коммит
74be079a50
|
@ -311,14 +311,24 @@ JSBool XPCDispConvert::JSToCOM(XPCCallContext& ccx,
|
|||
case VT_DISPATCH:
|
||||
{
|
||||
JSObject * obj = JSVAL_TO_OBJECT(src);
|
||||
// We only handle JS Objects that are IDispatch objects
|
||||
if(!XPCConvert::GetNativeInterfaceFromJSObject(
|
||||
ccx, (void**)&varDest->pdispVal, obj, &NSID_IDISPATCH,&err))
|
||||
IUnknown * pUnknown = nsnull;
|
||||
if (!XPCConvert::JSObject2NativeInterface(
|
||||
ccx,
|
||||
(void**)&pUnknown,
|
||||
obj,
|
||||
&NSID_IDISPATCH,
|
||||
nsnull,
|
||||
&err))
|
||||
{
|
||||
// Avoid cleaning up garabage
|
||||
varDest->vt = VT_EMPTY;
|
||||
return JS_FALSE;
|
||||
}
|
||||
varDest->vt = VT_DISPATCH;
|
||||
pUnknown->QueryInterface(IID_IDispatch,
|
||||
NS_REINTERPRET_CAST(void**,
|
||||
&varDest->pdispVal));
|
||||
NS_IF_RELEASE(pUnknown);
|
||||
}
|
||||
break;
|
||||
case VT_BOOL:
|
||||
|
@ -541,6 +551,7 @@ JSBool XPCDispConvert::COMToJS(XPCCallContext& ccx, const VARIANT& src,
|
|||
err = NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
return JS_FALSE;
|
||||
}
|
||||
isPtr = FALSE;
|
||||
} // Fall through on success
|
||||
case VT_BSTR:
|
||||
{
|
||||
|
|
|
@ -248,8 +248,7 @@ STDMETHODIMP XPCDispatchTearOff::Invoke(DISPID dispIdMember, REFIID riid,
|
|||
}
|
||||
// Get the name as a flat string
|
||||
// This isn't that efficient, but we have to make the conversion somewhere
|
||||
const nsAString & xname = pTypeInfo->GetNameForDispID(dispIdMember);
|
||||
const nsPromiseFlatCString & name = PromiseFlatCString(NS_LossyConvertUCS2toASCII(xname));
|
||||
NS_LossyConvertUCS2toASCII name(pTypeInfo->GetNameForDispID(dispIdMember));
|
||||
if(name.IsEmpty())
|
||||
return E_FAIL;
|
||||
// Decide if this is a getter or setter
|
||||
|
|
|
@ -316,7 +316,7 @@ STDMETHODIMP XPCDispTypeInfo::GetIDsOfNames(
|
|||
{
|
||||
nsDependentString buffer(NS_STATIC_CAST(const PRUnichar *,
|
||||
rgszNames[index]),
|
||||
SysStringLen(rgszNames[index]));
|
||||
wcslen(rgszNames[index]));
|
||||
pMemId[index] = mNameArray.Find(buffer);
|
||||
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче