mshtml: Implement IHTMLXMLHttpRequestFactory as a stub.
This commit is contained in:
parent
ba2274c8ba
commit
0036b8bf2e
|
@ -73,7 +73,8 @@ C_SRCS = \
|
||||||
service.c \
|
service.c \
|
||||||
task.c \
|
task.c \
|
||||||
txtrange.c \
|
txtrange.c \
|
||||||
view.c
|
view.c \
|
||||||
|
xmlhttprequest.c
|
||||||
|
|
||||||
RC_SRCS = mshtml.rc
|
RC_SRCS = mshtml.rc
|
||||||
|
|
||||||
|
|
|
@ -256,6 +256,10 @@ static void release_inner_window(HTMLInnerWindow *This)
|
||||||
IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface);
|
IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(This->xml_factory) {
|
||||||
|
IHTMLXMLHttpRequestFactory_Release(&This->xml_factory->IHTMLXMLHttpRequestFactory_iface);
|
||||||
|
}
|
||||||
|
|
||||||
if(This->screen)
|
if(This->screen)
|
||||||
IHTMLScreen_Release(This->screen);
|
IHTMLScreen_Release(This->screen);
|
||||||
|
|
||||||
|
@ -1965,8 +1969,23 @@ static HRESULT WINAPI HTMLWindow5_put_XMLHttpRequest(IHTMLWindow5 *iface, VARIAN
|
||||||
static HRESULT WINAPI HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5 *iface, VARIANT *p)
|
static HRESULT WINAPI HTMLWindow5_get_XMLHttpRequest(IHTMLWindow5 *iface, VARIANT *p)
|
||||||
{
|
{
|
||||||
HTMLWindow *This = impl_from_IHTMLWindow5(iface);
|
HTMLWindow *This = impl_from_IHTMLWindow5(iface);
|
||||||
FIXME("(%p)->(%p)\n", This, p);
|
HTMLInnerWindow *window = This->inner_window;
|
||||||
return E_NOTIMPL;
|
|
||||||
|
TRACE("(%p)->(%p)\n", This, p);
|
||||||
|
|
||||||
|
if(!window->xml_factory) {
|
||||||
|
HRESULT hres;
|
||||||
|
|
||||||
|
hres = HTMLXMLHttpRequestFactory_Create(window, &window->xml_factory);
|
||||||
|
if(FAILED(hres))
|
||||||
|
return hres;
|
||||||
|
}
|
||||||
|
|
||||||
|
V_VT(p) = VT_DISPATCH;
|
||||||
|
V_DISPATCH(p) = (IDispatch*)&window->xml_factory->IHTMLXMLHttpRequestFactory_iface;
|
||||||
|
IDispatch_AddRef(V_DISPATCH(p));
|
||||||
|
|
||||||
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IHTMLWindow5Vtbl HTMLWindow5Vtbl = {
|
static const IHTMLWindow5Vtbl HTMLWindow5Vtbl = {
|
||||||
|
|
|
@ -204,6 +204,7 @@ typedef struct event_target_t event_target_t;
|
||||||
XIID(IHTMLWindow4) \
|
XIID(IHTMLWindow4) \
|
||||||
XIID(IHTMLWindow5) \
|
XIID(IHTMLWindow5) \
|
||||||
XIID(IHTMLWindow6) \
|
XIID(IHTMLWindow6) \
|
||||||
|
XIID(IHTMLXMLHttpRequestFactory) \
|
||||||
XIID(IOmHistory) \
|
XIID(IOmHistory) \
|
||||||
XIID(IOmNavigator)
|
XIID(IOmNavigator)
|
||||||
|
|
||||||
|
@ -351,6 +352,13 @@ typedef struct {
|
||||||
HTMLInnerWindow *window;
|
HTMLInnerWindow *window;
|
||||||
} HTMLImageElementFactory;
|
} HTMLImageElementFactory;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
DispatchEx dispex;
|
||||||
|
IHTMLXMLHttpRequestFactory IHTMLXMLHttpRequestFactory_iface;
|
||||||
|
|
||||||
|
LONG ref;
|
||||||
|
} HTMLXMLHttpRequestFactory;
|
||||||
|
|
||||||
struct HTMLLocation {
|
struct HTMLLocation {
|
||||||
DispatchEx dispex;
|
DispatchEx dispex;
|
||||||
IHTMLLocation IHTMLLocation_iface;
|
IHTMLLocation IHTMLLocation_iface;
|
||||||
|
@ -437,6 +445,7 @@ struct HTMLInnerWindow {
|
||||||
|
|
||||||
HTMLImageElementFactory *image_factory;
|
HTMLImageElementFactory *image_factory;
|
||||||
HTMLOptionElementFactory *option_factory;
|
HTMLOptionElementFactory *option_factory;
|
||||||
|
HTMLXMLHttpRequestFactory *xml_factory;
|
||||||
IHTMLScreen *screen;
|
IHTMLScreen *screen;
|
||||||
OmHistory *history;
|
OmHistory *history;
|
||||||
IHTMLStorage *session_storage;
|
IHTMLStorage *session_storage;
|
||||||
|
@ -775,6 +784,7 @@ HTMLOuterWindow *nswindow_to_window(const nsIDOMWindow*) DECLSPEC_HIDDEN;
|
||||||
void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
|
void get_top_window(HTMLOuterWindow*,HTMLOuterWindow**) DECLSPEC_HIDDEN;
|
||||||
HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
|
HRESULT HTMLOptionElementFactory_Create(HTMLInnerWindow*,HTMLOptionElementFactory**) DECLSPEC_HIDDEN;
|
||||||
HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
|
HRESULT HTMLImageElementFactory_Create(HTMLInnerWindow*,HTMLImageElementFactory**) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow*,HTMLXMLHttpRequestFactory**) DECLSPEC_HIDDEN;
|
||||||
HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
|
HRESULT HTMLLocation_Create(HTMLInnerWindow*,HTMLLocation**) DECLSPEC_HIDDEN;
|
||||||
IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
|
IOmNavigator *OmNavigator_Create(void) DECLSPEC_HIDDEN;
|
||||||
HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
|
HRESULT HTMLScreen_Create(IHTMLScreen**) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -518,6 +518,34 @@ static BSTR a2bstr(const char *str)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const char *debugstr_variant(const VARIANT *var)
|
||||||
|
{
|
||||||
|
static char buf[400];
|
||||||
|
|
||||||
|
if (!var)
|
||||||
|
return "(null)";
|
||||||
|
|
||||||
|
switch (V_VT(var))
|
||||||
|
{
|
||||||
|
case VT_EMPTY:
|
||||||
|
return "{VT_EMPTY}";
|
||||||
|
case VT_BSTR:
|
||||||
|
sprintf(buf, "{VT_BSTR: %s}", wine_dbgstr_w(V_BSTR(var)));
|
||||||
|
break;
|
||||||
|
case VT_BOOL:
|
||||||
|
sprintf(buf, "{VT_BOOL: %x}", V_BOOL(var));
|
||||||
|
break;
|
||||||
|
case VT_UI4:
|
||||||
|
sprintf(buf, "{VT_UI4: %u}", V_UI4(var));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sprintf(buf, "{vt %d}", V_VT(var));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
|
static BOOL iface_cmp(IUnknown *iface1, IUnknown *iface2)
|
||||||
{
|
{
|
||||||
IUnknown *unk1, *unk2;
|
IUnknown *unk1, *unk2;
|
||||||
|
@ -6059,9 +6087,29 @@ static void test_history(IHTMLWindow2 *window)
|
||||||
IOmHistory_Release(history);
|
IOmHistory_Release(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_xmlhttprequest(IHTMLWindow5 *window)
|
||||||
|
{
|
||||||
|
HRESULT hres;
|
||||||
|
VARIANT var;
|
||||||
|
IHTMLXMLHttpRequestFactory *factory;
|
||||||
|
|
||||||
|
hres = IHTMLWindow5_get_XMLHttpRequest(window, &var);
|
||||||
|
ok(hres == S_OK, "get_XMLHttpRequest failed: %08x\n", hres);
|
||||||
|
ok(V_VT(&var) == VT_DISPATCH, "expect VT_DISPATCH, got %s\n", debugstr_variant(&var));
|
||||||
|
|
||||||
|
factory = NULL;
|
||||||
|
hres = IDispatch_QueryInterface(V_DISPATCH(&var), &IID_IHTMLXMLHttpRequestFactory, (void**)&factory);
|
||||||
|
ok(hres == S_OK, "QueryInterface(&IID_IHTMLXMLHttpRequestFactory) failed: %08x\n", hres);
|
||||||
|
ok(factory != NULL, "factory == NULL\n");
|
||||||
|
|
||||||
|
IHTMLXMLHttpRequestFactory_Release(factory);
|
||||||
|
VariantClear(&var);
|
||||||
|
}
|
||||||
|
|
||||||
static void test_window(IHTMLDocument2 *doc)
|
static void test_window(IHTMLDocument2 *doc)
|
||||||
{
|
{
|
||||||
IHTMLWindow2 *window, *window2, *self, *parent;
|
IHTMLWindow2 *window, *window2, *self, *parent;
|
||||||
|
IHTMLWindow5 *window5;
|
||||||
IHTMLDocument2 *doc2 = NULL;
|
IHTMLDocument2 *doc2 = NULL;
|
||||||
IDispatch *disp;
|
IDispatch *disp;
|
||||||
IUnknown *unk;
|
IUnknown *unk;
|
||||||
|
@ -6148,6 +6196,15 @@ static void test_window(IHTMLDocument2 *doc)
|
||||||
set_window_status(window, "Test!");
|
set_window_status(window, "Test!");
|
||||||
test_history(window);
|
test_history(window);
|
||||||
|
|
||||||
|
hres = IHTMLWindow2_QueryInterface(window, &IID_IHTMLWindow5, (void**)&window5);
|
||||||
|
if(SUCCEEDED(hres)) {
|
||||||
|
ok(window5 != NULL, "window5 == NULL\n");
|
||||||
|
test_xmlhttprequest(window5);
|
||||||
|
IHTMLWindow5_Release(window5);
|
||||||
|
}else {
|
||||||
|
win_skip("IHTMLWindow5 not supported!\n");
|
||||||
|
}
|
||||||
|
|
||||||
IHTMLWindow2_Release(window);
|
IHTMLWindow2_Release(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2015 Zhenbo Li
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#define COBJMACROS
|
||||||
|
|
||||||
|
#include "windef.h"
|
||||||
|
#include "winbase.h"
|
||||||
|
#include "winuser.h"
|
||||||
|
#include "ole2.h"
|
||||||
|
|
||||||
|
#include "wine/debug.h"
|
||||||
|
|
||||||
|
#include "mshtml_private.h"
|
||||||
|
|
||||||
|
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
|
||||||
|
|
||||||
|
/* IHTMLXMLHttpRequestFactory */
|
||||||
|
static inline HTMLXMLHttpRequestFactory *impl_from_IHTMLXMLHttpRequestFactory(IHTMLXMLHttpRequestFactory *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, HTMLXMLHttpRequestFactory, IHTMLXMLHttpRequestFactory_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLXMLHttpRequestFactory_QueryInterface(IHTMLXMLHttpRequestFactory *iface, REFIID riid, void **ppv)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
|
||||||
|
TRACE("(%p)->(%s %p)\n", This, debugstr_mshtml_guid(riid), ppv);
|
||||||
|
|
||||||
|
if(IsEqualGUID(&IID_IUnknown, riid)) {
|
||||||
|
*ppv = &This->IHTMLXMLHttpRequestFactory_iface;
|
||||||
|
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
|
||||||
|
*ppv = &This->IHTMLXMLHttpRequestFactory_iface;
|
||||||
|
}else if(IsEqualGUID(&IID_IHTMLXMLHttpRequestFactory, riid)) {
|
||||||
|
*ppv = &This->IHTMLXMLHttpRequestFactory_iface;
|
||||||
|
}else if(dispex_query_interface(&This->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 HTMLXMLHttpRequestFactory_AddRef(IHTMLXMLHttpRequestFactory *iface)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
LONG ref = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) ref=%d\n", This, ref);
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static ULONG WINAPI HTMLXMLHttpRequestFactory_Release(IHTMLXMLHttpRequestFactory *iface)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
LONG ref = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
|
TRACE("(%p) ref=%d\n", This, ref);
|
||||||
|
|
||||||
|
if(!ref) {
|
||||||
|
release_dispex(&This->dispex);
|
||||||
|
heap_free(This);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfoCount(IHTMLXMLHttpRequestFactory *iface, UINT *pctinfo)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
return IDispatchEx_GetTypeInfoCount(&This->dispex.IDispatchEx_iface, pctinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetTypeInfo(IHTMLXMLHttpRequestFactory *iface, UINT iTInfo,
|
||||||
|
LCID lcid, ITypeInfo **ppTInfo)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
|
||||||
|
return IDispatchEx_GetTypeInfo(&This->dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLXMLHttpRequestFactory_GetIDsOfNames(IHTMLXMLHttpRequestFactory *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
|
||||||
|
LCID lcid, DISPID *rgDispId)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
|
||||||
|
return IDispatchEx_GetIDsOfNames(&This->dispex.IDispatchEx_iface, riid, rgszNames, cNames,
|
||||||
|
lcid, rgDispId);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLXMLHttpRequestFactory_Invoke(IHTMLXMLHttpRequestFactory *iface, DISPID dispIdMember, REFIID riid, LCID lcid,
|
||||||
|
WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
|
||||||
|
return IDispatchEx_Invoke(&This->dispex.IDispatchEx_iface, dispIdMember, riid, lcid, wFlags,
|
||||||
|
pDispParams, pVarResult, pExcepInfo, puArgErr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static HRESULT WINAPI HTMLXMLHttpRequestFactory_create(IHTMLXMLHttpRequestFactory *iface, IHTMLXMLHttpRequest **p)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *This = impl_from_IHTMLXMLHttpRequestFactory(iface);
|
||||||
|
FIXME("(%p)->(%p)\n", This, p);
|
||||||
|
return E_NOTIMPL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const IHTMLXMLHttpRequestFactoryVtbl HTMLXMLHttpRequestFactoryVtbl = {
|
||||||
|
HTMLXMLHttpRequestFactory_QueryInterface,
|
||||||
|
HTMLXMLHttpRequestFactory_AddRef,
|
||||||
|
HTMLXMLHttpRequestFactory_Release,
|
||||||
|
HTMLXMLHttpRequestFactory_GetTypeInfoCount,
|
||||||
|
HTMLXMLHttpRequestFactory_GetTypeInfo,
|
||||||
|
HTMLXMLHttpRequestFactory_GetIDsOfNames,
|
||||||
|
HTMLXMLHttpRequestFactory_Invoke,
|
||||||
|
HTMLXMLHttpRequestFactory_create
|
||||||
|
};
|
||||||
|
|
||||||
|
static const tid_t HTMLXMLHttpRequestFactory_iface_tids[] = {
|
||||||
|
IHTMLXMLHttpRequestFactory_tid,
|
||||||
|
0
|
||||||
|
};
|
||||||
|
static dispex_static_data_t HTMLXMLHttpRequestFactory_dispex = {
|
||||||
|
NULL,
|
||||||
|
IHTMLXMLHttpRequestFactory_tid,
|
||||||
|
NULL,
|
||||||
|
HTMLXMLHttpRequestFactory_iface_tids
|
||||||
|
};
|
||||||
|
|
||||||
|
HRESULT HTMLXMLHttpRequestFactory_Create(HTMLInnerWindow* window, HTMLXMLHttpRequestFactory **ret_ptr)
|
||||||
|
{
|
||||||
|
HTMLXMLHttpRequestFactory *ret;
|
||||||
|
|
||||||
|
ret = heap_alloc(sizeof(*ret));
|
||||||
|
if(!ret)
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
|
||||||
|
ret->IHTMLXMLHttpRequestFactory_iface.lpVtbl = &HTMLXMLHttpRequestFactoryVtbl;
|
||||||
|
ret->ref = 1;
|
||||||
|
|
||||||
|
init_dispex(&ret->dispex, (IUnknown*)&ret->IHTMLXMLHttpRequestFactory_iface,
|
||||||
|
&HTMLXMLHttpRequestFactory_dispex);
|
||||||
|
|
||||||
|
*ret_ptr = ret;
|
||||||
|
return S_OK;
|
||||||
|
}
|
Loading…
Reference in New Issue