mshtml: Implement IHTMLXMLHttpRequest as a stub.

This commit is contained in:
Zhenbo Li 2015-06-11 11:38:53 +08:00 committed by Alexandre Julliard
parent 45f14218f7
commit 82d090dd6d
3 changed files with 252 additions and 2 deletions

View File

@ -116,6 +116,7 @@ typedef struct event_target_t event_target_t;
XDIID(DispHTMLTitleElement) \
XDIID(DispHTMLUnknownElement) \
XDIID(DispHTMLWindow2) \
XDIID(DispHTMLXMLHttpRequest) \
XDIID(HTMLDocumentEvents) \
XDIID(HTMLElementEvents2) \
XIID(IHTMLAnchorElement) \
@ -204,6 +205,7 @@ typedef struct event_target_t event_target_t;
XIID(IHTMLWindow4) \
XIID(IHTMLWindow5) \
XIID(IHTMLWindow6) \
XIID(IHTMLXMLHttpRequest) \
XIID(IHTMLXMLHttpRequestFactory) \
XIID(IOmHistory) \
XIID(IOmNavigator)

View File

@ -6092,6 +6092,7 @@ static void test_xmlhttprequest(IHTMLWindow5 *window)
HRESULT hres;
VARIANT var;
IHTMLXMLHttpRequestFactory *factory;
IHTMLXMLHttpRequest *xml;
hres = IHTMLWindow5_get_XMLHttpRequest(window, &var);
ok(hres == S_OK, "get_XMLHttpRequest failed: %08x\n", hres);
@ -6102,6 +6103,13 @@ static void test_xmlhttprequest(IHTMLWindow5 *window)
ok(hres == S_OK, "QueryInterface(&IID_IHTMLXMLHttpRequestFactory) failed: %08x\n", hres);
ok(factory != NULL, "factory == NULL\n");
xml = NULL;
hres = IHTMLXMLHttpRequestFactory_create(factory, &xml);
ok(hres == S_OK, "create failed: %08x\n", hres);
ok(xml != NULL, "xml == NULL\n");
test_disp((IUnknown*)xml, &DIID_DispHTMLXMLHttpRequest, "[object]");
IHTMLXMLHttpRequest_Release(xml);
IHTMLXMLHttpRequestFactory_Release(factory);
VariantClear(&var);
}

View File

@ -31,6 +31,233 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
/* IHTMLXMLHttpRequest */
typedef struct {
EventTarget event_target;
IHTMLXMLHttpRequest IHTMLXMLHttpRequest_iface;
LONG ref;
} HTMLXMLHttpRequest;
static inline HTMLXMLHttpRequest *impl_from_IHTMLXMLHttpRequest(IHTMLXMLHttpRequest *iface)
{
return CONTAINING_RECORD(iface, HTMLXMLHttpRequest, IHTMLXMLHttpRequest_iface);
}
static HRESULT WINAPI HTMLXMLHttpRequest_QueryInterface(IHTMLXMLHttpRequest *iface, REFIID riid, void **ppv)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
if(IsEqualGUID(&IID_IUnknown, riid)) {
*ppv = &This->IHTMLXMLHttpRequest_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
*ppv = &This->IHTMLXMLHttpRequest_iface;
}else if(IsEqualGUID(&IID_IHTMLXMLHttpRequest, riid)) {
*ppv = &This->IHTMLXMLHttpRequest_iface;
}else if(dispex_query_interface(&This->event_target.dispex, riid, ppv)) {
return *ppv ? S_OK : E_NOINTERFACE;
}else {
*ppv = NULL;
WARN("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
return E_NOINTERFACE;
}
IUnknown_AddRef((IUnknown*)*ppv);
return S_OK;
}
static ULONG WINAPI HTMLXMLHttpRequest_AddRef(IHTMLXMLHttpRequest *iface)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI HTMLXMLHttpRequest_Release(IHTMLXMLHttpRequest *iface)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
release_dispex(&This->event_target.dispex);
heap_free(This);
}
return ref;
}
static HRESULT WINAPI HTMLXMLHttpRequest_GetTypeInfoCount(IHTMLXMLHttpRequest *iface, UINT *pctinfo)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
return IDispatchEx_GetTypeInfoCount(&This->event_target.dispex.IDispatchEx_iface, pctinfo);
}
static HRESULT WINAPI HTMLXMLHttpRequest_GetTypeInfo(IHTMLXMLHttpRequest *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
return IDispatchEx_GetTypeInfo(&This->event_target.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
}
static HRESULT WINAPI HTMLXMLHttpRequest_GetIDsOfNames(IHTMLXMLHttpRequest *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
return IDispatchEx_GetIDsOfNames(&This->event_target.dispex.IDispatchEx_iface, riid, rgszNames, cNames,
lcid, rgDispId);
}
static HRESULT WINAPI HTMLXMLHttpRequest_Invoke(IHTMLXMLHttpRequest *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
return IDispatchEx_Invoke(&This->event_target.dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
pDispParams, pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_readyState(IHTMLXMLHttpRequest *iface, LONG *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_responseBody(IHTMLXMLHttpRequest *iface, VARIANT *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_responseText(IHTMLXMLHttpRequest *iface, BSTR *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_responseXML(IHTMLXMLHttpRequest *iface, IDispatch **p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_status(IHTMLXMLHttpRequest *iface, LONG *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_statusText(IHTMLXMLHttpRequest *iface, BSTR *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_put_onreadystatechange(IHTMLXMLHttpRequest *iface, VARIANT v)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&v));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_get_onreadystatechange(IHTMLXMLHttpRequest *iface, VARIANT *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_abort(IHTMLXMLHttpRequest *iface)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->()\n", This);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_open(IHTMLXMLHttpRequest *iface, BSTR bstrMethod, BSTR bstrUrl, VARIANT varAsync, VARIANT varUser, VARIANT varPassword)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%s %s %s %s %s)\n", This, debugstr_w(bstrMethod), debugstr_w(bstrUrl), debugstr_variant(&varAsync), debugstr_variant(&varUser), debugstr_variant(&varPassword));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_send(IHTMLXMLHttpRequest *iface, VARIANT varBody)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%s)\n", This, debugstr_variant(&varBody));
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_getAllResponseHeaders(IHTMLXMLHttpRequest *iface, BSTR *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_getResponseHeader(IHTMLXMLHttpRequest *iface, BSTR bstrHeader, BSTR *p)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%s %p)\n", This, debugstr_w(bstrHeader), p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLXMLHttpRequest_setRequestHeader(IHTMLXMLHttpRequest *iface, BSTR bstrHeader, BSTR bstrValue)
{
HTMLXMLHttpRequest *This = impl_from_IHTMLXMLHttpRequest(iface);
FIXME("(%p)->(%s %s)\n", This, debugstr_w(bstrHeader), debugstr_w(bstrValue));
return E_NOTIMPL;
}
static const IHTMLXMLHttpRequestVtbl HTMLXMLHttpRequestVtbl = {
HTMLXMLHttpRequest_QueryInterface,
HTMLXMLHttpRequest_AddRef,
HTMLXMLHttpRequest_Release,
HTMLXMLHttpRequest_GetTypeInfoCount,
HTMLXMLHttpRequest_GetTypeInfo,
HTMLXMLHttpRequest_GetIDsOfNames,
HTMLXMLHttpRequest_Invoke,
HTMLXMLHttpRequest_get_readyState,
HTMLXMLHttpRequest_get_responseBody,
HTMLXMLHttpRequest_get_responseText,
HTMLXMLHttpRequest_get_responseXML,
HTMLXMLHttpRequest_get_status,
HTMLXMLHttpRequest_get_statusText,
HTMLXMLHttpRequest_put_onreadystatechange,
HTMLXMLHttpRequest_get_onreadystatechange,
HTMLXMLHttpRequest_abort,
HTMLXMLHttpRequest_open,
HTMLXMLHttpRequest_send,
HTMLXMLHttpRequest_getAllResponseHeaders,
HTMLXMLHttpRequest_getResponseHeader,
HTMLXMLHttpRequest_setRequestHeader
};
static const tid_t HTMLXMLHttpRequest_iface_tids[] = {
IHTMLXMLHttpRequest_tid,
0
};
static dispex_static_data_t HTMLXMLHttpRequest_dispex = {
NULL,
DispHTMLXMLHttpRequest_tid,
NULL,
HTMLXMLHttpRequest_iface_tids
};
/* IHTMLXMLHttpRequestFactory */
static inline HTMLXMLHttpRequestFactory *impl_from_IHTMLXMLHttpRequestFactory(IHTMLXMLHttpRequestFactory *iface)
{
@ -121,8 +348,21 @@ static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactor
static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p)
{
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
HTMLXMLHttpRequest *ret;
TRACE("(%p)->(%p)\n", This, p);
ret = heap_alloc_zero(sizeof(*ret));
if(!ret)
return E_OUTOFMEMORY;
ret->IHTMLXMLHttpRequest_iface.lpVtbl = &HTMLXMLHttpRequestVtbl;
init_dispex(&ret->event_target.dispex, (IUnknown*)&ret->IHTMLXMLHttpRequest_iface,
&HTMLXMLHttpRequest_dispex);
ret->ref = 1;
*p = &ret->IHTMLXMLHttpRequest_iface;
return S_OK;
}
static const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = {