Commit af07789c authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3/httpreq: Added ISupportErrorInfo stub.

parent a0cdab26
......@@ -73,6 +73,7 @@ typedef struct
IXMLHTTPRequest IXMLHTTPRequest_iface;
IObjectWithSite IObjectWithSite_iface;
IObjectSafety IObjectSafety_iface;
ISupportErrorInfo ISupportErrorInfo_iface;
LONG ref;
READYSTATE state;
......@@ -131,6 +132,11 @@ static inline httprequest *impl_from_IObjectSafety(IObjectSafety *iface)
return CONTAINING_RECORD(iface, httprequest, IObjectSafety_iface);
}
static inline httprequest *impl_from_ISupportErrorInfo(ISupportErrorInfo *iface)
{
return CONTAINING_RECORD(iface, httprequest, ISupportErrorInfo_iface);
}
static inline serverhttp *impl_from_IServerXMLHTTPRequest(IServerXMLHTTPRequest *iface)
{
return CONTAINING_RECORD(iface, serverhttp, IServerXMLHTTPRequest_iface);
......@@ -1329,6 +1335,10 @@ static HRESULT WINAPI XMLHTTPRequest_QueryInterface(IXMLHTTPRequest *iface, REFI
{
*ppvObject = &This->IObjectSafety_iface;
}
else if (IsEqualGUID(&IID_ISupportErrorInfo, riid))
{
*ppvObject = &This->ISupportErrorInfo_iface;
}
else
{
TRACE("Unsupported interface %s\n", debugstr_guid(riid));
......@@ -1336,7 +1346,7 @@ static HRESULT WINAPI XMLHTTPRequest_QueryInterface(IXMLHTTPRequest *iface, REFI
return E_NOINTERFACE;
}
IXMLHTTPRequest_AddRef( iface );
IUnknown_AddRef((IUnknown *)*ppvObject);
return S_OK;
}
......@@ -1709,6 +1719,41 @@ static const IObjectSafetyVtbl ObjectSafetyVtbl = {
httprequest_Safety_SetInterfaceSafetyOptions
};
static HRESULT WINAPI SupportErrorInfo_QueryInterface(ISupportErrorInfo *iface, REFIID riid, void **obj)
{
httprequest *This = impl_from_ISupportErrorInfo(iface);
return IXMLHTTPRequest_QueryInterface(&This->IXMLHTTPRequest_iface, riid, obj);
}
static ULONG WINAPI SupportErrorInfo_AddRef(ISupportErrorInfo *iface)
{
httprequest *This = impl_from_ISupportErrorInfo(iface);
return IXMLHTTPRequest_AddRef(&This->IXMLHTTPRequest_iface);
}
static ULONG WINAPI SupportErrorInfo_Release(ISupportErrorInfo *iface)
{
httprequest *This = impl_from_ISupportErrorInfo(iface);
return IXMLHTTPRequest_Release(&This->IXMLHTTPRequest_iface);
}
static HRESULT WINAPI SupportErrorInfo_InterfaceSupportsErrorInfo(ISupportErrorInfo *iface, REFIID riid)
{
httprequest *This = impl_from_ISupportErrorInfo(iface);
FIXME("(%p)->(%s)\n", This, debugstr_guid(riid));
return E_NOTIMPL;
}
static const ISupportErrorInfoVtbl SupportErrorInfoVtbl =
{
SupportErrorInfo_QueryInterface,
SupportErrorInfo_AddRef,
SupportErrorInfo_Release,
SupportErrorInfo_InterfaceSupportsErrorInfo,
};
/* IServerXMLHTTPRequest */
static HRESULT WINAPI ServerXMLHTTPRequest_QueryInterface(IServerXMLHTTPRequest *iface, REFIID riid, void **obj)
{
......@@ -1723,6 +1768,10 @@ static HRESULT WINAPI ServerXMLHTTPRequest_QueryInterface(IServerXMLHTTPRequest
{
*obj = iface;
}
else if ( IsEqualGUID( riid, &IID_ISupportErrorInfo ))
{
*obj = &This->req.ISupportErrorInfo_iface;
}
else
{
TRACE("Unsupported interface %s\n", debugstr_guid(riid));
......@@ -1730,7 +1779,7 @@ static HRESULT WINAPI ServerXMLHTTPRequest_QueryInterface(IServerXMLHTTPRequest
return E_NOINTERFACE;
}
IServerXMLHTTPRequest_AddRef( iface );
IUnknown_AddRef( (IUnknown *)*obj );
return S_OK;
}
......@@ -1987,6 +2036,7 @@ static void init_httprequest(httprequest *req)
req->IXMLHTTPRequest_iface.lpVtbl = &XMLHTTPRequestVtbl;
req->IObjectWithSite_iface.lpVtbl = &ObjectWithSiteVtbl;
req->IObjectSafety_iface.lpVtbl = &ObjectSafetyVtbl;
req->ISupportErrorInfo_iface.lpVtbl = &SupportErrorInfoVtbl;
req->ref = 1;
req->async = FALSE;
......
......@@ -1339,6 +1339,16 @@ static IXMLHttpRequest *create_xhr(void)
return SUCCEEDED(hr) ? ret : NULL;
}
static IServerXMLHTTPRequest *create_server_xhr(void)
{
IServerXMLHTTPRequest *ret;
HRESULT hr;
hr = CoCreateInstance(&CLSID_ServerXMLHTTP30, NULL, CLSCTX_INPROC_SERVER, &IID_IServerXMLHTTPRequest, (void **)&ret);
return SUCCEEDED(hr) ? ret : NULL;
}
static void set_safety_opt(IUnknown *unk, DWORD mask, DWORD opts)
{
IObjectSafety *obj_safety;
......@@ -1777,20 +1787,67 @@ static void test_safe_httpreq(void)
free_bstrs();
}
static void test_supporterrorinfo(void)
{
HRESULT hr;
IXMLHttpRequest *xhr;
IServerXMLHTTPRequest *server_xhr;
ISupportErrorInfo *errorinfo, *errorinfo2;
xhr = create_xhr();
EXPECT_REF(xhr, 1);
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_ISupportErrorInfo, (void **)&errorinfo);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr);
EXPECT_REF(xhr, 2);
hr = IXMLHttpRequest_QueryInterface(xhr, &IID_ISupportErrorInfo, (void **)&errorinfo2);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr);
ok(errorinfo == errorinfo2, "Unexpected error info instance.\n");
EXPECT_REF(xhr, 3);
ISupportErrorInfo_Release(errorinfo2);
ISupportErrorInfo_Release(errorinfo);
IXMLHttpRequest_Release(xhr);
/* ServerXMLHTTP */
server_xhr = create_server_xhr();
EXPECT_REF(server_xhr, 1);
hr = IServerXMLHTTPRequest_QueryInterface(server_xhr, &IID_ISupportErrorInfo, (void **)&errorinfo);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr);
EXPECT_REF(server_xhr, 2);
hr = IServerXMLHTTPRequest_QueryInterface(server_xhr, &IID_ISupportErrorInfo, (void **)&errorinfo2);
ok(hr == S_OK, "Failed to get ISupportErrorInfo, hr %#x.\n", hr);
ok(errorinfo == errorinfo2, "Unexpected error info instance.\n");
EXPECT_REF(server_xhr, 3);
ISupportErrorInfo_Release(errorinfo2);
ISupportErrorInfo_Release(errorinfo);
IServerXMLHTTPRequest_Release(server_xhr);
}
START_TEST(httpreq)
{
IXMLHttpRequest *xhr;
CoInitialize(NULL);
if((xhr = create_xhr())) {
IXMLHttpRequest_Release(xhr);
test_XMLHTTP();
test_safe_httpreq();
}else {
if (!(xhr = create_xhr()))
{
win_skip("IXMLHTTPRequest is not available\n");
CoUninitialize();
return;
}
IXMLHttpRequest_Release(xhr);
test_XMLHTTP();
test_safe_httpreq();
test_supporterrorinfo();
CoUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment